Class Translator
Provides a translator for localized PLC strings
Inherited Members
Namespace: AXSharp.Connector.Localizations
Assembly: AXSharp.Connector.dll
Syntax
public class Translator
Methods
| Edit this page View SourceLocalize(string, ITwinElement, CultureInfo)
Declaration
public string Localize(string str, ITwinElement twinElement, CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | |
| ITwinElement | twinElement | |
| CultureInfo | culture |
Returns
| Type | Description |
|---|---|
| string |
SetLocalizationResource(Type, Assembly)
Sets the localization resource for this translator.
Declaration
public void SetLocalizationResource(Type resourceType, Assembly originAssembly = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | resourceType | Type of resource to be used. |
| Assembly | originAssembly |
SetPrimaryTranslatorResource(Type)
Sets the primary application resource for all translators. This would be tipycally set to the resource containing the application's translations. Any matching localization key will be first searched in this resource and then in the library resource. You can leverage this to override library translations with application specific ones.
Declaration
public static void SetPrimaryTranslatorResource(Type resourceType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | resourceType |
Translate(string, ITwinElement, CultureInfo)
Translates localized string.
Declaration
public string Translate(string originalString, ITwinElement twin, CultureInfo culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | originalString | Localized string. |
| ITwinElement | twin | Twin element to which the string is attached. |
| CultureInfo | culture |
Returns
| Type | Description |
|---|---|
| string |