A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://gammasoft71.github.io/xtd/docs/documentation/guides/xtd.core/internationalization below:

Internationalization | xtd

Internationalization

Overview

Xtd uses a number of user-readable strings, such as "open" or "save", which need to be translated into the user's language if it's different from English.

xtd has built-in support for internationalization, allowing this to happen automatically if translations into the current language are available.

You can find here a list of all existing translations with the addresses of the official translators you should contact if you wish to submit corrections to the translations for your language.

List of all locales and corresponding languages

The following table shows all locales and corresponding languages :

 code  ISO 639-2 code  summary  language af  afr  Afrikaans locale  Afrikaans ar  ara  Arabic locale  Arabic ar_DZ  ara  Arabic locale (Algerian Arabic)  Algerian Arabic ar_MA  ara  Arabic locale (Moroccan Arabic)  Moroccan Arabic ar_SA  ara  Arabic locale (Sauid Arabic)  Arabic ar_TN  ara  Arabic locale (Tunisian Arabic)  Arabic az  aze  Azerbaijani locale  Azerbaijani be  bel  Belarusian locale  Belarusian bg  bul  Bulgarian locale  Bulgarian bn  ben  Bengali locale  Bengali bs  bos  Bosnian locale  Bosnian ca  cat  Catalan locale  Catalan cs  ces  Czech locale  Czech cy  cym  Welsh locale  Welsh da  dan  Danish locale  Danish de  deu  German locale  German de_AT  deu  German locale (Austria)  German el  ell  Greek locale  Greek en  eng  English locale  English en_AU  eng  English locale (Australia)  English en_CA  eng  English locale (Canada)  English en_GB  eng  English locale (United Kingdom)  English en_IE  eng  English locale (Ireland)  English en_IN  eng  English locale (India)  English en_NZ  eng  English locale (New Zealand)  English en_US  eng  English locale (United States)  English en_ZA  eng  English locale (South Africa)  English eo  epo  Esperanto locale  Esperanto es  spa  Spanish locale  Spanish et  est  Estonian locale  Estonian eu  eus  Basque locale  Basque fa_IR  ira  Persian/Farsi locale (Iran)  Persian fi  fin  Finnish locale  Finnish fr  fra  French locale  French fr_CA  fra  French locale (Canada)  French fr_CH  fra  French locale (Switzerland)  French gd  gla  Scottish Gaelic  Scottish Gaelic gl  glg  Galician locale  Galician gu  guj  Gujarati locale (India)  Gujarati he  heb  Hebrew locale  Hebrew hi  hin  Hindi locale (India)  Hindi hr  hrv  Croatian locale  Croatian ht  hat  Haitian Creole locale  Haitian Creole hu  hun  Hungarian locale  Hungarian hy  arm  Armenian locale  Armenian id  ind  Indonesian locale  Indonesian is  isl  Icelandic locale  Icelandic it  ita  Italian locale  Italian ja  jpn  Japanese locale  Japanese ja_HIRA  jpn  Japanese (Hiragana) locale  Japanese (Hiragana) ka  geo  Georgian locale  Georgian kk  kaz  Kazakh locale  Kazakh kn  kan  Kannada locale (India)  Kannada ko  kor  Korean locale  Korean lb  ltz  Luxembourgish locale  Luxembourgish lt  lit  Lithuanian locale  Lithuanian lv  lav  Latvian locale (Latvia)  Latvian mk  mkd  Macedonian locale  Macedonian mn  mon  Mongolian locale  Mongolian ms  msa  Malay locale  Malay mt  mlt  Maltese locale  Maltese nb  nob  Norwegian Bokmål locale  Norwegian Bokmål nl  nld  Dutch locale  Dutch nl_BE  nld  Flemish locale (Belgium)  Flemish nn  nno  Norwegian Nynorsk locale  Norwegian Nynorsk pl  pol  Polish locale  Polish pt  por  Portuguese locale  Portuguese pt_BR  por  Portuguese locale (Brazil)  Portuguese ro  ron  Romanian locale  Romanian ru  rus  Russian locale  Russian sk  slk  Slovak locale  Slovak sl  slv  Slovenian locale  Slovenian sq  sqi  Albanian locale  Shqip sr  srp  Serbian cyrillic locale  Serbian sr_LATN  srp  Serbian latin locale  Serbian sv  swe  Swedish locale  Swedish ta  tam  Tamil locale (India)  Tamil te  tel  Telugu locale  Telugu th  tha  Thai locale  Thai tr  tur  Turkish locale  Turkish ug  uig  Uighur locale  Uighur uk  ukr  Ukrainian locale  Ukrainian uz  uzb  Uzbek locale  Uzbek vi  vie  Vietnamese locale (Vietnam)  Vietnamese zh  zho  Chinese Simplified locale  Chinese Simplified zh_CN  zho  Chinese Simplified locale (China)  Chinese Simplified zh_TW  zho  Chinese Traditional locale (Taiwan)  Chinese Traditional

If you wish to add a specific language not listed below, you can do so by using the ISO code 639-1.

See List of ISO 639-1 codes for complete list of languages.

Translater usage Change the applicaiton locale

To change the application locale, use std::locale::global method.

The following example show how to change the locale to french (France).

auto main() -> int {
std::locale::global(std::locale {"fr_FR.utf-8"});
}

The following example show how to change the locale to russian (Russia).

auto main() -> int {
std::locale::global(std::locale {"ru_RU.utf-8"});
}

Or use xtd::translate::locale method.

The following example show how to change the locale to french (France).

auto main() -> int {
xtd::translate::locale("fr_FR");
}

The following example show how to change the locale to russian (Russia).

auto main() -> int {
xtd::translate::locale("ru_RU");
}
Change the application language without changing locale

To change the application language without changing locale use xtd::translate::language method.

The following example show how to change the language to french (France).

auto main() -> int {
xtd::translate::language("fr");
}

The following example show how to change the language to russian (Russia).

auto main() -> int {
xtd::translate::language("ru");
}
String format

The locale impact the format string as currency and date time see Format number, dates other types for more information.

Mark a string for translation

To mark a string for translation use xtd::translator::translate method or operator""_t literal operator.

The following example shows how to marks a string for translation with xtd::translator::translate method.

auto main() -> int {
auto str = translator::translate("This is a sor translation tring fexample.");

console::write_line(str);
}

The following example shows how to marks a string for translation with operator""_t literal operator.

auto main() -> int {
auto str = "This is a sor translation tring fexample."_t;

console::write_line(str);
}
Strings file format

The followng file example show the strings file format for translation

menu.strings :

# This file is used to translate menu items into French.

key "&File"
value "&Fichier"

key "&Edit"
value "&Editer"

key "&Vew"
value "&Vue"

key "&Window"
value "&Fenêtre"

key "&Help"
value "&Aide"

The strings file, for each language, must be in a directory with the ISO code 639-1 as its name, possibly followed by the underscore _ and the two uppercase letters of the country code.

locale languages hierarchy

The languages directories should be located in the locale folder, next to the src folder containing your application sources.

String files have no fixed name. The name and number of chain files can be arbitrary, depending on how the project is organized.

The following example shows the hierarchy file for my_app project.

my_app
|- locale
| |- en
| | |- messages.strings
| | |- menu_items.strings
| | |- texts.strings
| |- en_GB
| | |- messages.strings
| | |- menu_items.strings
| | |- texts.strings
| |- fr
| | |- messages.strings
| | |- menu_items.strings
| | |- texts.strings
| |- fr_CH
| | |- messages.strings
| | |- menu_items.strings
| | |- texts.strings
| |- ru
| |- messages.strings
| |- menu_items.strings
| |- texts.strings
|- src
| |- my_app.cpp
| |- my_app.h
|- CMakeLists.txt
Example

English : en English (Australia) : en_AU French : fr French (Switzerland) : fr_CH

See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4