pub struct Texts { /* private fields */ }Expand description
画面の文言の口。lingokit の Localizer(このクレートの .ftl)と、本体・音源の表をつなぐ。
1 回の実行で 1 つ作り、言語は作るときに決まる。Send + Sync なので MCP サーバーでは
Arc で共有する。
Implementations§
Source§impl Texts
impl Texts
Sourcepub fn override_text(&self, key: &str) -> Option<String>
pub fn override_text(&self, key: &str) -> Option<String>
このクレートの .ftl(選ばれた言語)でのキーの文。なければ None(本体・音源の表の文を
使う)。上書きの口(pikopiko::report::synth_catalog_with など)に渡す。
Sourcepub fn diagnostic(&self, d: &Diagnostic) -> String
pub fn diagnostic(&self, d: &Diagnostic) -> String
診断の文を、この言語で。このクレートの .ftl に diag-<キー> があればそれ、なければ
本体の表から作る(言葉はこのクレートの .ftl で上書きできる)。
Sourcepub fn error<E: Localized + ?Sized>(&self, e: &E) -> String
pub fn error<E: Localized + ?Sized>(&self, e: &E) -> String
エラーの型の文を、この言語で。このクレートの .ftl にキー(err-…)があればそれ、なければ
エラーの型の表(pikopiko::text::InLang)。
Sourcepub fn synth_text(&self, spec: &SynthSpec, key: &str) -> String
pub fn synth_text(&self, spec: &SynthSpec, key: &str) -> String
音源の文(キーは pikopiko::synth::text_key の形)を、この言語で。このクレートの .ftl に
あればそれ、なければ音源の表。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Texts
impl !UnwindSafe for Texts
impl Forget for Texts
impl Freeze for Texts
impl Move for Texts
impl Send for Texts
impl Sync for Texts
impl Unpin for Texts
impl UnsafeUnpin for Texts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more