mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
Strings moved from res/values/ into composeResources/values/ kept Android's escaping, which Compose does not interpret the same way, so the login screen rendered `Don\'t have a Nostr account?` with a literal backslash and the terms line showed stray quotes. Compose 1.11.1 handleSpecialCharacters resolves only \uXXXX, \n and \t (and collapses \\). It leaves \' \" \? \@ alone, and renders Android's quote-wrapping -- used to preserve leading/trailing spaces, e.g. " Following" -- literally. Convert those four escapes and unwrap the quotes, leaving \n, \t, \uXXXX and \\ untouched so Compose still resolves them. 3,717 entries across 56 locale files; translations were hit far harder than English (Uzbek 964, French ~340 per variant, Turkish ~208) because those languages use apostrophes heavily. migrate.py now applies the same conversion as it moves each element, so the next wave cannot reintroduce this; fix_escapes.py repairs what is already migrated and is idempotent. Verified on a Pixel 9 emulator: "Event is loading or can't be found in your relay list" now renders with a real apostrophe, and no visible text node contains a literal backslash escape. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1CzYQvWyHfipSW7x3j4Yo
strings-migrate
Moves string keys from the Android app's res/ into commons Compose
resources (commons/src/commonMain/composeResources) across all
locales in one shot, preserving each element byte-for-byte so Crowdin
sees a pure move. Both trees are Crowdin-managed with the same android
layout (see crowdin.yml), so a migrated key keeps its translations.
tools/strings-migrate/migrate.py copy_to_clipboard relay_info
After migrating, repoint the code: R.string.key becomes Res.string.key
(com.vitorpamplona.amethyst.commons.resources), and the composable keeps
calling stringRes(...) via the commons bridge
(com.vitorpamplona.amethyst.commons.ui.stringRes).
The tool refuses keys whose value uses bare %s/%d: compose-resources
only formats positional %1$s args. Rewrite those keys (code and every
locale) first.