Feat/extract strings - #27
Merged
Merged
Conversation
Groundwork for translating the TV app. No visible text changes: every literal
lifted out becomes a string resource holding exactly the same words, and the
extraction was verified by building the app.
86 dead string resources deleted — leanback template leftovers (`browse_title`
= "Videos by Your Company", `rent_1`, `buy_2`, `lorem`, `hello_blank_fragment`)
and an Uzbek phone-login flow that was removed from the code long ago. Nothing
deleted is still referenced; the four that looked dead are `<plurals>`, reached
through `R.plurals` rather than `R.string`.
119 layout attributes (`android:text`, `hint`, `contentDescription`, and the
nav-graph `label`s) and 37 Kotlin literals now point at resources. What was
left alone on purpose: the on-screen keyboard's single letters, the `•` and `−`
separators, `"$value$unit"`, and the empty strings — none of them is language,
and turning them into resources would ask nine translators to translate a
punctuation mark.
`"${item.count} sources"` now goes through the `source_count` plurals that
already existed and was not being used at that call site, so a single source no
longer reads "1 sources".
Two extracted names had to be renamed because an Android resource name must
start with a letter: the layout-preview values "5 hours ago" and "16sp", both
overwritten at runtime.
Uzbek, Russian, German, Dutch, Spanish, Portuguese, French, Turkish and
Indonesian, alongside the English base — 3,312 translated strings across nine
`values-*` folders.
No Arabic. It needs a mirrored leanback layout and a font carrying its glyphs,
and neither is in this app; tying the other nine to that work would have held
all of them.
44 resources are deliberately left in English: the nav-graph destination labels
(never drawn on a leanback screen), brand names, the `•` separator, and the
layout-preview samples. Android falls back per key, so omitting them is the
right answer rather than a gap — and `tools/check_strings.py` knows the list,
because a check that reports a deliberate decision as debt trains people to
ignore it.
The picker sits in My Account rather than relying on the system's per-app
language setting. Android 13+ builds that entry from `locales_config.xml`, but
the device this matters most on is a cheap TV box that shipped in a language
its owner did not choose and would not know to change system-wide.
`AppCompatDelegate.setApplicationLocales` carries the same mechanism down to
this app's minSdk, so nothing is gated on 13.
Also caught while wiring it up: the base English file still held Uzbek in four
values ("Tv Kanallar", "Amallar", "soat", "daqiqa"), the content-controls
header built its summary from English literals, and six section titles were
hardcoded in custom layout attributes that the earlier extraction pass did not
know to look at.
The TV app had no CI at all, only a release workflow. It has one now: the
string check, and an assembleDebug — `mergeDebugResources` is where a duplicate
or badly named resource fails, and it fails for every locale at once. The check
blocks on a mismatched format specifier in any locale, because that throws at
`getString` time on that language only, and on keys missing from `uz`/`ru`,
which the team writes. The other seven are reported and fall back to English.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.