mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
- commons/ui/StringRes.kt: the Compose-resources twin of the app's stringRes family (composable, formatted, plural, and suspend loadStringRes variants). Thin delegates - compose-resources caches parsed locale files process-wide, so the Android-style LruCache is unnecessary here. - App StringResourceCache.kt gains stringRes(StringResource) overloads delegating to the bridge, so a file can mix migrated and unmigrated keys under its existing single import; migrating a key is just R.string.x -> Res.string.x. - tools/strings-migrate: moves keys from app res to commons composeResources across all locales byte-for-byte (both trees are Crowdin-managed with the same android mapping); refuses keys using bare %s/%d since compose-resources only formats positional args. - Exemplar: profile_banner - the single string blocking the ui/layouts cluster - migrated across 57 locales, all 7 call-site files repointed. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011S1vbFWVVAMFDT8PTgdibV
21 lines
856 B
Markdown
21 lines
856 B
Markdown
# 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.
|
|
|
|
```bash
|
|
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.
|