Smart Localization  2.3
SmartLocalization.LanguageManager Class Reference

The language worker class for runtime language handling More...

Inheritance diagram for SmartLocalization.LanguageManager:

Public Member Functions

void ChangeLanguage (SmartCultureInfo cultureInfo)
 Change the language into a specified culture More...
 
void ChangeLanguage (string languageCode)
 Change the language into a specified culture More...
 
void ChangeLanguageWithData (string languageDataInResX, string languageCode)
 Tries to load a language with the specified data. Loading data from outside the project currently only supports text unless the asset is apparent(and correctly named in the right folder) in the workspace. More...
 
bool AppendLanguageWithTextData (string languageDataInResX)
 Appends the current language with text data. The method does not support appending localized assets. If duplicates are found, the old value will be overwritten with the new one. More...
 
bool IsLanguageSupported (string languageCode)
 Checks if the language is supported by this application languageName = strings like "en", "es", "sv" More...
 
bool IsLanguageSupportedEnglishName (string englishName)
 Checks if the language is supported with the english name. i.e. "English" "French" etc. More...
 
bool IsLanguageSupported (SmartCultureInfo cultureInfo)
 Checks if a language is supported with a culture info class More...
 
SmartCultureInfo GetCultureInfo (string languageCode)
 Gets the culture info from the available languages list. If the language is not supported it will return null More...
 
string GetSystemLanguageEnglishName ()
 Gets the name of the system language in an english name. If its SystemLanguage.Unknown, a string with the value "Unknown" will be returned. More...
 
SmartCultureInfo GetSupportedSystemLanguage ()
 Gets the smart culture info of the system language if it is supported. otherwise it will return null More...
 
string GetSupportedSystemLanguageCode ()
 Gets the language code of the system language if it is supported. otherwise it will return an empty string. More...
 
List< SmartCultureInfoGetSupportedLanguages ()
 Returns a list of all the supported languages in the project More...
 
List< string > GetKeysWithinCategory (string category)
 Returns a list of keys within a specified category. Example: If you have keys named My.Key, the category would be "My." More...
 
string GetTextValue (string key)
 Returns a text value in the current language for the key. Returns null if nothing is found. More...
 
AudioClip GetAudioClip (string key)
 Gets the audio clip for the current language, returns null if nothing is found More...
 
GameObject GetPrefab (string key)
 Gets the prefab game object for the current language, returns null if nothing is found More...
 
Texture GetTexture (string key)
 Gets a texture for the current language, returns null if nothing is found More...
 
bool HasKey (string key)
 Returns whether or not the key is available in the system. More...
 

Static Public Member Functions

static void SetDontDestroyOnLoad ()
 Sets DontDestroyOnLoad flag on the LanguageManager object. More...
 

Public Attributes

ChangeLanguageEventHandler OnChangeLanguage
 Occurs when a new language is loaded and initialized create a delegate method(ChangeLanguage(LanguageManager languageManager)) and subscribe More...
 
string defaultLanguage = "en"
 The default language More...
 

Properties

static LanguageManager Instance [get]
 Returns an instance of the language manager. Creates a new one if no one exist. If you don't want to create a new one, check the LanguageManager.HasInstance variable first. More...
 
static bool HasInstance [get]
 Returns if there is an active instance of the language manager in the game. More...
 
SortedDictionary< string, LocalizedObjectLanguageDatabase [get]
 The loaded language values of the currently loaded language More...
 
Dictionary< string, string > RawTextDatabase [get]
 Gets all the language values in raw text. NOTE: Potentially performance expensive. Use with caution. More...
 
int NumberOfSupportedLanguages [get]
 The number of supported languages in this project More...
 
string LoadedLanguage [get]
 The language code of the currently loaded language More...
 
SmartCultureInfo CurrentlyLoadedCulture [get]
 Gets the currently loaded SmartCultureInfo. More...
 
bool VerboseLogging [get, set]
 Set this to true if you want extensive error logging More...
 

Detailed Description

The language worker class for runtime language handling

Member Function Documentation

bool SmartLocalization.LanguageManager.AppendLanguageWithTextData ( string  languageDataInResX)

Appends the current language with text data. The method does not support appending localized assets. If duplicates are found, the old value will be overwritten with the new one.

Parameters
languageDataInResXThe language data to append in the .resx format
Returns
Returns if the operation was a success
void SmartLocalization.LanguageManager.ChangeLanguage ( SmartCultureInfo  cultureInfo)

Change the language into a specified culture

Parameters
cultureInfoThe culture to change to
void SmartLocalization.LanguageManager.ChangeLanguage ( string  languageCode)

Change the language into a specified culture

Parameters
languageCodeThe culture to change to
void SmartLocalization.LanguageManager.ChangeLanguageWithData ( string  languageDataInResX,
string  languageCode 
)

Tries to load a language with the specified data. Loading data from outside the project currently only supports text unless the asset is apparent(and correctly named in the right folder) in the workspace.

Parameters
languageDataInResXThe language data to load in the .resx format
languageCodeThe ISO-639 code of the language to load
AudioClip SmartLocalization.LanguageManager.GetAudioClip ( string  key)

Gets the audio clip for the current language, returns null if nothing is found

SmartCultureInfo SmartLocalization.LanguageManager.GetCultureInfo ( string  languageCode)

Gets the culture info from the available languages list. If the language is not supported it will return null

List<string> SmartLocalization.LanguageManager.GetKeysWithinCategory ( string  category)

Returns a list of keys within a specified category. Example: If you have keys named My.Key, the category would be "My."

Returns
A list of keys that starts with the current category key
Parameters
categoryIf you have keys named My.Key, the category would be "My."
GameObject SmartLocalization.LanguageManager.GetPrefab ( string  key)

Gets the prefab game object for the current language, returns null if nothing is found

List<SmartCultureInfo> SmartLocalization.LanguageManager.GetSupportedLanguages ( )

Returns a list of all the supported languages in the project

SmartCultureInfo SmartLocalization.LanguageManager.GetSupportedSystemLanguage ( )

Gets the smart culture info of the system language if it is supported. otherwise it will return null

string SmartLocalization.LanguageManager.GetSupportedSystemLanguageCode ( )

Gets the language code of the system language if it is supported. otherwise it will return an empty string.

string SmartLocalization.LanguageManager.GetSystemLanguageEnglishName ( )

Gets the name of the system language in an english name. If its SystemLanguage.Unknown, a string with the value "Unknown" will be returned.

Texture SmartLocalization.LanguageManager.GetTexture ( string  key)

Gets a texture for the current language, returns null if nothing is found

string SmartLocalization.LanguageManager.GetTextValue ( string  key)

Returns a text value in the current language for the key. Returns null if nothing is found.

bool SmartLocalization.LanguageManager.HasKey ( string  key)

Returns whether or not the key is available in the system.

bool SmartLocalization.LanguageManager.IsLanguageSupported ( string  languageCode)

Checks if the language is supported by this application languageName = strings like "en", "es", "sv"

bool SmartLocalization.LanguageManager.IsLanguageSupported ( SmartCultureInfo  cultureInfo)

Checks if a language is supported with a culture info class

Parameters
cultureInfoThe culture info to check
Returns
If the language is supported
bool SmartLocalization.LanguageManager.IsLanguageSupportedEnglishName ( string  englishName)

Checks if the language is supported with the english name. i.e. "English" "French" etc.

Parameters
englishNameThe english name of the language
Returns
If the language is supported
static void SmartLocalization.LanguageManager.SetDontDestroyOnLoad ( )
static

Sets DontDestroyOnLoad flag on the LanguageManager object.

Member Data Documentation

string SmartLocalization.LanguageManager.defaultLanguage = "en"

The default language

ChangeLanguageEventHandler SmartLocalization.LanguageManager.OnChangeLanguage

Occurs when a new language is loaded and initialized create a delegate method(ChangeLanguage(LanguageManager languageManager)) and subscribe

Property Documentation

SmartCultureInfo SmartLocalization.LanguageManager.CurrentlyLoadedCulture
get

Gets the currently loaded SmartCultureInfo.

The currently loaded culture.

bool SmartLocalization.LanguageManager.HasInstance
staticget

Returns if there is an active instance of the language manager in the game.

LanguageManager SmartLocalization.LanguageManager.Instance
staticget

Returns an instance of the language manager. Creates a new one if no one exist. If you don't want to create a new one, check the LanguageManager.HasInstance variable first.

SortedDictionary<string, LocalizedObject> SmartLocalization.LanguageManager.LanguageDatabase
get

The loaded language values of the currently loaded language

string SmartLocalization.LanguageManager.LoadedLanguage
get

The language code of the currently loaded language

int SmartLocalization.LanguageManager.NumberOfSupportedLanguages
get

The number of supported languages in this project

Dictionary<string, string> SmartLocalization.LanguageManager.RawTextDatabase
get

Gets all the language values in raw text. NOTE: Potentially performance expensive. Use with caution.

bool SmartLocalization.LanguageManager.VerboseLogging
getset

Set this to true if you want extensive error logging


The documentation for this class was generated from the following file: