35 #define g_L10n L10n::GetSingleton() 131 bool SaveLocale(
const std::string& localeCode)
const;
326 std::string
Translate(
const std::string& sourceString)
const;
340 std::string
TranslateWithContext(
const std::string& context,
const std::string& sourceString)
const;
358 std::string
TranslatePlural(
const std::string& singularSourceString,
const std::string& pluralSourceString,
int number)
const;
379 std::string
TranslatePluralWithContext(
const std::string& context,
const std::string& singularSourceString,
const std::string& pluralSourceString,
int number)
const;
393 std::string
TranslateLines(
const std::string& sourceString)
const;
411 UDate
ParseDateTime(
const std::string& dateTimeString,
const std::string& dateTimeFormat,
const Locale& locale)
const;
UDate ParseDateTime(const std::string &dateTimeString, const std::string &dateTimeFormat, const Locale &locale) const
Parses the date in the input string using the specified date format, and returns the parsed date as a...
Definition: L10n.cpp:350
~L10n()
Handles the descruction of L10n.
Definition: L10n.cpp:66
std::string GetLocaleScript(const std::string &locale) const
Returns the ISO-15924 abbreviation script code of the specified locale code.
Definition: L10n.cpp:290
bool ValidateLocale(const Locale &locale) const
Returns true if the locale is supported by both ICU and the game.
Definition: L10n.cpp:107
bool useLongStrings
Whether the game is using the special game locale with the longest strings of each translation (true)...
Definition: L10n.h:536
void LoadDictionaryForCurrentLocale()
Loads the translation files for the current locale.
Definition: L10n.cpp:467
Only time.
Definition: L10n.h:78
Both date and time.
Definition: L10n.h:76
Only date.
Definition: L10n.h:77
std::vector< Locale * > availableLocales
Vector with the locales that the game supports.
Definition: L10n.h:519
Locale currentLocale
Locale that the game is currently using.
Definition: L10n.h:508
bool currentLocaleIsOriginalGameLocale
Whether the game is using the default game locale (true), ‘en_US’, or not (false).
Definition: L10n.h:528
std::string Translate(const std::string &sourceString) const
Returns the translation of the specified string to the current locale.
Definition: L10n.cpp:296
DateFormat * CreateDateTimeInstance(const DateTimeType &type, const DateFormat::EStyle &style, const Locale &locale) const
Creates an ICU date formatted with the specified settings.
Definition: L10n.cpp:545
void LoadListOfAvailableLocales()
Determines the list of locales that the game supports.
Definition: L10n.cpp:498
bool UseLongStrings() const
Returns true if the current locale is the special “Long Strings” locale.
Definition: L10n.cpp:226
L10n()
Creates an instance of L10n.
Definition: L10n.cpp:45
bool SaveLocale(const std::string &localeCode) const
Saves the specified locale in the game configuration file.
Definition: L10n.cpp:80
std::string TranslateLines(const std::string &sourceString) const
Translates a text line by line to the current locale.
Definition: L10n.cpp:334
std::string GetLocaleBaseName(const std::string &locale) const
Returns the programmatic code of the entire locale without keywords.
Definition: L10n.cpp:278
DateTimeType
Types of dates.
Definition: L10n.h:75
std::vector< std::wstring > GetDictionariesForLocale(const std::string &locale) const
Returns an array of paths to files in the virtual filesystem that provide translations for the specif...
Definition: L10n.cpp:115
NONCOPYABLE(L10n)
Marks the L10n class as ‘noncopyable’.
Status ReloadChangedFile(const VfsPath &path)
Loads path into the dictionary if it is a translation file of the current locale. ...
Definition: L10n.cpp:427
std::wstring GetFallbackToAvailableDictLocale(const Locale &locale) const
Definition: L10n.cpp:134
std::vector< std::string > GetSupportedLocaleBaseNames() const
Returns an array of supported locale codes sorted alphabetically.
Definition: L10n.cpp:231
std::vector< std::string > GetAllLocales() const
Returns a vector of locale codes supported by ICU.
Definition: L10n.cpp:215
i64 Status
Error handling system.
Definition: status.h:171
Locale GetCurrentLocale() const
Returns the current locale.
Definition: L10n.cpp:75
std::string GetCurrentLocaleString() const
Returns the code of the current locale.
Definition: L10n.cpp:267
void ReadPoIntoDictionary(const std::string &poContent, tinygettext::Dictionary *dictionary) const
Loads the specified content of a PO file into the specified dictionary.
Definition: L10n.cpp:532
std::string TranslatePlural(const std::string &singularSourceString, const std::string &pluralSourceString, int number) const
Returns the translation of the specified string to the current locale based on the specified number...
Definition: L10n.cpp:312
std::vector< std::wstring > GetSupportedLocaleDisplayNames() const
Returns an array of supported locale names sorted alphabetically by locale code.
Definition: L10n.cpp:243
tinygettext::Dictionary * dictionary
Dictionary that contains the translations for the current locale and the matching English strings...
Definition: L10n.h:494
A simple dictionary class that mimics gettext() behaviour.
Definition: dictionary.hpp:34
std::string FormatMillisecondsIntoDateString(const UDate milliseconds, const std::string &formatString, bool useLocalTimezone) const
Returns the specified date using the specified date format.
Definition: L10n.cpp:378
Singleton for internationalization and localization.
Definition: L10n.h:42
std::string GetLocaleCountry(const std::string &locale) const
Returns the ISO-3166 country code of the specified locale code.
Definition: L10n.cpp:284
std::string FormatDecimalNumberIntoString(double number) const
Returns the specified floating-point number as a string, with the number formatted as a decimal numbe...
Definition: L10n.cpp:404
Definition: Singleton.h:34
VfsPath LocalizePath(const VfsPath &sourcePath) const
Returns the localized version of the specified path if there is one for the current locale...
Definition: L10n.cpp:418
void ReevaluateCurrentLocaleAndReload()
Determines the best, supported locale for the current user, makes it the current game locale and relo...
Definition: L10n.cpp:193
std::string GetLocaleLanguage(const std::string &locale) const
Returns the ISO-639 language code of the specified locale code.
Definition: L10n.cpp:272
std::string GetDictionaryLocale(const std::string &configLocaleString) const
Returns the code of the recommended locale for the current user that the game supports.
Definition: L10n.cpp:163
std::string TranslateWithContext(const std::string &context, const std::string &sourceString) const
Returns the translation of the specified string to the current locale in the specified context...
Definition: L10n.cpp:304
std::string LocalizeDateTime(const UDate dateTime, const DateTimeType &type, const DateFormat::EStyle &style) const
Returns the specified date using the specified date format.
Definition: L10n.cpp:363
std::string TranslatePluralWithContext(const std::string &context, const std::string &singularSourceString, const std::string &pluralSourceString, int number) const
Returns the translation of the specified string to the current locale in the specified context...
Definition: L10n.cpp:323