pub enum CustomFormat {
JSONLanguageMap,
YAMLLanguageMap,
JSONArrayLanguageMap,
LangcodecResourceArray,
}Expand description
Custom format types that are not supported by the lib crate. These are one-way conversions only (to Resource format).
Variants§
JSONLanguageMap
A JSON file which contains a map of language codes to translations.
The key is the localization code, and the value is the translation:
{
"key": "hello_world",
"en": "Hello, World!",
"fr": "Bonjour, le monde!"
}YAMLLanguageMap
A YAML file which contains a map of language codes to translations.
The key is the localization code, and the value is the translation:
key: hello_world
en: Hello, World!
fr: Bonjour, le monde!JSONArrayLanguageMap
A JSON file which contains an array of language map objects.
Each object contains a key and translations for different languages:
[
{
"key": "hello_world",
"en": "Hello, World!",
"fr": "Bonjour, le monde!"
},
{
"key": "welcome_message",
"en": "Welcome to our app!",
"fr": "Bienvenue dans notre application!"
}
]LangcodecResourceArray
A JSON file which contains an array of langcodec::Resource objects.
Each object is a complete Resource with metadata and entries:
[
{
"metadata": {
"language": "en",
"domain": "MyApp"
},
"entries": [
{
"id": "hello_world",
"value": "Hello, World!",
"comment": "Welcome message"
}
]
},
{
"metadata": {
"language": "fr",
"domain": "MyApp"
},
"entries": [
{
"id": "hello_world",
"value": "Bonjour, le monde!",
"comment": "Welcome message"
}
]
}
]Trait Implementations§
Source§impl Clone for CustomFormat
impl Clone for CustomFormat
Source§fn clone(&self) -> CustomFormat
fn clone(&self) -> CustomFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CustomFormat
impl Debug for CustomFormat
Source§impl FromStr for CustomFormat
impl FromStr for CustomFormat
Source§impl PartialEq for CustomFormat
impl PartialEq for CustomFormat
Source§impl ValueEnum for CustomFormat
impl ValueEnum for CustomFormat
impl StructuralPartialEq for CustomFormat
Auto Trait Implementations§
impl Freeze for CustomFormat
impl RefUnwindSafe for CustomFormat
impl Send for CustomFormat
impl Sync for CustomFormat
impl Unpin for CustomFormat
impl UnwindSafe for CustomFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more