-
Notifications
You must be signed in to change notification settings - Fork 0
Translation
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.Translation |
| Namespace | Electron2D |
| Kind | class |
| Category | Display and Localization |
Stores translated messages for one locale.
public sealed class Electron2D.Translation : Electron2D.ResourceProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: Translation
Locale-bound resource with source message keys, optional contexts and deterministic message listing.
A translation resource maps a source message key and optional context to a
translated message for Electron2D.Translation.Locale. Register translation resources
with Electron2D.TranslationServer.AddTranslation(Electron2D.Translation) so
Electron2D.Object.Tr(System.String,System.String) and
Electron2D.TranslationServer.Translate(System.String,System.String) can resolve them.
Electron2D 0.1.0 Preview keeps this resource in memory. Loading translation files from project resources is handled by later settings and import tasks.
This type is not synchronized. Create and mutate translation resources before registering them, or coordinate access externally.
This class is available since Electron2D 0.1.0 Preview.
Electron2D.TranslationServer
| Member | Kind | Summary |
|---|---|---|
Locale |
Property | Gets or sets the locale represented by this translation. |
Electron2D.Translation() |
Constructor | Initializes a new instance of the Translation type. |
AddMessage(System.String, System.String, System.String) |
Method | Adds or replaces a translated message. |
EraseMessage(System.String, System.String) |
Method | Removes a translated message if it exists. |
GetMessage(System.String, System.String) |
Method | Gets a translated message by source key and context. |
GetMessageList() |
Method | Gets the source message keys stored by this translation. |
Kind: Property
public System.String Locale { get; set; }Gets or sets the locale represented by this translation.
The assigned value is normalized by replacing hyphens with underscores,
trimming whitespace and normalizing the language part to lowercase and
the region part to uppercase. For example, pt-BR is stored as
pt_BR.
The current locale value.
-
System.ArgumentNullException: Thrown when the assigned value isnull.
This property is not synchronized.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Translation
Kind: Constructor
public Electron2D.Translation()Initializes a new instance of the Translation type.
The new instance follows the lifetime and validation rules of its declaring type.
This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.
This API is available since Electron2D 0.1.0 Preview.
Electron2D.Translation
Kind: Method
public System.Void AddMessage(System.String, System.String, System.String)(System.String srcMessage, System.String xlatedMessage, System.String context)Adds or replaces a translated message.
Re-adding the same srcMessage and
context replaces the previous translated text.
Contexts let different UI locations use the same source key with
different translations.
-
srcMessage: The source message key. -
xlatedMessage: The translated message text. -
context: The optional message context.
-
System.ArgumentNullException: Thrown whensrcMessage,xlatedMessageorcontextisnull.
This method is not synchronized.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Translation.EraseMessage(System.String,System.String)Electron2D.Translation.GetMessage(System.String,System.String)
Kind: Method
public System.Void EraseMessage(System.String, System.String)(System.String srcMessage, System.String context)Removes a translated message if it exists.
This method follows the validation and lifetime rules of its declaring type.
-
srcMessage: The source message key. -
context: The optional message context.
-
System.ArgumentNullException: Thrown whensrcMessageorcontextisnull.
This method is not synchronized.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Translation.AddMessage(System.String,System.String,System.String)
Kind: Method
public System.String GetMessage(System.String, System.String)(System.String srcMessage, System.String context)Gets a translated message by source key and context.
This method follows the validation and lifetime rules of its declaring type.
-
srcMessage: The source message key. -
context: The optional message context.
The translated message, or an empty string when no matching message exists in this resource.
-
System.ArgumentNullException: Thrown whensrcMessageorcontextisnull.
This method is not synchronized.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Translation.AddMessage(System.String,System.String,System.String)
Kind: Method
public System.String[] GetMessageList()()Gets the source message keys stored by this translation.
This method follows the validation and lifetime rules of its declaring type.
A stable, ordinally sorted array of unique source message keys.
This method is not synchronized.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Translation
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.