![]() |
BogaNet 1.4.0
|
Interface for localizers of the application. More...
Public Member Functions | |
delegate void | CultureChanged (CultureInfo lang) |
Delegate for culture changes. | |
delegate void | FilesLoaded (params string[] files) |
Delegate for the load status of the files. | |
delegate void | FileSaved (string file) |
Delegate for the save status of the file. | |
string | GetText (string key, TextType textType=TextType.LABEL) |
Gets the text for a key and the current culture. | |
bool | TryGetText (string key, out string result, TextType textType=TextType.LABEL) |
Tries to get the text for a key and the current culture. | |
string | GetText (string key, CultureInfo culture, TextType textType=TextType.LABEL) |
Gets the text for a key and a given culture. | |
bool | TryGetText (string key, out string result, CultureInfo culture, TextType textType=TextType.LABEL) |
Tries to get the text for a key and a given culture. | |
string | GetTextWithReplacements (string key, TextType textType=TextType.LABEL, params string[] replacements) |
Gets the text for a key with replacements (for placeholders like '{0}') and the current culture. | |
bool | TryGetTextWithReplacements (string key, out string result, TextType textType=TextType.LABEL, params string[] replacements) |
Tries to get the text for a key with replacements (for placeholders like '{0}') and the current culture. | |
string | GetTextWithReplacements (string key, CultureInfo culture, TextType textType=TextType.LABEL, params string[] replacements) |
Gets the text for a key with replacements (for placeholders like '{0}') and a given culture. | |
bool | TryGetTextWithReplacements (string key, out string result, CultureInfo culture, TextType textType=TextType.LABEL, params string[] replacements) |
Tries to get the text for a key with replacements (for placeholders like '{0}') and a given culture. | |
bool | ContainsKey (string key, CultureInfo? culture=null) |
Checks if a given key exists in the localizer. | |
void | Add (string key, CultureInfo culture, string value) |
Adds a translated text. | |
bool | Remove (string key, CultureInfo? culture=null) |
Removes a key and assigned translated texts. | |
void | Clear () |
Clears all translations. | |
void | Load (Dictionary< string, string[]> dataDict) |
Loads translations from a given Dictionary. | |
bool | LoadFiles (params string[] files) |
Load translation files (CSV) from a given path. | |
Task< bool > | LoadFilesAsync (params string[] files) |
Load translation files (CSV) from a given path asynchronously. | |
bool | LoadFilesFromUrl (params string[] urls) |
Load translation files (CSV) from given URLs. | |
Task< bool > | LoadFilesFromUrlAsync (params string[] urls) |
Load translation files (CSV) from given URLs asynchronously. | |
bool | SaveFile (string filename) |
Saves all translations to a given file (CSV). | |
Task< bool > | SaveFileAsync (string filename) |
Saves all translations to a given file (CSV) asynchronously. | |
Properties | |
CultureInfo | Culture [get, set] |
Current culture. | |
List< CultureInfo > | SupportedCultures [get] |
Supported cultures. | |
List< string > | MissingTranslations [get] |
List of missing translations. | |
List< string > | MissingCountries [get] |
List of missing country codes. | |
List< string > | RemovedTranslations [get] |
List of removed translations. | |
List< string > | AddedTranslations [get] |
List of added translations. | |
bool | IsLoaded [get] |
Is the localizer loaded? | |
List< string > | Keys [get] |
Current keys of the localizer. | |
int | Count [get] |
Current count of keys from the localizer. | |
Events | |
CultureChanged | OnCultureChanged |
Event triggered whenever the culture changes. | |
FilesLoaded | OnFilesLoaded |
Event triggered whenever the files are loaded. | |
FileSaved | OnFileSaved |
Event triggered whenever the file is saved. | |
Interface for localizers of the application.
void BogaNet.i18n.ILocalizer.Add | ( | string | key, |
CultureInfo | culture, | ||
string | value ) |
Adds a translated text.
key | Key for the text |
culture | Culture for the text |
value | Value of the text |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
void BogaNet.i18n.ILocalizer.Clear | ( | ) |
Clears all translations.
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.ContainsKey | ( | string | key, |
CultureInfo? | culture = null ) |
Checks if a given key exists in the localizer.
key | Key to check |
culture | Culture of the key (optional, default: any) |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
delegate void BogaNet.i18n.ILocalizer.CultureChanged | ( | CultureInfo | lang | ) |
Delegate for culture changes.
delegate void BogaNet.i18n.ILocalizer.FileSaved | ( | string | file | ) |
Delegate for the save status of the file.
delegate void BogaNet.i18n.ILocalizer.FilesLoaded | ( | params string[] | files | ) |
Delegate for the load status of the files.
string BogaNet.i18n.ILocalizer.GetText | ( | string | key, |
CultureInfo | culture, | ||
TextType | textType = TextType.LABEL ) |
Gets the text for a key and a given culture.
key | Key for the text |
culture | Culture for the text |
textType | Type of the text (optional, default: LABEL) |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
string BogaNet.i18n.ILocalizer.GetText | ( | string | key, |
TextType | textType = TextType.LABEL ) |
Gets the text for a key and the current culture.
key | Key for the text |
textType | Type of the text (optional, default: LABEL) |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
string BogaNet.i18n.ILocalizer.GetTextWithReplacements | ( | string | key, |
CultureInfo | culture, | ||
TextType | textType = TextType.LABEL, | ||
params string[] | replacements ) |
Gets the text for a key with replacements (for placeholders like '{0}') and a given culture.
key | Key for the text |
culture | Culture for the text |
textType | Type of the text (optional, default: LABEL) |
replacements | Replacements for the text |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
string BogaNet.i18n.ILocalizer.GetTextWithReplacements | ( | string | key, |
TextType | textType = TextType.LABEL, | ||
params string[] | replacements ) |
Gets the text for a key with replacements (for placeholders like '{0}') and the current culture.
key | Key for the text |
textType | Type of the text (optional, default: LABEL) |
replacements | Replacements for the text |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
void BogaNet.i18n.ILocalizer.Load | ( | Dictionary< string, string[]> | dataDict | ) |
Loads translations from a given Dictionary.
dataDict | Dictionary to load |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.LoadFiles | ( | params string[] | files | ) |
Load translation files (CSV) from a given path.
files | Files to load |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
Task< bool > BogaNet.i18n.ILocalizer.LoadFilesAsync | ( | params string[] | files | ) |
Load translation files (CSV) from a given path asynchronously.
files | Files to load |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.LoadFilesFromUrl | ( | params string[] | urls | ) |
Load translation files (CSV) from given URLs.
urls | URLs of files to load |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
Task< bool > BogaNet.i18n.ILocalizer.LoadFilesFromUrlAsync | ( | params string[] | urls | ) |
Load translation files (CSV) from given URLs asynchronously.
urls | URLs of files to load |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.Remove | ( | string | key, |
CultureInfo? | culture = null ) |
Removes a key and assigned translated texts.
key | Key to remove |
culture | Culture of the key (optional, default: all) |
returns>True if the operation was successful
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.SaveFile | ( | string | filename | ) |
Saves all translations to a given file (CSV).
filename | File for the translations |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
Task< bool > BogaNet.i18n.ILocalizer.SaveFileAsync | ( | string | filename | ) |
Saves all translations to a given file (CSV) asynchronously.
filename | File for the translations |
returns>True if the operation was successful
Exception |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.TryGetText | ( | string | key, |
out string | result, | ||
CultureInfo | culture, | ||
TextType | textType = TextType.LABEL ) |
Tries to get the text for a key and a given culture.
key | Key for the text |
result | out parameter for the result |
culture | Culture for the text |
textType | Type of the text (optional, default: LABEL) |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.TryGetText | ( | string | key, |
out string | result, | ||
TextType | textType = TextType.LABEL ) |
Tries to get the text for a key and the current culture.
key | Key for the text |
result | out parameter for the result |
textType | Type of the text (optional, default: LABEL) |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.TryGetTextWithReplacements | ( | string | key, |
out string | result, | ||
CultureInfo | culture, | ||
TextType | textType = TextType.LABEL, | ||
params string[] | replacements ) |
Tries to get the text for a key with replacements (for placeholders like '{0}') and a given culture.
key | Key for the text |
result | out parameter for the result |
culture | Culture for the text |
textType | Type of the text (optional, default: LABEL) |
replacements | Replacements for the text |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
bool BogaNet.i18n.ILocalizer.TryGetTextWithReplacements | ( | string | key, |
out string | result, | ||
TextType | textType = TextType.LABEL, | ||
params string[] | replacements ) |
Tries to get the text for a key with replacements (for placeholders like '{0}') and the current culture.
key | Key for the text |
result | out parameter for the result |
textType | Type of the text (optional, default: LABEL) |
replacements | Replacements for the text |
ArgumentNullException |
Implemented in BogaNet.i18n.Localizer.
|
get |
List of added translations.
Implemented in BogaNet.i18n.Localizer.
|
get |
Current count of keys from the localizer.
Implemented in BogaNet.i18n.Localizer.
|
getset |
Current culture.
Implemented in BogaNet.i18n.Localizer.
|
get |
Is the localizer loaded?
Implemented in BogaNet.i18n.Localizer.
|
get |
Current keys of the localizer.
Implemented in BogaNet.i18n.Localizer.
|
get |
List of missing country codes.
Implemented in BogaNet.i18n.Localizer.
|
get |
List of missing translations.
Implemented in BogaNet.i18n.Localizer.
|
get |
List of removed translations.
Implemented in BogaNet.i18n.Localizer.
|
get |
Supported cultures.
Implemented in BogaNet.i18n.Localizer.
CultureChanged BogaNet.i18n.ILocalizer.OnCultureChanged |
Event triggered whenever the culture changes.
FileSaved BogaNet.i18n.ILocalizer.OnFileSaved |
Event triggered whenever the file is saved.
FilesLoaded BogaNet.i18n.ILocalizer.OnFilesLoaded |
Event triggered whenever the files are loaded.