Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
KSP.UI.Language.LanguageDefinition Class Reference

Holds a lanugage for localisation: includes a dictionary (string->string) and a font. Can be saved and loaded from XML. More...

Public Member Functions

void AddTranslation (string input, string output)
 Adds a translation to the dictionary. More...
 
void Deserialize (string path, bool localPath=true)
 Loads language from specified xml file (path under GameData by default, else set localPath false for absolute path) More...
 
 LanguageDefinition ()
 
 LanguageDefinition (string langName, string fontName)
 Creates an empty language with given name and font. More...
 
 LanguageDefinition (string path, bool localPath=true)
 Loads language from specified path (path under GameData by default, else set localPath false for absolute path) More...
 
void MergeInto (LanguageDefinition parent)
 Merges this language into the specified parent language. Will only override entries/font if overwrite is true. More...
 
void RemoveTranslation (string input)
 Removes a translation from the dictionary. More...
 
void Serialize (string path, bool localPath=true)
 Serializes the language to the specified path (path under GameData by default, else set localPath false for absolute path) More...
 
void SerializeUntranslated (string path, bool localPath=true)
 Serializes the language's untranslated words to the specified path (path under GameData by default, else set localPath false for absolute path) More...
 
string TranslateWithFormat (string baseString, params object[] args)
 Constructs a translation from an input string and a set of arguments using string.Format NOTE: the number of arguments must match the {0}, {1}, etc in the translated form of the input. More...
 
string Translation (string input)
 Returns a translation of the input term (or the input term itself if no translation) Will store in untranslated if flag is set. More...
 

Public Attributes

bool overwrite = false
 DO NOT USE. For internal use only, but public so it's serializable. More...
 
List< DictionarySerializerHelpertranslations
 DO NOT USE. For internal use only, but public so it's serializable. More...
 

Protected Member Functions

string GetFullPath (string path)
 

Properties

string Font [get, set]
 The font the language uses. More...
 
string Name [get, set]
 The name of the language More...
 
bool StoreUntranslated [get, set]
 Do we store any translation calls that fail to find translations? More...
 

Detailed Description

Holds a lanugage for localisation: includes a dictionary (string->string) and a font. Can be saved and loaded from XML.

Constructor & Destructor Documentation

KSP.UI.Language.LanguageDefinition.LanguageDefinition ( )
inline
KSP.UI.Language.LanguageDefinition.LanguageDefinition ( string  langName,
string  fontName 
)
inline

Creates an empty language with given name and font.

Parameters
langNameName of the language
fontNameName of the font
KSP.UI.Language.LanguageDefinition.LanguageDefinition ( string  path,
bool  localPath = true 
)
inline

Loads language from specified path (path under GameData by default, else set localPath false for absolute path)

Parameters
pathpath to the XML to save
localPathDefaults true, if false use as absolute path

Member Function Documentation

void KSP.UI.Language.LanguageDefinition.AddTranslation ( string  input,
string  output 
)
inline

Adds a translation to the dictionary.

Parameters
input
output
void KSP.UI.Language.LanguageDefinition.Deserialize ( string  path,
bool  localPath = true 
)
inline

Loads language from specified xml file (path under GameData by default, else set localPath false for absolute path)

Parameters
pathpath to the XML file to load

///

Parameters
localPathDefaults true, if false use as absolute path

< get font

< reload from helper

< GC should automatically dispose of the other thing.

string KSP.UI.Language.LanguageDefinition.GetFullPath ( string  path)
inlineprotected
void KSP.UI.Language.LanguageDefinition.MergeInto ( LanguageDefinition  parent)
inline

Merges this language into the specified parent language. Will only override entries/font if overwrite is true.

Parameters
parent
void KSP.UI.Language.LanguageDefinition.RemoveTranslation ( string  input)
inline

Removes a translation from the dictionary.

Parameters
input
void KSP.UI.Language.LanguageDefinition.Serialize ( string  path,
bool  localPath = true 
)
inline

Serializes the language to the specified path (path under GameData by default, else set localPath false for absolute path)

Parameters
pathpath to the XML to save
localPathDefaults true, if false use as absolute path
void KSP.UI.Language.LanguageDefinition.SerializeUntranslated ( string  path,
bool  localPath = true 
)
inline

Serializes the language's untranslated words to the specified path (path under GameData by default, else set localPath false for absolute path)

Parameters
pathpath to the XML to save
localPathDefaults true, if false use as absolute path
string KSP.UI.Language.LanguageDefinition.TranslateWithFormat ( string  baseString,
params object[]  args 
)
inline

Constructs a translation from an input string and a set of arguments using string.Format NOTE: the number of arguments must match the {0}, {1}, etc in the translated form of the input.

Parameters
baseStringthe base string to be translated
argsthe arguments for string.Format
Returns
translated constructed string

< translate the arguments

string KSP.UI.Language.LanguageDefinition.Translation ( string  input)
inline

Returns a translation of the input term (or the input term itself if no translation) Will store in untranslated if flag is set.

Parameters
inputthe term to translate
Returns
translated form of input

< FIXME should we default to something else?

Member Data Documentation

bool KSP.UI.Language.LanguageDefinition.overwrite = false

DO NOT USE. For internal use only, but public so it's serializable.

List<DictionarySerializerHelper> KSP.UI.Language.LanguageDefinition.translations

DO NOT USE. For internal use only, but public so it's serializable.

Property Documentation

string KSP.UI.Language.LanguageDefinition.Font
getset

The font the language uses.

string KSP.UI.Language.LanguageDefinition.Name
getset

The name of the language

bool KSP.UI.Language.LanguageDefinition.StoreUntranslated
getset

Do we store any translation calls that fail to find translations?


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