Class I18N
Provides support for text internationalization/localization for different cultures and languages.
Inheritance
Inherited Members
Namespace: Neodynamic.SDK.Printing
Assembly: cs.temp.dll.dll
Syntax
public class I18N
Constructors
I18N(List<I18NResource>, String, String)
Creates a I18N object based on the specified list of I18NResource objects.
Declaration
public I18N(List<I18NResource> i18nResources, string culture = "en", string fallbackCulture = "en")
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<I18NResource> | i18nResources | The list of I18NResource objects. If null or empty, the built-in English texts are used. |
| System.String | culture | The culture object to use (The TwoLetterISOLanguageName prop of System.Globalization.CultureInfo). If not specified, the English "en" culture will be used. |
| System.String | fallbackCulture | The fallback culture object to use (The TwoLetterISOLanguageName prop of System.Globalization.CultureInfo). If not specified, the English "en" culture will be used. |
I18N(String, String, String)
Creates a I18N object based on the specified JSON data.
Declaration
public I18N(string json = "", string culture = "en", string fallbackCulture = "en")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | The JSON string containing the I18N texts for each supported culture. If null or empty, the built-in English texts are used. |
| System.String | culture | The culture object to use (The TwoLetterISOLanguageName prop of System.Globalization.CultureInfo). If not specified, the English "en" culture will be used. |
| System.String | fallbackCulture | The fallback culture object to use (The TwoLetterISOLanguageName prop of System.Globalization.CultureInfo). If not specified, the English "en" culture will be used. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | The specified JSON is not a valid I18N JSON. |
Properties
CurrentCulture
Gets or sets the current culture object to use (The TwoLetterISOLanguageName prop of System.Globalization.CultureInfo).
Declaration
public string CurrentCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
FallbackCulture
Gets or sets the fallback culture object to use (The TwoLetterISOLanguageName prop of System.Globalization.CultureInfo).
Declaration
public string FallbackCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
GetResourceString(String)
Gets the localized text of the specified resource key.
Declaration
public string GetResourceString(string resourceKey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | resourceKey | The resource key. |
Returns
| Type | Description |
|---|---|
| System.String | The localized text of the specified resource key. If the key is unknown, the key itself is returned. |