BogaNet 1.4.0
Loading...
Searching...
No Matches
Public Member Functions | Properties | Events | List of all members
BogaNet.i18n.ILocalizer Interface Reference

Interface for localizers of the application. More...

Inheritance diagram for BogaNet.i18n.ILocalizer:
BogaNet.i18n.Localizer

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.
 

Detailed Description

Interface for localizers of the application.

Member Function Documentation

◆ Add()

void BogaNet.i18n.ILocalizer.Add ( string key,
CultureInfo culture,
string value )

Adds a translated text.

Parameters
keyKey for the text
cultureCulture for the text
valueValue of the text
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ Clear()

void BogaNet.i18n.ILocalizer.Clear ( )

Clears all translations.

Implemented in BogaNet.i18n.Localizer.

◆ ContainsKey()

bool BogaNet.i18n.ILocalizer.ContainsKey ( string key,
CultureInfo? culture = null )

Checks if a given key exists in the localizer.

Parameters
keyKey to check
cultureCulture of the key (optional, default: any)
Returns
True if the key exists in the localizer
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ CultureChanged()

delegate void BogaNet.i18n.ILocalizer.CultureChanged ( CultureInfo lang)

Delegate for culture changes.

◆ FileSaved()

delegate void BogaNet.i18n.ILocalizer.FileSaved ( string file)

Delegate for the save status of the file.

◆ FilesLoaded()

delegate void BogaNet.i18n.ILocalizer.FilesLoaded ( params string[] files)

Delegate for the load status of the files.

◆ GetText() [1/2]

string BogaNet.i18n.ILocalizer.GetText ( string key,
CultureInfo culture,
TextType textType = TextType.LABEL )

Gets the text for a key and a given culture.

Parameters
keyKey for the text
cultureCulture for the text
textTypeType of the text (optional, default: LABEL)
Returns
Text for the key
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ GetText() [2/2]

string BogaNet.i18n.ILocalizer.GetText ( string key,
TextType textType = TextType.LABEL )

Gets the text for a key and the current culture.

Parameters
keyKey for the text
textTypeType of the text (optional, default: LABEL)
Returns
Text for the key
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ GetTextWithReplacements() [1/2]

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.

Parameters
keyKey for the text
cultureCulture for the text
textTypeType of the text (optional, default: LABEL)
replacementsReplacements for the text
Returns
Text with replacements for the key
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ GetTextWithReplacements() [2/2]

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.

Parameters
keyKey for the text
textTypeType of the text (optional, default: LABEL)
replacementsReplacements for the text
Returns
Text with replacements for the key
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ Load()

void BogaNet.i18n.ILocalizer.Load ( Dictionary< string, string[]> dataDict)

Loads translations from a given Dictionary.

Parameters
dataDictDictionary to load

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ LoadFiles()

bool BogaNet.i18n.ILocalizer.LoadFiles ( params string[] files)

Load translation files (CSV) from a given path.

Parameters
filesFiles to load

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ LoadFilesAsync()

Task< bool > BogaNet.i18n.ILocalizer.LoadFilesAsync ( params string[] files)

Load translation files (CSV) from a given path asynchronously.

Parameters
filesFiles to load

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ LoadFilesFromUrl()

bool BogaNet.i18n.ILocalizer.LoadFilesFromUrl ( params string[] urls)

Load translation files (CSV) from given URLs.

Parameters
urlsURLs of files to load

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ LoadFilesFromUrlAsync()

Task< bool > BogaNet.i18n.ILocalizer.LoadFilesFromUrlAsync ( params string[] urls)

Load translation files (CSV) from given URLs asynchronously.

Parameters
urlsURLs of files to load

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ Remove()

bool BogaNet.i18n.ILocalizer.Remove ( string key,
CultureInfo? culture = null )

Removes a key and assigned translated texts.

Parameters
keyKey to remove
cultureCulture of the key (optional, default: all)

returns>True if the operation was successful

Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ SaveFile()

bool BogaNet.i18n.ILocalizer.SaveFile ( string filename)

Saves all translations to a given file (CSV).

Parameters
filenameFile for the translations

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ SaveFileAsync()

Task< bool > BogaNet.i18n.ILocalizer.SaveFileAsync ( string filename)

Saves all translations to a given file (CSV) asynchronously.

Parameters
filenameFile for the translations

returns>True if the operation was successful

Exceptions
Exception

Implemented in BogaNet.i18n.Localizer.

◆ TryGetText() [1/2]

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.

Parameters
keyKey for the text
resultout parameter for the result
cultureCulture for the text
textTypeType of the text (optional, default: LABEL)
Returns
True if the operation was successful
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ TryGetText() [2/2]

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.

Parameters
keyKey for the text
resultout parameter for the result
textTypeType of the text (optional, default: LABEL)
Returns
True if the operation was successful
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ TryGetTextWithReplacements() [1/2]

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.

Parameters
keyKey for the text
resultout parameter for the result
cultureCulture for the text
textTypeType of the text (optional, default: LABEL)
replacementsReplacements for the text
Returns
True if the operation was successful
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

◆ TryGetTextWithReplacements() [2/2]

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.

Parameters
keyKey for the text
resultout parameter for the result
textTypeType of the text (optional, default: LABEL)
replacementsReplacements for the text
Returns
True if the operation was successful
Exceptions
ArgumentNullException

Implemented in BogaNet.i18n.Localizer.

Property Documentation

◆ AddedTranslations

List<string> BogaNet.i18n.ILocalizer.AddedTranslations
get

List of added translations.

Implemented in BogaNet.i18n.Localizer.

◆ Count

int BogaNet.i18n.ILocalizer.Count
get

Current count of keys from the localizer.

Implemented in BogaNet.i18n.Localizer.

◆ Culture

CultureInfo BogaNet.i18n.ILocalizer.Culture
getset

Current culture.

Implemented in BogaNet.i18n.Localizer.

◆ IsLoaded

bool BogaNet.i18n.ILocalizer.IsLoaded
get

Is the localizer loaded?

Implemented in BogaNet.i18n.Localizer.

◆ Keys

List<string> BogaNet.i18n.ILocalizer.Keys
get

Current keys of the localizer.

Implemented in BogaNet.i18n.Localizer.

◆ MissingCountries

List<string> BogaNet.i18n.ILocalizer.MissingCountries
get

List of missing country codes.

Implemented in BogaNet.i18n.Localizer.

◆ MissingTranslations

List<string> BogaNet.i18n.ILocalizer.MissingTranslations
get

List of missing translations.

Implemented in BogaNet.i18n.Localizer.

◆ RemovedTranslations

List<string> BogaNet.i18n.ILocalizer.RemovedTranslations
get

List of removed translations.

Implemented in BogaNet.i18n.Localizer.

◆ SupportedCultures

List<CultureInfo> BogaNet.i18n.ILocalizer.SupportedCultures
get

Supported cultures.

Implemented in BogaNet.i18n.Localizer.

Event Documentation

◆ OnCultureChanged

CultureChanged BogaNet.i18n.ILocalizer.OnCultureChanged

Event triggered whenever the culture changes.

◆ OnFileSaved

FileSaved BogaNet.i18n.ILocalizer.OnFileSaved

Event triggered whenever the file is saved.

◆ OnFilesLoaded

FilesLoaded BogaNet.i18n.ILocalizer.OnFilesLoaded

Event triggered whenever the files are loaded.


The documentation for this interface was generated from the following file: