v3.6.1 Documentation
Fungus.Localization Class Reference

Multi-language localization support. More...

Inheritance diagram for Fungus.Localization:

Classes

class  TextItem
 Temp storage for a single item of standard text and its localizations. More...
 

Public Member Functions

virtual void OnLevelWasLoaded (int level)
 
virtual void ClearLocalizeableCache ()
 Clears the cache of localizeable objects. More...
 
virtual string GetCSVData ()
 Convert all text items and localized strings to an easy to edit CSV format. More...
 
virtual void SetActiveLanguage (string languageCode, bool forceUpdateSceneText=false)
 Scan a localization CSV file and copies the strings for the specified language code into the text properties of the appropriate scene objects. More...
 
virtual bool PopulateTextProperty (string stringId, string newText)
 Populates the text property of a single scene object with a new text value. More...
 
virtual string GetStandardText ()
 Returns all standard text for localizeable text in the scene using an easy to edit custom text format. More...
 
virtual void SetStandardText (string textData)
 Sets standard text on scene objects by parsing a text data file. More...
 
virtual bool SubstituteStrings (StringBuilder input)
 

Static Public Member Functions

static string GetLocalizedString (string stringId)
 Looks up the specified string in the localized strings table. More...
 

Protected Member Functions

virtual void LevelWasLoaded ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void Start ()
 
virtual void Init ()
 String subsitution can happen during the Start of another component, so we may need to call Init() from other methods. More...
 
virtual void CacheLocalizeableObjects ()
 
Dictionary< string, TextItemFindTextItems ()
 Builds a dictionary of localizable text items in the scene. More...
 
virtual void AddCSVDataItems (Dictionary< string, TextItem > textItems, string csvData)
 Adds localized strings from CSV file data to a dictionary of text items in the scene. More...
 

Protected Attributes

string activeLanguage = ""
 
TextAsset localizationFile
 
Dictionary< string, ILocalizablelocalizeableObjects = new Dictionary<string, ILocalizable>()
 
string notificationText = ""
 
bool initialized
 

Static Protected Attributes

static Dictionary< string, string > localizedStrings = new Dictionary<string, string>()
 

Properties

virtual string ActiveLanguage [get]
 Language to use at startup, usually defined by a two letter language code (e.g DE = German). More...
 
virtual TextAsset LocalizationFile [get, set]
 CSV file containing localization data which can be easily edited in a spreadsheet tool. More...
 
virtual string NotificationText [get, set]
 Stores any notification message from export / import methods. More...
 

Detailed Description

Multi-language localization support.

Definition at line 18 of file Localization.cs.

Member Function Documentation

◆ AddCSVDataItems()

virtual void Fungus.Localization.AddCSVDataItems ( Dictionary< string, TextItem textItems,
string  csvData 
)
protectedvirtual

Adds localized strings from CSV file data to a dictionary of text items in the scene.

Definition at line 181 of file Localization.cs.

◆ CacheLocalizeableObjects()

virtual void Fungus.Localization.CacheLocalizeableObjects ( )
protectedvirtual

Definition at line 106 of file Localization.cs.

◆ ClearLocalizeableCache()

virtual void Fungus.Localization.ClearLocalizeableCache ( )
virtual

Clears the cache of localizeable objects.

Definition at line 285 of file Localization.cs.

◆ FindTextItems()

Dictionary<string, TextItem> Fungus.Localization.FindTextItems ( )
protected

Builds a dictionary of localizable text items in the scene.

Definition at line 123 of file Localization.cs.

◆ GetCSVData()

virtual string Fungus.Localization.GetCSVData ( )
virtual

Convert all text items and localized strings to an easy to edit CSV format.

Definition at line 293 of file Localization.cs.

◆ GetLocalizedString()

static string Fungus.Localization.GetLocalizedString ( string  stringId)
static

Looks up the specified string in the localized strings table.

For this to work, a localization file and active language must have been set previously. Return null if the string is not found.

Definition at line 252 of file Localization.cs.

◆ GetStandardText()

virtual string Fungus.Localization.GetStandardText ( )
virtual

Returns all standard text for localizeable text in the scene using an easy to edit custom text format.

Definition at line 478 of file Localization.cs.

◆ Init()

virtual void Fungus.Localization.Init ( )
protectedvirtual

String subsitution can happen during the Start of another component, so we may need to call Init() from other methods.

Definition at line 87 of file Localization.cs.

◆ LevelWasLoaded()

virtual void Fungus.Localization.LevelWasLoaded ( )
protectedvirtual

Definition at line 58 of file Localization.cs.

◆ OnDisable()

virtual void Fungus.Localization.OnDisable ( )
protectedvirtual

Definition at line 73 of file Localization.cs.

◆ OnEnable()

virtual void Fungus.Localization.OnEnable ( )
protectedvirtual

Definition at line 68 of file Localization.cs.

◆ OnLevelWasLoaded()

virtual void Fungus.Localization.OnLevelWasLoaded ( int  level)
virtual

Definition at line 52 of file Localization.cs.

◆ PopulateTextProperty()

virtual bool Fungus.Localization.PopulateTextProperty ( string  stringId,
string  newText 
)
virtual

Populates the text property of a single scene object with a new text value.

Definition at line 455 of file Localization.cs.

◆ SetActiveLanguage()

virtual void Fungus.Localization.SetActiveLanguage ( string  languageCode,
bool  forceUpdateSceneText = false 
)
virtual

Scan a localization CSV file and copies the strings for the specified language code into the text properties of the appropriate scene objects.

Definition at line 360 of file Localization.cs.

◆ SetStandardText()

virtual void Fungus.Localization.SetStandardText ( string  textData)
virtual

Sets standard text on scene objects by parsing a text data file.

Definition at line 503 of file Localization.cs.

◆ Start()

virtual void Fungus.Localization.Start ( )
protectedvirtual

Definition at line 78 of file Localization.cs.

◆ SubstituteStrings()

virtual bool Fungus.Localization.SubstituteStrings ( StringBuilder  input)
virtual

Definition at line 551 of file Localization.cs.

Member Data Documentation

◆ activeLanguage

string Fungus.Localization.activeLanguage = ""
protected

Definition at line 31 of file Localization.cs.

◆ initialized

bool Fungus.Localization.initialized
protected

Definition at line 40 of file Localization.cs.

◆ localizationFile

TextAsset Fungus.Localization.localizationFile
protected

Definition at line 34 of file Localization.cs.

◆ localizeableObjects

Dictionary<string, ILocalizable> Fungus.Localization.localizeableObjects = new Dictionary<string, ILocalizable>()
protected

Definition at line 36 of file Localization.cs.

◆ localizedStrings

Dictionary<string, string> Fungus.Localization.localizedStrings = new Dictionary<string, string>()
staticprotected

Definition at line 42 of file Localization.cs.

◆ notificationText

string Fungus.Localization.notificationText = ""
protected

Definition at line 38 of file Localization.cs.

Property Documentation

◆ ActiveLanguage

virtual string Fungus.Localization.ActiveLanguage
get

Language to use at startup, usually defined by a two letter language code (e.g DE = German).

Definition at line 270 of file Localization.cs.

◆ LocalizationFile

virtual TextAsset Fungus.Localization.LocalizationFile
getset

CSV file containing localization data which can be easily edited in a spreadsheet tool.

Definition at line 275 of file Localization.cs.

◆ NotificationText

virtual string Fungus.Localization.NotificationText
getset

Stores any notification message from export / import methods.

Definition at line 280 of file Localization.cs.


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