18 #ifndef INCLUDED_JSINTERFACE_L10N 19 #define INCLUDED_JSINTERFACE_L10N std::wstring Translate(ScriptInterface::CxPrivate *pCxPrivate, const std::wstring &sourceString)
Returns the translation of the specified string to the current locale.
Definition: JSInterface_L10n.cpp:27
std::wstring TranslateWithContext(ScriptInterface::CxPrivate *pCxPrivate, const std::string &context, const std::wstring &sourceString)
Returns the translation of the specified string to the current locale in the specified context...
Definition: JSInterface_L10n.cpp:33
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
Definition: code_annotation.h:38
std::vector< std::string > GetAllLocales(ScriptInterface::CxPrivate *pCxPrivate)
Returns an array of locale codes supported by ICU.
Definition: JSInterface_L10n.cpp:109
std::string GetDictionaryLocale(ScriptInterface::CxPrivate *pCxPrivate, const std::string &configLocale)
Returns the code of the recommended locale for the current user that the game supports.
Definition: JSInterface_L10n.cpp:114
std::wstring FormatDecimalNumberIntoString(ScriptInterface::CxPrivate *pCxPrivate, double number)
Returns the specified floating-point number as a string, with the number formatted as a decimal numbe...
Definition: JSInterface_L10n.cpp:84
std::wstring GetFallbackToAvailableDictLocale(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Definition: JSInterface_L10n.cpp:66
std::string GetLocaleCountry(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Returns the ISO-3166 country code of the specified locale code.
Definition: JSInterface_L10n.cpp:134
void RegisterScriptFunctions(ScriptInterface &ScriptInterface)
Registers the functions of the JavaScript interface for internationalization and localization into th...
Definition: JSInterface_L10n.cpp:160
std::vector< std::string > GetSupportedLocaleBaseNames(ScriptInterface::CxPrivate *pCxPrivate)
Returns an array of supported locale codes sorted alphabetically.
Definition: JSInterface_L10n.cpp:89
std::string GetLocaleScript(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Returns the ISO-15924 abbreviation script code of the specified locale code.
Definition: JSInterface_L10n.cpp:139
void ReevaluateCurrentLocaleAndReload(ScriptInterface::CxPrivate *pCxPrivate)
Determines the best, supported locale for the current user, makes it the current game locale and relo...
Definition: JSInterface_L10n.cpp:154
std::wstring TranslatePlural(ScriptInterface::CxPrivate *pCxPrivate, const std::wstring &singularSourceString, const std::wstring &pluralSourceString, int number)
Returns the translation of the specified string to the current locale based on the specified number...
Definition: JSInterface_L10n.cpp:39
std::wstring TranslateLines(ScriptInterface::CxPrivate *pCxPrivate, const std::wstring &sourceString)
Translates a text line by line to the current locale.
Definition: JSInterface_L10n.cpp:51
std::wstring FormatMillisecondsIntoDateStringLocal(ScriptInterface::CxPrivate *pCxPrivate, UDate milliseconds, const std::wstring &formatString)
Returns the specified date converted to the local timezone using the specified date format...
Definition: JSInterface_L10n.cpp:72
std::string GetCurrentLocale(ScriptInterface::CxPrivate *pCxPrivate)
Returns the code of the current locale.
Definition: JSInterface_L10n.cpp:99
bool ValidateLocale(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Returns true if the locale is supported by both ICU and the game.
Definition: JSInterface_L10n.cpp:144
std::wstring TranslatePluralWithContext(ScriptInterface::CxPrivate *pCxPrivate, const std::string &context, const std::wstring &singularSourceString, const std::wstring &pluralSourceString, int number)
Returns the translation of the specified string to the current locale in the specified context...
Definition: JSInterface_L10n.cpp:45
std::vector< std::wstring > GetSupportedLocaleDisplayNames(ScriptInterface::CxPrivate *pCxPrivate)
Returns an array of supported locale names sorted alphabetically by locale code.
Definition: JSInterface_L10n.cpp:94
Definition: ScriptInterface.h:99
bool SaveLocale(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Saves the specified locale in the game configuration file.
Definition: JSInterface_L10n.cpp:149
std::string GetLocaleLanguage(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Returns the ISO-639 language code of the specified locale code.
Definition: JSInterface_L10n.cpp:124
Abstraction around a SpiderMonkey JSContext.
Definition: ScriptInterface.h:71
std::vector< std::wstring > GetDictionariesForLocale(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Returns an array of paths to files in the virtual filesystem that provide translations for the specif...
Definition: JSInterface_L10n.cpp:119
bool UseLongStrings(ScriptInterface::CxPrivate *pCxPrivate)
Returns true if the current locale is the special “Long Strings” locale.
Definition: JSInterface_L10n.cpp:104
std::vector< std::wstring > TranslateArray(ScriptInterface::CxPrivate *pCxPrivate, const std::vector< std::wstring > &sourceArray)
Translate each of the strings of a JavaScript array to the current locale.
Definition: JSInterface_L10n.cpp:57
Namespace for the functions of the JavaScript interface for internationalization and localization...
Definition: JSInterface_L10n.h:33
std::string GetLocaleBaseName(ScriptInterface::CxPrivate *pCxPrivate, const std::string &locale)
Returns the programmatic code of the entire locale without keywords.
Definition: JSInterface_L10n.cpp:129
std::wstring FormatMillisecondsIntoDateStringGMT(ScriptInterface::CxPrivate *pCxPrivate, UDate milliseconds, const std::wstring &formatString)
Returns the specified date in GMT using the specified date format.
Definition: JSInterface_L10n.cpp:78