Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Static Public Member Functions | Properties | List of all members
KSP.Localization.Localizer Class Reference

This class is used to format the strings for localization, it changes the tags with its corresponding value deffined in the cfg files and also it calls the LingoonaGrammar library when neccesary. It uses internally a singleton, but all its public methods are static. More...

Static Public Member Functions

static void AppendMissionTags (string lang)
 
static string Format (string template, params string[] list)
 See Lingoona Grammar documentation first. Format the template string with the given string list as local variables Any parameter of this method (either the template string or any element of the list) can be replaced by a tag deffined in a localization cfg More...
 
static string Format (string template, params System.Object[] list)
 
static string Format (string template)
 
static string GetLanguageIdFromFile ()
 Reads and return the language ID dependeing of the running platform. More...
 
static string GetStringByTag (string tag)
 Get the string stored for a tagname More...
 
static Localizer Init ()
 Should be called at the starting, before using this class but when the GameDatabase is already loaded. More...
 
static bool SwitchToLanguage (string lang)
 Switch the dictionary to another Language. Assets already Localized don't change, only the dictionary. More...
 
static void TranslateBranch (ConfigNode branchRoot)
 Translate a ConfigNode branch with branchRoot as root. Instance should be loaded. More...
 
static bool TryGetStringByTag (string tagName, out string value)
 

Properties

static string CurrentLanguage [get]
 The Current Language set in game. More...
 
static Localizer Instance [get, set]
 Singletone Instance for the class More...
 
static Dictionary< string, string > Tags [get]
 
static int TagsLength [get]
 

Detailed Description

This class is used to format the strings for localization, it changes the tags with its corresponding value deffined in the cfg files and also it calls the LingoonaGrammar library when neccesary. It uses internally a singleton, but all its public methods are static.

Member Function Documentation

static void KSP.Localization.Localizer.AppendMissionTags ( string  lang)
inlinestatic
static string KSP.Localization.Localizer.Format ( string  template,
params string[]  list 
)
inlinestatic

See Lingoona Grammar documentation first. Format the template string with the given string list as local variables Any parameter of this method (either the template string or any element of the list) can be replaced by a tag deffined in a localization cfg

Parameters
templateThis can be either a LingoonaGrammar template, a tag for a template, raw text or a tag for raw text
listThis list indicates the local variables for the LingoonaGrammar template, if a tag is provided, the value will be replaced by the tag automatically
Returns
The formatted string
static string KSP.Localization.Localizer.Format ( string  template,
params System.Object[]  list 
)
inlinestatic
static string KSP.Localization.Localizer.Format ( string  template)
inlinestatic
static string KSP.Localization.Localizer.GetLanguageIdFromFile ( )
inlinestatic

Reads and return the language ID dependeing of the running platform.

Returns
Current language ID.
static string KSP.Localization.Localizer.GetStringByTag ( string  tag)
inlinestatic

Get the string stored for a tagname

static Localizer KSP.Localization.Localizer.Init ( )
inlinestatic

Should be called at the starting, before using this class but when the GameDatabase is already loaded.

static bool KSP.Localization.Localizer.SwitchToLanguage ( string  lang)
inlinestatic

Switch the dictionary to another Language. Assets already Localized don't change, only the dictionary.

Parameters
langId of the new language.
Returns
True when successful
static void KSP.Localization.Localizer.TranslateBranch ( ConfigNode  branchRoot)
inlinestatic

Translate a ConfigNode branch with branchRoot as root. Instance should be loaded.

///

Parameters
branchRootNode root of the branch to be translated.
static bool KSP.Localization.Localizer.TryGetStringByTag ( string  tagName,
out string  value 
)
inlinestatic

Property Documentation

string KSP.Localization.Localizer.CurrentLanguage
staticget

The Current Language set in game.

Localizer KSP.Localization.Localizer.Instance
staticgetset

Singletone Instance for the class

Dictionary<string,string> KSP.Localization.Localizer.Tags
staticget
int KSP.Localization.Localizer.TagsLength
staticget

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