pub trait LocalizationServiceSyncHandler {
// Required methods
fn handle_switch_language(
&self,
language: String,
load_all_context: bool,
remove_old: bool,
) -> Result<bool>;
fn handle_get_current_language(&self) -> Result<String>;
fn handle_switch_context(
&self,
context: String,
language: String,
) -> Result<bool>;
fn handle_hint_context(&self) -> Result<String>;
fn handle_get_string(
&self,
key: String,
context: String,
language: String,
) -> Result<String>;
fn handle_get_strings(
&self,
filter: String,
context: String,
language: String,
) -> Result<BTreeMap<String, String>>;
fn handle_get_file_name(
&self,
filename: String,
is_virtual_path: bool,
context: String,
) -> Result<String>;
}Required Methods§
Sourcefn handle_switch_language(
&self,
language: String,
load_all_context: bool,
remove_old: bool,
) -> Result<bool>
fn handle_switch_language( &self, language: String, load_all_context: bool, remove_old: bool, ) -> Result<bool>
Switch language to specified one.
Sourcefn handle_get_current_language(&self) -> Result<String>
fn handle_get_current_language(&self) -> Result<String>
Get currently active language
Sourcefn handle_switch_context(
&self,
context: String,
language: String,
) -> Result<bool>
fn handle_switch_context( &self, context: String, language: String, ) -> Result<bool>
Switch a context of the language.
Sourcefn handle_hint_context(&self) -> Result<String>
fn handle_hint_context(&self) -> Result<String>
Get currently active context.
Sourcefn handle_get_string(
&self,
key: String,
context: String,
language: String,
) -> Result<String>
fn handle_get_string( &self, key: String, context: String, language: String, ) -> Result<String>
Get a localization string. Return: localization string.
Sourcefn handle_get_strings(
&self,
filter: String,
context: String,
language: String,
) -> Result<BTreeMap<String, String>>
fn handle_get_strings( &self, filter: String, context: String, language: String, ) -> Result<BTreeMap<String, String>>
Get a set of localization string.
Sourcefn handle_get_file_name(
&self,
filename: String,
is_virtual_path: bool,
context: String,
) -> Result<String>
fn handle_get_file_name( &self, filename: String, is_virtual_path: bool, context: String, ) -> Result<String>
Get the file name/path in the language.
The search will go through the context and its sub context to find the file name. Eg. If file name is not found in context com.ruyi, then the search will go on to find it in com.ruyi.moduleA and com.ruyi.moduleB.