SlopTube

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#

  1. Add an enumerator to Text in src/app/ui/Strings.hpp, before Count.
  2. Add the row, in the same position, to kTranslations in src/app/ui/Strings.cpp, with every language side by side:

cpp {Text::Subscribe, {"Subscribe", "S'abonner"}},

  1. 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#

  1. Add the language to Language and bump kLanguageCount.
  2. Map its ISO 639-1 code in kLanguageCodes.
  3. 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).

Edit this page on GitHub