Class Rosetta
Rosetta i18n management at run-time.
Inheritance
Inherited Members
Namespace: Rosetta.Runtime
Assembly: Rosetta.Runtime.dll
Syntax
public static class Rosetta
Fields
| Improve this Doc View SourceDevLocale
Default language for game development.
Declaration
public static LangFlag DevLocale
Field Value
Type | Description |
---|---|
LangFlag |
I18NAudioCache
The I18N AudioClip cache.Storage by space.
Declaration
public static Dictionary<string, Dictionary<string, AudioClip>> I18NAudioCache
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.Dictionary<System.String, UnityEngine.AudioClip>> |
I18NFontCache
The I18N Font cache.
Declaration
public static Dictionary<string, Font> I18NFontCache
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, UnityEngine.Font> |
I18NSpriteCache
The I18N Sprite cache.Storage by space.
Declaration
public static Dictionary<string, Dictionary<string, Sprite>> I18NSpriteCache
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.Dictionary<System.String, UnityEngine.Sprite>> |
I18NTextCache
The I18N String cache.Storage by space.
Declaration
public static Dictionary<string, Dictionary<string, string>> I18NTextCache
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.Dictionary<System.String, System.String>> |
I18NTextFileType
I18N File type of text file.
Declaration
public static I18NFileType I18NTextFileType
Field Value
Type | Description |
---|---|
I18NFileType |
I18NTMPFontCache
The I18N TMP_FontAsset cache.
Declaration
public static Dictionary<string, TMP_FontAsset> I18NTMPFontCache
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, TMPro.TMP_FontAsset> |
LangNames
The dictionary of language names.
Declaration
public static readonly Dictionary<LangFlag, string> LangNames
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<LangFlag, System.String> |
Loaders
All I18N File Loader.
Declaration
public static Dictionary<I18NFileType, LoaderBase> Loaders
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<I18NFileType, LoaderBase> |
LoadPath
ToDo: error I18N files load path.
Declaration
public static readonly List<string> LoadPath
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
MultiMediaLoader
Declaration
public static MultiMediaLoader MultiMediaLoader
Field Value
Type | Description |
---|---|
MultiMediaLoader |
Properties
| Improve this Doc View SourceLocale
Default language for game runtime.
Declaration
public static LangFlag Locale { get; set; }
Property Value
Type | Description |
---|---|
LangFlag |
Methods
| Improve this Doc View SourceClearAllCache()
Clean All I18N Resource Cache(Text\Sprite\Audio\Font).
Declaration
public static void ClearAllCache()
GetAudio(String, String)
Returns the selected AudioClip resource for the current language.
Declaration
public static AudioClip GetAudio(string resName, string i18NSpace)
Parameters
Type | Name | Description |
---|---|---|
System.String | resName | |
System.String | i18NSpace |
Returns
Type | Description |
---|---|
UnityEngine.AudioClip |
GetFont(String)
Returns the selected Font resource for the current language.
Declaration
public static Font GetFont(string resName)
Parameters
Type | Name | Description |
---|---|---|
System.String | resName |
Returns
Type | Description |
---|---|
UnityEngine.Font |
GetSprite(String, String)
Returns the selected Sprite resource for the current language.
Declaration
public static Sprite GetSprite(string resName, string i18NSpace)
Parameters
Type | Name | Description |
---|---|---|
System.String | resName | |
System.String | i18NSpace |
Returns
Type | Description |
---|---|
UnityEngine.Sprite |
GetText(String, String)
Returns the selected text for the current language.
Declaration
public static string GetText(string i18NString, string i18NSpace)
Parameters
Type | Name | Description |
---|---|---|
System.String | i18NString | |
System.String | i18NSpace |
Returns
Type | Description |
---|---|
System.String |
GetTMP_Font(String)
Returns the selected TMP_FontAsset resource for the current language.
Declaration
public static TMP_FontAsset GetTMP_Font(string resName)
Parameters
Type | Name | Description |
---|---|---|
System.String | resName |
Returns
Type | Description |
---|---|
TMPro.TMP_FontAsset |
Init(LangFlag, LangFlag, List<String>, I18NFileType)
Initialize the Rosetta.
Declaration
public static void Init(LangFlag devLocale, LangFlag locale, List<string> i18NSpaces, I18NFileType textFileType = I18NFileType.Po)
Parameters
Type | Name | Description |
---|---|---|
LangFlag | devLocale | Default language for game development. |
LangFlag | locale | Default language for game runtime. |
System.Collections.Generic.List<System.String> | i18NSpaces | All Runtime default i18n space |
I18NFileType | textFileType | I18N File type of text file. |
Init(Nullable<LangFlag>)
Initialize the Rosetta by RosettaRuntimeSetting.
Declaration
public static void Init(LangFlag? locale = default(LangFlag? ))
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<LangFlag> | locale | Default language for game runtime. |
IsDefault()
Returns true if Locale equals DevLocale.
Declaration
public static bool IsDefault()
Returns
Type | Description |
---|---|
System.Boolean |
LoadI18NResSpace(String)
Load given space I18N Resource.
Declaration
public static void LoadI18NResSpace(string space)
Parameters
Type | Name | Description |
---|---|---|
System.String | space | Space to be unloaded |
UnloadI18NResSpace(String)
Destroys and removes all given space I18N resource cache.
Declaration
public static void UnloadI18NResSpace(string space)
Parameters
Type | Name | Description |
---|---|---|
System.String | space | Space to be unloaded |
Events
| Improve this Doc View SourceI18NFileMissing
Subscribe to this event to get notified when the I18N Files are missing.
Declaration
public static event Action<LangFlag, Exception> I18NFileMissing
Event Type
Type | Description |
---|---|
System.Action<LangFlag, System.Exception> |
I18NStringMissing
Subscribe to this event to get notified when the I18N strings are missing.
Declaration
public static event Action<LangFlag, string, string> I18NStringMissing
Event Type
Type | Description |
---|---|
System.Action<LangFlag, System.String, System.String> |
LocaleChanged
Subscribe to this event to get notified when the locale has changed.
Declaration
public static event Action<LangFlag> LocaleChanged
Event Type
Type | Description |
---|---|
System.Action<LangFlag> |