pub enum Languages {
LocalLang = 0,
English = 1,
}Expand description
Supported languages in the GUI framework.
This enum defines the available languages for internationalization. New languages can be added by extending this enum.
Variants§
Implementations§
Source§impl Languages
impl Languages
Sourcepub fn next(self) -> Self
pub fn next(self) -> Self
Returns the next language in the sequence.
This method cycles through the available languages, returning the next language after the current one. It wraps around to the first language when reaching the end.
§Returns
The next language in the sequence.
Sourcepub fn set_language(lang: Languages)
pub fn set_language(lang: Languages)
Sets the current language globally.
This method updates the global language selection using atomic operations. The change affects all subsequent string lookups throughout the application.
§Arguments
lang- The language to set as current.
Sourcepub fn get_language() -> Languages
pub fn get_language() -> Languages
Returns the currently selected language.
This method retrieves the current language selection from the atomic storage. The returned language determines which string variant is used for all internationalized strings.
§Returns
The currently selected language.
Sourcepub fn switch_language()
pub fn switch_language()
Switches to the next language in the sequence.
This is a convenience method that combines get_language() and next()
to cycle through available languages. It updates the global language
selection to the next language in the sequence.
Trait Implementations§
Source§impl From<Languages> for &'static str
Conversion from Languages to a static string slice.
impl From<Languages> for &'static str
Conversion from Languages to a static string slice.
This implementation provides a human-readable name for each language.
For LocalLang, it attempts to use the LOCAL_LANG_STRING environment variable
at compile time, falling back to “中文” if not set.
Source§impl From<u8> for Languages
Conversion from a byte index to Languages.
impl From<u8> for Languages
Conversion from a byte index to Languages.
This implementation allows converting a language index (as stored in the
atomic SELECTION variable) back to a Languages enum variant.