Class Localizer
Inheritance
System.Object
Localizer
Assembly: Eco.Shared.dll
Syntax
public static class Localizer : Object
Fields
LocDumpFileName
Declaration
public static readonly string LocDumpFileName
Field Value
| Type |
Description |
| System.String |
|
LogMissingStrings
Declaration
public static Func<bool> LogMissingStrings
Field Value
| Type |
Description |
| System.Func<System.Boolean> |
|
LogMissingStringsStack
Declaration
public static Func<bool> LogMissingStringsStack
Field Value
| Type |
Description |
| System.Func<System.Boolean> |
|
MissedString
Declaration
public static Action<MissingString> MissedString
Field Value
NormalizedLanguageOptions
Declaration
public static readonly string[] NormalizedLanguageOptions
Field Value
| Type |
Description |
| System.String[] |
|
OnLanguageChanged
Declaration
public static SubscribableEvent<Action> OnLanguageChanged
Field Value
QaOnlyLanguageOptions
Declaration
public static readonly string[] QaOnlyLanguageOptions
Field Value
| Type |
Description |
| System.String[] |
|
TrackMissingStrings
Declaration
public static Func<bool> TrackMissingStrings
Field Value
| Type |
Description |
| System.Func<System.Boolean> |
|
Properties
AllEnglishStrings
Declaration
public static string[] AllEnglishStrings { get; }
Property Value
| Type |
Description |
| System.String[] |
|
AllowGibberishifyFailed
Declaration
public static bool AllowGibberishifyFailed { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
ChinaLockedMode
Declaration
public static bool ChinaLockedMode { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
CurrentLanguage
Declaration
public static SupportedLanguage CurrentLanguage { get; }
Property Value
DebugTranslations
Declaration
public static bool DebugTranslations { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Initialized
Declaration
public static bool Initialized { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Declaration
public static HashSet<string> InvalidFormatStrings { get; }
Property Value
| Type |
Description |
| System.Collections.Generic.HashSet<System.String> |
|
IsChinaLauncher
Declaration
public static bool IsChinaLauncher { get; set; }
Property Value
| Type |
Description |
| System.Boolean |
|
MissingStrings
Declaration
public static List<MissingString> MissingStrings { get; }
Property Value
StringsLoaded
Declaration
public static bool StringsLoaded { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Methods
A(LocString, Boolean)
Adds a/an based on the first letter of the given string, the given word shouldn't include tags.
Declaration
public static LocString A(LocString word, bool capitalized = false)
Parameters
| Type |
Name |
Description |
| LocString |
word |
|
| System.Boolean |
capitalized |
|
Returns
A_strip(LocString)
Adds a/an based on the first letter of the given string, safely excuted and strips tags if any.
Declaration
public static LocString A_strip(LocString word)
Parameters
Returns
AddIndefiniteArticle(LocString)
Adds "a" or "an" to the phrase depending on some common English rules E.g a user, an item
Declaration
public static string AddIndefiniteArticle(LocString text)
Parameters
Returns
| Type |
Description |
| System.String |
|
ClearMissingLocalizerStrings()
Declaration
public static void ClearMissingLocalizerStrings()
Convert(String, Boolean)
Declaration
public static string Convert(string s, bool toFile)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Boolean |
toFile |
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static LocString Do(FormattableString format)
Parameters
| Type |
Name |
Description |
| System.FormattableString |
format |
|
Returns
DoLineList(LocString[])
Append a bunch of locstring together into a new locstring
Declaration
public static LocString DoLineList(params LocString[] strings)
Parameters
Returns
Accepts a variable number of formattable strings, localzing them as lines and appending them.
Declaration
public static LocString DoLineListLoc(params FormattableString[] formats)
Parameters
| Type |
Name |
Description |
| System.FormattableString[] |
formats |
|
Returns
DoLineListLocStr(String[])
Accepts a variable number of formattable strings, localzing them as lines and appending them.
Declaration
public static LocString DoLineListLocStr(params string[] lines)
Parameters
| Type |
Name |
Description |
| System.String[] |
lines |
|
Returns
DoStr(String)
Declaration
public static LocString DoStr(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
DumpMissingLocalizerStrings(String)
Declaration
public static void DumpMissingLocalizerStrings(string dir = null)
Parameters
| Type |
Name |
Description |
| System.String |
dir |
|
Declaration
public static LocString Format(string format, params object[] args)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| System.Object[] |
args |
|
Returns
GetIndefiniteArticle(String)
Returns "a" or "an" depending on some common English rules
Declaration
public static string GetIndefiniteArticle(string text)
Parameters
| Type |
Name |
Description |
| System.String |
text |
|
Returns
| Type |
Description |
| System.String |
|
GetLocalizedStringSet(String)
Declaration
public static string[] GetLocalizedStringSet(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
| Type |
Description |
| System.String[] |
|
GetTranslationCompleteness(SupportedLanguage)
Returns the fraction of active (non-obsolete) English strings that have a non-empty, non-obsolete translation
in lang. 0 = nothing translated, 1 = fully translated.
English and Gibberish always return 1 (English is the source; Gibberish is auto-generated). If stats haven't
been computed yet (e.g. early init or the legacy CSV path) returns 1 to avoid false-alarm UI indicators.
Declaration
public static float GetTranslationCompleteness(SupportedLanguage lang)
Parameters
Returns
| Type |
Description |
| System.Single |
|
InitCalendarsForLocales()
Declaration
public static void InitCalendarsForLocales()
InitializeLanguage(SupportedLanguage)
Sets initial localizer language and invoke post initialize actions
Declaration
public static void InitializeLanguage(SupportedLanguage language)
Parameters
IsNormalizedLanguage(SupportedLanguage)
Declaration
public static bool IsNormalizedLanguage(SupportedLanguage language)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
IsQaOnlyLanguage(SupportedLanguage)
Declaration
public static bool IsQaOnlyLanguage(SupportedLanguage language)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
LoadStrings()
Declaration
public static void LoadStrings()
LocalizeString(String)
Declaration
public static string LocalizeString(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
| Type |
Description |
| System.String |
|
LocalizeString(String, SupportedLanguage)
Declaration
public static string LocalizeString(string s, SupportedLanguage language)
Parameters
Returns
| Type |
Description |
| System.String |
|
Declaration
public static LocString NL(FormattableString format)
Parameters
| Type |
Name |
Description |
| System.FormattableString |
format |
|
Returns
NLS(String)
Declaration
public static LocString NLS(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
Declaration
public static LocString NotLocalized(FormattableString format)
Parameters
| Type |
Name |
Description |
| System.FormattableString |
format |
|
Returns
NotLocalizedStr(String)
Declaration
public static LocString NotLocalizedStr(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
OnInitialized(Action)
Call action after initialization or instantly when already initialized
Declaration
public static void OnInitialized(Action action)
Parameters
| Type |
Name |
Description |
| System.Action |
action |
|
Ordinal(Int32)
Declaration
public static LocString Ordinal(int num)
Parameters
| Type |
Name |
Description |
| System.Int32 |
num |
|
Returns
Plural(String, Int32)
Declaration
public static LocString Plural(string s, int num)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Int32 |
num |
|
Returns
PluralLocStr(String, String, Int32)
Declaration
public static LocString PluralLocStr(string s, string plur, int num)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.String |
plur |
|
| System.Int32 |
num |
|
Returns
PluralNoNum(String, Int32)
Declaration
public static LocString PluralNoNum(string s, int num = 2)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Int32 |
num |
|
Returns
PluralNoNum(String, Single)
Pluralize when a float is involved. IE, 1.0 should be 'not plural', 1.1 should be 'plural
Declaration
public static LocString PluralNoNum(string s, float num)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Single |
num |
|
Returns
PrependLocStr(String, LocString)
Localize a string as a prepend, then display the rest after a ':'. Ex: PrependLocStr("Room", room.Info) will return Localized "Room: {room.Info}"
Declaration
public static LocString PrependLocStr(string toLocalize, LocString rest)
Parameters
| Type |
Name |
Description |
| System.String |
toLocalize |
|
| LocString |
rest |
|
Returns
SetDebugTranslations(Boolean)
Declaration
public static void SetDebugTranslations(bool value)
Parameters
| Type |
Name |
Description |
| System.Boolean |
value |
|
StyledPlural(String, Int32)
Declaration
public static LocString StyledPlural(string s, int num)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Int32 |
num |
|
Returns
StyledPlural(String, Single)
Declaration
public static LocString StyledPlural(string s, float num)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Single |
num |
|
Returns
StyledPluralUnsigned(String, Single)
Styles originally negative numbers in red (negative style) while removing the negative sign from the output.
Declaration
public static LocString StyledPluralUnsigned(string s, float num)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
| System.Single |
num |
|
Returns
Tag(String)
Declaration
public static string Tag(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
| Type |
Description |
| System.String |
|
TranslationExists(String[], SupportedLanguage)
Declaration
public static bool TranslationExists(string[] set, SupportedLanguage language)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
TrySetLanguage(SupportedLanguage)
Declaration
public static void TrySetLanguage(SupportedLanguage language)
Parameters