I18N.DotNet v1.3.1
|
Simple loadable localizer. More...
Public Member Functions | |||||||||||
Localizer () | |||||||||||
Default constructor. More... | |||||||||||
void | LoadXML (string filepath, CultureInfo? culture=null) | ||||||||||
Loads translations for the given culture from a localization configuration file in XML format. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (string filepath, string language) | ||||||||||
Loads translations for the given language from a localization configuration file in XML format. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (string filepath, bool merge) | ||||||||||
Loads translations for the current localizer language from a localization configuration file in XML format.
| |||||||||||
void | LoadXML (Stream stream, CultureInfo? culture=null) | ||||||||||
Loads translations for the given culture from a localization configuration file in XML format obtained from a stream. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (Stream stream, string language) | ||||||||||
Loads translations for the given language from a localization configuration file obtained in XML format from a stream. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (Stream stream, bool merge) | ||||||||||
Loads translations for the current localizer language from a localization configuration file in XML format obtained from a stream.
| |||||||||||
void | LoadXML (XDocument doc, CultureInfo? culture=null) | ||||||||||
Loads translations for the given culture from a localization configuration in an XML document. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (XDocument doc, string language) | ||||||||||
Loads translations for the given language from a localization configuration in an XML document. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (XDocument doc, bool merge) | ||||||||||
Loads translations for the current localizer language from a localization configuration in an XML document.
| |||||||||||
void | LoadXML (Assembly assembly, string resourceName, CultureInfo? culture=null) | ||||||||||
Loads translations for the given culture from a localization configuration file in XML format obtained from an embedded resource in the given assembly. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (Assembly assembly, string resourceName, string language) | ||||||||||
Loads translations for the given language from a localization configuration file in XML format obtained from an embedded resource in the given assembly. All the translations loaded previously in the localizer are discarded and replaced with the new ones. More... | |||||||||||
void | LoadXML (Assembly assembly, string resourceName, bool merge) | ||||||||||
Loads translations for the current localizer language from a localization configuration file in XML format obtained from an embedded resource in the given assembly.
| |||||||||||
string | Localize (PlainString text) | ||||||||||
Localizes a string. Converts the base-language string text to its corresponding language-specific localized value. More... | |||||||||||
string | Localize (FormattableString frmtText) | ||||||||||
Localizes an interpolated string. Converts the composite format string of the base-language formattable string frmtText (e.g. an interpolated string) to its corresponding language-specific localized composite format value, and then generates the result by formatting the localized composite format value along with the frmtText arguments by using the formatting conventions of the localizer culture. More... | |||||||||||
IEnumerable< string > | Localize (IEnumerable< string > texts) | ||||||||||
Localizes multiple strings. Converts the base-language strings in texts to their corresponding language-specific localized values. More... | |||||||||||
string | LocalizeFormat (string format, params object?[] args) | ||||||||||
string | LocalizeFormat (string format, params object[] args) | ||||||||||
Localizes and then formats a string. More... | |||||||||||
ContextLocalizer | Context (string contextId) | ||||||||||
Gets the localizer for a context in the current localizer. Contexts are used to disambiguate the conversion of the same base-language string to different language-specific strings depending on the context where the conversion is performed. More... | |||||||||||
ContextLocalizer | Context (IEnumerable< string > splitContextIds) | ||||||||||
Gets the localizer for a context in the current localizer. Contexts are used to disambiguate the conversion of the same base-language string to different language-specific strings depending on the context where the conversion is performed. More... | |||||||||||
Protected Member Functions | |
void | Clear () |
void | Load (XElement element) |
Properties | |
string | TargetLanguage [get] |
Target language of the localizer. More... | |
CultureInfo | TargetCulture [get] |
Target culture of the localizer. More... | |
Language | Language [get, set] |
Simple loadable localizer.
Localizer | ( | ) |
Default constructor.
|
protectedinherited |
|
inherited |
Gets the localizer for a context in the current localizer. Contexts are used to disambiguate the conversion of the same base-language string to different language-specific strings depending on the context where the conversion is performed.
Implements ILocalizer.
|
inherited |
Gets the localizer for a context in the current localizer. Contexts are used to disambiguate the conversion of the same base-language string to different language-specific strings depending on the context where the conversion is performed.
Implements ILocalizer.
|
protectedinherited |
void LoadXML | ( | Assembly | assembly, |
string | resourceName, | ||
bool | merge | ||
) |
Loads translations for the current localizer language from a localization configuration file in XML format obtained from an embedded resource in the given assembly.
assembly | Assembly that contains the embedded XML file. |
resourceName | Name of the embedded resource for the XML file. |
merge | Replaces the current translations with the loaded ones when<c>false, otherwise merges both (existing translations are overridden with loaded ones). |
ParseException | Thrown when the stream contents cannot be parsed properly. |
InvalidOperationException | Thrown when the embedded resource could not be found in the given assembly. |
Implements ILoadableLocalizer.
void LoadXML | ( | Assembly | assembly, |
string | resourceName, | ||
CultureInfo? | culture = null |
||
) |
Loads translations for the given culture from a localization configuration file in XML format obtained from an embedded resource in the given assembly. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | Assembly | assembly, |
string | resourceName, | ||
string | language | ||
) |
Loads translations for the given language from a localization configuration file in XML format obtained from an embedded resource in the given assembly. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | Stream | stream, |
bool | merge | ||
) |
Loads translations for the current localizer language from a localization configuration file in XML format obtained from a stream.
stream | Stream with the localization configuration. |
merge | Replaces the current translations with the loaded ones when<c>false, otherwise merges both (existing translations are overridden with loaded ones). |
ParseException | Thrown when the stream contents cannot be parsed properly. |
Implements ILoadableLocalizer.
void LoadXML | ( | Stream | stream, |
CultureInfo? | culture = null |
||
) |
Loads translations for the given culture from a localization configuration file in XML format obtained from a stream. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | Stream | stream, |
string | language | ||
) |
Loads translations for the given language from a localization configuration file obtained in XML format from a stream. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | string | filepath, |
bool | merge | ||
) |
Loads translations for the current localizer language from a localization configuration file in XML format.
filepath | Path to the localization configuration file. |
merge | Replaces the current translations with the loaded ones when<c>false, otherwise merges both (existing translations are overridden with loaded ones). |
ParseException | Thrown when the input file cannot be parsed properly. |
Implements ILoadableLocalizer.
void LoadXML | ( | string | filepath, |
CultureInfo? | culture = null |
||
) |
Loads translations for the given culture from a localization configuration file in XML format. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | string | filepath, |
string | language | ||
) |
Loads translations for the given language from a localization configuration file in XML format. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | XDocument | doc, |
bool | merge | ||
) |
Loads translations for the current localizer language from a localization configuration in an XML document.
doc | XML document with the localization configuration. |
merge | Replaces the current translations with the loaded ones when<c>false, otherwise merges both (existing translations are overridden with loaded ones). |
ParseException | Thrown when the stream contents cannot be parsed properly. |
Implements ILoadableLocalizer.
void LoadXML | ( | XDocument | doc, |
CultureInfo? | culture = null |
||
) |
Loads translations for the given culture from a localization configuration in an XML document. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
void LoadXML | ( | XDocument | doc, |
string | language | ||
) |
Loads translations for the given language from a localization configuration in an XML document. All the translations loaded previously in the localizer are discarded and replaced with the new ones.
Implements ILoadableLocalizer.
|
inherited |
Localizes an interpolated string. Converts the composite format string of the base-language formattable string frmtText (e.g. an interpolated string) to its corresponding language-specific localized composite format value, and then generates the result by formatting the localized composite format value along with the frmtText arguments by using the formatting conventions of the localizer culture.
Implements ILocalizer.
|
inherited |
Localizes multiple strings. Converts the base-language strings in texts to their corresponding language-specific localized values.
Implements ILocalizer.
|
inherited |
Localizes a string. Converts the base-language string text to its corresponding language-specific localized value.
Implements ILocalizer.
|
inherited |
|
inherited |
Localizes and then formats a string.
Converts the base-language format string format to its corresponding language-specific localized format value, and then generates the result by formatting the localized format value along with the args arguments by using the formatting conventions of the localizer culture.
format | Base-language format string. |
args | Arguments for the format string. |
FormatException | Thrown when format or its localized format value is invalid. |
Implemented in AutoLoadLocalizer.
|
getsetprotectedinherited |
|
getinherited |
Target culture of the localizer.
Implements ILocalizer.
|
getinherited |
Target language of the localizer.
Implements ILocalizer.