Localisation#
SlopTube ships in English and French and follows the phone's language (Platform::locale),
falling back to English. InnerTube requests send the same language and region (hl, gl), so
everything the server returns — titles of shelves, view counts, dates, error messages — is
localised by YouTube itself.
Adding a string#
- Add an enumerator to
Textinsrc/app/ui/Strings.hpp, beforeCount. - Add the row, in the same position, to
kTranslationsinsrc/app/ui/Strings.cpp, with every language side by side:
cpp
{Text::Subscribe, {"Subscribe", "S'abonner"}},
- Use it with
tr(Text::Subscribe).
A static_assert fails the build if a row is missing or out of order, so a translation can never
silently shift to the wrong message.
Messages with a number use std::format placeholders and are formatted with std::vformat
(Text::ReplyCount = "{} replies" / "{} réponses").
Adding a language#
- Add the language to
Languageand bumpkLanguageCount. - Map its ISO 639-1 code in
kLanguageCodes. - Add a column to every row of
kTranslations.
Text in any script, including right-to-left ones, is rendered correctly regardless of the UI language (see text.md).