Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
L10n.h
Go to the documentation of this file.
1/* Copyright (C) 2025 Wildfire Games.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef INCLUDED_L10N
24#define INCLUDED_L10N
25
27#include "lib/status.h"
28#include "ps/Singleton.h"
29
30#include <memory>
31#include <string>
32#include <unicode/datefmt.h>
33#include <unicode/locid.h>
34#include <unicode/utypes.h>
35#include <vector>
36
37namespace tinygettext
38{
39class Dictionary;
40}
41
42#define g_L10n L10n::GetSingleton()
43
44/**
45 * %Singleton for internationalization and localization.
46 *
47 * @sa https://gitea.wildfiregames.com/0ad/0ad/wiki/Internationalization_and_Localization
48 */
49class L10n : public Singleton<L10n>
50{
51public:
52 /**
53 * Creates an instance of L10n.
54 *
55 * L10n is a singleton. Use Instance() instead of creating you own instances
56 * of L10n.
57 */
58 L10n();
59
60 /**
61 * Handles the destruction of L10n.
62 *
63 * Never destroy the L10n singleton manually. It must run as long as the
64 * game runs, and it is destroyed automatically when you quit the game.
65 */
66 ~L10n();
67
68 /**
69 * Types of dates.
70 *
71 * @sa LocalizeDateTime()
72 */
74 {
75 DateTime, ///< Both date and time.
76 Date, ///< Only date.
77 Time ///< Only time.
78 };
79
80 /**
81 * Returns the current locale.
82 *
83 * @sa GetCurrentLocaleString()
84 * @sa GetSupportedLocaleBaseNames()
85 * @sa GetAllLocales()
86 * @sa ReevaluateCurrentLocaleAndReload()
87 */
88 const icu::Locale& GetCurrentLocale() const;
89
90 /**
91 * Returns the code of the current locale.
92 *
93 * A locale code is a string such as "de" or "pt_BR".
94 *
95 * @sa GetCurrentLocale()
96 * @sa GetSupportedLocaleBaseNames()
97 * @sa GetAllLocales()
98 * @sa ReevaluateCurrentLocaleAndReload()
99 */
100 std::string GetCurrentLocaleString() const;
101
102 /**
103 * Returns a vector of locale codes supported by ICU.
104 *
105 * A locale code is a string such as "de" or "pt_BR".
106 *
107 * @return Vector of supported locale codes.
108 *
109 * @sa GetSupportedLocaleBaseNames()
110 * @sa GetCurrentLocale()
111 *
112 * @sa http://www.icu-project.org/apiref/icu4c/classicu_1_1Locale.html#a073d70df8c9c8d119c0d42d70de24137
113 */
114 std::vector<std::string> GetAllLocales() const;
115
116 /**
117 * Saves the specified locale in the game configuration file.
118 *
119 * The next time that the game starts, the game uses the locale in the
120 * configuration file if there are translation files available for it.
121 *
122 * SaveLocale() checks the validity of the specified locale with
123 * ValidateLocale(). If the specified locale is not valid, SaveLocale()
124 * returns @c false and does not save the locale to the configuration file.
125 *
126 * @param localeCode Locale to save to the configuration file.
127 * @return Whether the specified locale is valid (@c true) or not
128 * (@c false).
129 */
130 bool SaveLocale(const std::string& localeCode) const;
131 ///@overload SaveLocale
132 bool SaveLocale(const icu::Locale& locale) const;
133
134 /**
135 * Returns an array of supported locale codes sorted alphabetically.
136 *
137 * A locale code is a string such as "de" or "pt_BR".
138 *
139 * If yours is a development copy (the 'config/dev.cfg' file is found in the
140 * virtual filesystem), the output array may include the special "long"
141 * locale code.
142 *
143 * @return Array of supported locale codes.
144 *
145 * @sa GetSupportedLocaleDisplayNames()
146 * @sa GetAllLocales()
147 * @sa GetCurrentLocale()
148 *
149 * @sa https://gitea.wildfiregames.com/0ad/0ad/wiki/Implementation_of_Internationalization_and_Localization#LongStringsLocale
150 */
151 std::vector<std::string> GetSupportedLocaleBaseNames() const;
152
153 /**
154 * Returns an array of supported locale names sorted alphabetically by
155 * locale code.
156 *
157 * A locale code is a string such as "de" or "pt_BR".
158 *
159 * If yours is a development copy (the 'config/dev.cfg' file is found in the
160 * virtual filesystem), the output array may include the special "Long
161 * Strings" locale name.
162 *
163 * @return Array of supported locale codes.
164 *
165 * @sa GetSupportedLocaleBaseNames()
166 *
167 * @sa https://gitea.wildfiregames.com/0ad/0ad/wiki/Implementation_of_Internationalization_and_Localization#LongStringsLocale
168 */
169 std::vector<std::wstring> GetSupportedLocaleDisplayNames() const;
170
171 /**
172 * Returns the ISO-639 language code of the specified locale code.
173 *
174 * For example, if you specify the 'en_US' locate, it returns 'en'.
175 *
176 * @param locale Locale code.
177 * @return Language code.
178 *
179 * @sa http://www.icu-project.org/apiref/icu4c/classicu_1_1Locale.html#af36d821adced72a870d921ebadd0ca93
180 */
181 std::string GetLocaleLanguage(const std::string& locale) const;
182
183 /**
184 * Returns the programmatic code of the entire locale without keywords.
185 *
186 * @param locale Locale code.
187 * @return Locale code without keywords.
188 *
189 * @sa http://www.icu-project.org/apiref/icu4c/classicu_1_1Locale.html#a4c1acbbdf95dc15599db5f322fa4c4d0
190 */
191 std::string GetLocaleBaseName(const std::string& locale) const;
192
193 /**
194 * Returns the ISO-3166 country code of the specified locale code.
195 *
196 * For example, if you specify the 'en_US' locate, it returns 'US'.
197 *
198 * @param locale Locale code.
199 * @return Country code.
200 *
201 * @sa http://www.icu-project.org/apiref/icu4c/classicu_1_1Locale.html#ae3f1fc415c00d4f0ab33288ceadccbf9
202 */
203 std::string GetLocaleCountry(const std::string& locale) const;
204
205 /**
206 * Returns the ISO-15924 abbreviation script code of the specified locale code.
207 *
208 * @param locale Locale code.
209 * @return Script code.
210 *
211 * @sa http://www.icu-project.org/apiref/icu4c/classicu_1_1Locale.html#a5e0145a339d30794178a1412dcc55abe
212 */
213 std::string GetLocaleScript(const std::string& locale) const;
214
215 /**
216 * Returns an array of paths to files in the virtual filesystem that provide
217 * translations for the specified locale code.
218 *
219 * @param locale Locale code.
220 * @return Array of paths to files in the virtual filesystem that provide
221 * translations for @p locale.
222 */
223 std::vector<std::wstring> GetDictionariesForLocale(const std::string& locale) const;
224
225 std::wstring GetFallbackToAvailableDictLocale(const icu::Locale& locale) const;
226
227 std::wstring GetFallbackToAvailableDictLocale(const std::string& locale) const;
228
229 /**
230 * Returns the code of the recommended locale for the current user that the
231 * game supports.
232 *
233 * "That the game supports" means both that a translation file is available
234 * for that locale and that the locale code is either supported by ICU or
235 * the special "long" locale code.
236 *
237 * The mechanism to select a recommended locale follows this logic:
238 * 1. First see if the game supports the specified locale,\n
239 * @p configLocale.
240 * 2. Otherwise, check the system locale and see if the game supports\n
241 * that locale.
242 * 3. Else, return the default locale, 'en_US'.
243 *
244 * @param configLocaleString Locale to check for support first. Pass an
245 * empty string to check the system locale directly.
246 * @return Code of a locale that the game supports.
247 *
248 * @sa https://gitea.wildfiregames.com/0ad/0ad/wiki/Implementation_of_Internationalization_and_Localization#LongStringsLocale
249 */
250 std::string GetDictionaryLocale(const std::string& configLocaleString) const;
251
252 /**
253 * Saves an instance of the recommended locale for the current user that the
254 * game supports in the specified variable.
255 *
256 * "That the game supports" means both that a translation file is available
257 * for that locale and that the locale code is either supported by ICU or
258 * the special "long" locale code.
259 *
260 * The mechanism to select a recommended locale follows this logic:
261 * 1. First see if the game supports the specified locale,\n
262 * @p configLocale.
263 * 2. Otherwise, check the system locale and see if the game supports\n
264 * that locale.
265 * 3. Else, return the default locale, 'en_US'.
266 *
267 * @param configLocaleString Locale to check for support first. Pass an
268 * empty string to check the system locale directly.
269 * @param outLocale The recommended locale.
270 *
271 * @sa https://gitea.wildfiregames.com/0ad/0ad/wiki/Implementation_of_Internationalization_and_Localization#LongStringsLocale
272 */
273 void GetDictionaryLocale(const std::string& configLocaleString, icu::Locale& outLocale) const;
274
275 /**
276 * Determines the best, supported locale for the current user, makes it the
277 * current game locale and reloads the translations dictionary with
278 * translations for that locale.
279 *
280 * To determine the best locale, ReevaluateCurrentLocaleAndReload():
281 * 1. Checks the user game configuration.
282 * 2. If the locale is not defined there, it checks the system locale.
283 * 3. If none of those locales are supported by the game, the default\n
284 * locale, 'en_US', is used.
285 *
286 * @sa GetCurrentLocale()
287 */
289
290 /**
291 * Returns @c true if the locale is supported by both ICU and the game. It
292 * returns @c false otherwise.
293 *
294 * It returns @c true if both of these conditions are true:
295 * 1. ICU has resources for that locale (which also ensures it's a valid\n
296 * locale string).
297 * 2. Either a dictionary for language_country or for language is\n
298 * available.
299 *
300 * @param locale Locale to check.
301 * @return Whether @p locale is supported by both ICU and the game (@c true)
302 * or not (@c false).
303 */
304 bool ValidateLocale(const icu::Locale& locale) const;
305 ///@overload ValidateLocale
306 bool ValidateLocale(const std::string& localeCode) const;
307
308 /**
309 * Returns the translation of the specified string to the
310 * @link L10n::GetCurrentLocale() current locale@endlink.
311 *
312 * @param sourceString String to translate to the current locale.
313 * @return Translation of @p sourceString to the current locale, or
314 * @p sourceString if there is no translation available.
315 */
316 std::string Translate(const std::string& sourceString) const;
317
318 /**
319 * Returns the translation of the specified string to the
320 * @link L10n::GetCurrentLocale() current locale@endlink in the specified
321 * context.
322 *
323 * @param context Context where the string is used. See
324 * http://www.gnu.org/software/gettext/manual/html_node/Contexts.html
325 * @param sourceString String to translate to the current locale.
326 * @return Translation of @p sourceString to the current locale in the
327 * specified @p context, or @p sourceString if there is no
328 * translation available.
329 */
330 std::string TranslateWithContext(const std::string& context, const std::string& sourceString) const;
331
332 /**
333 * Returns the translation of the specified string to the
334 * @link L10n::GetCurrentLocale() current locale@endlink based on the
335 * specified number.
336 *
337 * @param singularSourceString String to translate to the current locale,
338 * in English' singular form.
339 * @param pluralSourceString String to translate to the current locale, in
340 * English' plural form.
341 * @param number Number that determines the required form of the translation
342 * (or the English string if no translation is available).
343 * @return Translation of the source string to the current locale for the
344 * specified @p number, or either @p singularSourceString (if
345 * @p number is 1) or @p pluralSourceString (if @p number is not 1)
346 * if there is no translation available.
347 */
348 std::string TranslatePlural(const std::string& singularSourceString, const std::string& pluralSourceString, int number) const;
349
350 /**
351 * Returns the translation of the specified string to the
352 * @link L10n::GetCurrentLocale() current locale@endlink in the specified
353 * context, based on the specified number.
354 *
355 * @param context Context where the string is used. See
356 * http://www.gnu.org/software/gettext/manual/html_node/Contexts.html
357 * @param singularSourceString String to translate to the current locale,
358 * in English' singular form.
359 * @param pluralSourceString String to translate to the current locale, in
360 * English' plural form.
361 * @param number Number that determines the required form of the translation
362 * (or the English string if no translation is available). *
363 * @return Translation of the source string to the current locale in the
364 * specified @p context and for the specified @p number, or either
365 * @p singularSourceString (if @p number is 1) or
366 * @p pluralSourceString (if @p number is not 1) if there is no
367 * translation available.
368 */
369 std::string TranslatePluralWithContext(const std::string& context, const std::string& singularSourceString, const std::string& pluralSourceString, int number) const;
370
371 /**
372 * Translates a text line by line to the
373 * @link L10n::GetCurrentLocale() current locale@endlink.
374 *
375 * TranslateLines() is helpful when you need to translate a plain text file
376 * after you load it.
377 *
378 * @param sourceString Text to translate to the current locale.
379 * @return Line by line translation of @p sourceString to the current
380 * locale. Some of the lines in the returned text may be in English
381 * because there was not translation available for them.
382 */
383 std::string TranslateLines(const std::string& sourceString) const;
384
385 /**
386 * Parses the date in the input string using the specified date format, and
387 * returns the parsed date as a UNIX timestamp in milliseconds (not
388 * seconds).
389 *
390 * @param dateTimeString String containing the date to parse.
391 * @param dateTimeFormat Date format string to parse the input date, defined
392 * using ICU date formatting symbols.
393 * @param locale Locale to use when parsing the input date.
394 * @return Specified date as a UNIX timestamp in milliseconds (not seconds).
395 *
396 * @sa GetCurrentLocale()
397 *
398 * @sa http://en.wikipedia.org/wiki/Unix_time
399 * @sa https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table
400 */
401 UDate ParseDateTime(const std::string& dateTimeString, const std::string& dateTimeFormat, const icu::Locale& locale) const;
402
403 /**
404 * Returns the specified date using the specified date format.
405 *
406 * @param dateTime Date specified as a UNIX timestamp in milliseconds
407 * (not seconds).
408 * @param type Whether the formatted date must show both the date and the
409 * time, only the date or only the time.
410 * @param style ICU style for the formatted date.
411 * @return String containing the specified date with the specified date
412 * format.
413 *
414 * @sa http://en.wikipedia.org/wiki/Unix_time
415 * @sa http://icu-project.org/apiref/icu4c521/classicu_1_1DateFormat.html
416 */
417 std::string LocalizeDateTime(const UDate dateTime, const DateTimeType& type, const icu::DateFormat::EStyle& style) const;
418
419 /**
420 * Returns the specified date using the specified date format.
421 *
422 * @param milliseconds Date specified as a UNIX timestamp in milliseconds
423 * (not seconds).
424 * @param formatString Date format string defined using ICU date formatting
425 * symbols. Usually, you internationalize the format string and
426 * get it translated before you pass it to
427 * FormatMillisecondsIntoDateString().
428 * @param useLocalTimezone Boolean useful for durations
429 * @return String containing the specified date with the specified date
430 * format.
431 *
432 * @sa http://en.wikipedia.org/wiki/Unix_time
433 * @sa https://sites.google.com/site/icuprojectuserguide/formatparse/datetime?pli=1#TOC-Date-Field-Symbol-Table
434 */
435 std::string FormatMillisecondsIntoDateString(const UDate milliseconds, const std::string& formatString, bool useLocalTimezone) const;
436
437 /**
438 * Returns the specified floating-point number as a string, with the number
439 * formatted as a decimal number using the
440 * @link L10n::GetCurrentLocale() current locale@endlink.
441 *
442 * @param number Number to format.
443 * @return Decimal number formatted using the current locale.
444 */
445 std::string FormatDecimalNumberIntoString(double number) const;
446
447 /**
448 * Returns the localized version of the specified path if there is one for
449 * the @link L10n::GetCurrentLocale() current locale@endlink.
450 *
451 * If there is no localized version of the specified path, it returns the
452 * specified path.
453 *
454 * For example, if the code of the current locale is 'de_DE', LocalizePath()
455 * splits the input path into folder path and file name, and checks whether
456 * the '<folder>/l10n/de/<file>' file exists. If it does, it returns that
457 * path. Otherwise, it returns the input path, verbatim.
458 *
459 * This function is used for file localization (for example, image
460 * localization).
461 *
462 * @param sourcePath %Path to localize.
463 * @return Localized path if it exists, @c sourcePath otherwise.
464 *
465 * @sa https://gitea.wildfiregames.com/0ad/0ad/wiki/Localization#LocalizingImages
466 */
467 VfsPath LocalizePath(const VfsPath& sourcePath) const;
468
469 /**
470 * Loads @p path into the dictionary if it is a translation file of the
471 * @link L10n::GetCurrentLocale() current locale@endlink.
472 */
473 Status ReloadChangedFile(const VfsPath& path);
474
475private:
476 /**
477 * Dictionary that contains the translations for the
478 * @link L10n::GetCurrentLocale() current locale@endlink and the matching
479 * English strings, including contexts and plural forms.
480 *
481 * @sa LoadDictionaryForCurrentLocale()
482 */
483 std::unique_ptr<tinygettext::Dictionary> m_Dictionary;
484
485 /**
486 * Locale that the game is currently using.
487 *
488 * To get the current locale, use its getter: GetCurrentLocale(). You can
489 * also use GetCurrentLocaleString() to get the locale code of the current
490 * locale.
491 *
492 * To change the value of this variable:
493 * 1. Save a new locale to the game configuration file with SaveLocale().
494 * 2. Reload the translation dictionary with\n
495 * ReevaluateCurrentLocaleAndReload().
496 */
497 icu::Locale m_CurrentLocale;
498
499 /**
500 * Vector with the locales that the game supports.
501 *
502 * The list of available locales is calculated when the game starts. Call
503 * LoadListOfAvailableLocales() to refresh the list.
504 *
505 * @sa GetSupportedLocaleBaseNames()
506 * @sa GetSupportedLocaleDisplayNames()
507 */
508 std::vector<icu::Locale> m_AvailableLocales;
509
510 /**
511 * Whether the game is using the default game locale (@c true), 'en_US', or
512 * not (@c false).
513 *
514 * This variable is used in the L10n implementation for performance reasons.
515 * Many localization steps can be skipped when this variable is @c true.
516 */
518
519 /**
520 * Loads the translation files for the
521 * @link L10n::GetCurrentLocale() current locale@endlink.
522 *
523 * This method loads every file in the 'l10n' folder of the game virtual
524 * filesystem that is prefixed with the code of the current locale followed
525 * by a dot.
526 *
527 * For example, if the code of the current locale code is 'de',
528 * LoadDictionaryForCurrentLocale() loads the 'l10n/de.engine.po' and
529 * 'l10n/de.public.po' translation files.
530 *
531 * @sa dictionary
532 * @sa ReadPoIntoDictionary()
533 */
535};
536
537#endif // INCLUDED_L10N
Singleton for internationalization and localization.
Definition: L10n.h:50
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:270
UDate ParseDateTime(const std::string &dateTimeString, const std::string &dateTimeFormat, const icu::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:441
std::string LocalizeDateTime(const UDate dateTime, const DateTimeType &type, const icu::DateFormat::EStyle &style) const
Returns the specified date using the specified date format.
Definition: L10n.cpp:451
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:493
L10n()
Creates an instance of L10n.
Definition: L10n.cpp:158
std::string Translate(const std::string &sourceString) const
Returns the translation of the specified string to the current locale.
Definition: L10n.cpp:387
std::string GetLocaleLanguage(const std::string &locale) const
Returns the ISO-639 language code of the specified locale code.
Definition: L10n.cpp:363
icu::Locale m_CurrentLocale
Locale that the game is currently using.
Definition: L10n.h:497
DateTimeType
Types of dates.
Definition: L10n.h:74
@ Date
Only date.
Definition: L10n.h:76
@ DateTime
Both date and time.
Definition: L10n.h:75
@ Time
Only time.
Definition: L10n.h:77
std::string GetLocaleScript(const std::string &locale) const
Returns the ISO-15924 abbreviation script code of the specified locale code.
Definition: L10n.cpp:381
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:403
std::vector< icu::Locale > m_AvailableLocales
Vector with the locales that the game supports.
Definition: L10n.h:508
std::string TranslateLines(const std::string &sourceString) const
Translates a text line by line to the current locale.
Definition: L10n.cpp:425
bool SaveLocale(const std::string &localeCode) const
Saves the specified locale in the game configuration file.
Definition: L10n.cpp:188
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:218
const icu::Locale & GetCurrentLocale() const
Returns the current locale.
Definition: L10n.cpp:183
std::string GetCurrentLocaleString() const
Returns the code of the current locale.
Definition: L10n.cpp:358
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:414
~L10n()
Handles the destruction of L10n.
Definition: L10n.cpp:178
bool ValidateLocale(const icu::Locale &locale) const
Returns true if the locale is supported by both ICU and the game.
Definition: L10n.cpp:210
std::string GetLocaleBaseName(const std::string &locale) const
Returns the programmatic code of the entire locale without keywords.
Definition: L10n.cpp:369
std::vector< std::wstring > GetSupportedLocaleDisplayNames() const
Returns an array of supported locale names sorted alphabetically by locale code.
Definition: L10n.cpp:334
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:466
Status ReloadChangedFile(const VfsPath &path)
Loads path into the dictionary if it is a translation file of the current locale.
Definition: L10n.cpp:518
void LoadDictionaryForCurrentLocale()
Loads the translation files for the current locale.
Definition: L10n.cpp:556
std::vector< std::string > GetAllLocales() const
Returns a vector of locale codes supported by ICU.
Definition: L10n.cpp:311
std::unique_ptr< tinygettext::Dictionary > m_Dictionary
Dictionary that contains the translations for the current locale and the matching English strings,...
Definition: L10n.h:483
std::wstring GetFallbackToAvailableDictLocale(const icu::Locale &locale) const
Definition: L10n.cpp:237
void ReevaluateCurrentLocaleAndReload()
Determines the best, supported locale for the current user, makes it the current game locale and relo...
Definition: L10n.cpp:300
bool m_CurrentLocaleIsOriginalGameLocale
Whether the game is using the default game locale (true), 'en_US', or not (false).
Definition: L10n.h:517
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:395
std::vector< std::string > GetSupportedLocaleBaseNames() const
Returns an array of supported locale codes sorted alphabetically.
Definition: L10n.cpp:322
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:508
std::string GetLocaleCountry(const std::string &locale) const
Returns the ISO-3166 country code of the specified locale code.
Definition: L10n.cpp:375
Definition: path.h:84
Template base class for singletons.
Definition: Singleton.h:35
Definition: L10n.h:38
std::int64_t Status
Error handling system.
Definition: status.h:174