pub struct Language { /* private fields */ }
Expand description
Represents a particular language/dialect.
Language
values can be passed to Value::from()
to produce a column
value that can be stored in a column with the Language
category.
Implementations§
source§impl Language
impl Language
sourcepub fn from_code(code: u16) -> Language
pub fn from_code(code: u16) -> Language
Returns a Language
value for the given Windows language identifier
code.
Examples
assert_eq!(msi::Language::from_code(9).code(), 9);
assert_eq!(msi::Language::from_code(1033).code(), 1033);
assert_eq!(msi::Language::from_code(3084).code(), 3084);
sourcepub fn from_tag(tag: &str) -> Language
pub fn from_tag(tag: &str) -> Language
Returns a Language
value for the given RFC 5646 language tag.
Examples
assert_eq!(msi::Language::from_tag("en").tag(), "en");
assert_eq!(msi::Language::from_tag("en-US").tag(), "en-US");
assert_eq!(msi::Language::from_tag("fr-CA").tag(), "fr-CA");
sourcepub fn code(&self) -> u16
pub fn code(&self) -> u16
Returns the Windows language identifier code for this language.
Examples
assert_eq!(msi::Language::from_tag("en").code(), 9);
assert_eq!(msi::Language::from_tag("en-US").code(), 1033);
assert_eq!(msi::Language::from_tag("fr-CA").code(), 3084);
sourcepub fn tag(&self) -> &str
pub fn tag(&self) -> &str
Returns the RFC 5646 language tag for this language. Returns “und”
(the language tag for “undetermined”) if the Language
value is not
recognized.
Examples
assert_eq!(msi::Language::from_code(9).tag(), "en");
assert_eq!(msi::Language::from_code(1033).tag(), "en-US");
assert_eq!(msi::Language::from_code(3084).tag(), "fr-CA");
assert_eq!(msi::Language::from_code(65535).tag(), "und");
Trait Implementations§
source§impl From<Language> for Value
impl From<Language> for Value
Returns a string value containing the code for the given language, suitable
for storing in a column with the Language
category.