Skip to content

Commit ed8a3df

Browse files
committed
1
1 parent 60d6d5f commit ed8a3df

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

path/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Same logic is isomorphic across `foo.{ps1,sh}`; platform-only code under `path/s
3535

3636
## Termux
3737

38-
- `unix/termux.sh`: locale + sensor. `env.sh` on Termux `require unix/termux` then `termux_apply_android_lang` (before i18n) — Android locale chain (`persist.sys.locale` → language/country → `ro.product.locale``settings`) via `getprop` / `/system/bin/getprop`, BCP 47 → `zh_CN.UTF-8`, sets `LANG`, unsets `LC_ALL`.
38+
- `unix/termux.sh`: locale + sensor. `env.sh` on Termux `require unix/termux` then `termux_apply_android_lang` (before i18n) — Android locale chain (`persist.sys.locale` → language/country → `ro.product.locale``settings`) via `getprop` / `/system/bin/getprop`, BCP 47 → `zh_CN.UTF-8`, sets `LANG`, unsets `LC_ALL`. `android_locale_to_lang` stops at singleton extensions (`u`/`t`/`x`/…) and keeps the first region only — otherwise `th-TH-u-nu-thai` becomes `th_nu.UTF-8`. Regression in `path/test/git.test.mjs` (`ANDROID_LOCALE_TO_LANG`).
3939
- `termux_ensure_sensor_api` installs `termux-api` for `termux-sensor` when missing on `fount logo` / `log` / `server`; tracked in `auto_installed_system_packages` for uninstall. Logo gravity details: [imgs/icon_anime/AGENTS.md](../imgs/icon_anime/AGENTS.md).
4040

4141
## CI smoke

path/src/unix/termux.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ android_locale_to_lang() {
6464
shift
6565
for part in "$@"; do
6666
case "$part" in
67+
[A-Za-z]) break ;; # singleton extension (u/t/x/…) — stop
6768
[A-Za-z][A-Za-z][A-Za-z][A-Za-z]) ;; # script (Hans/Hant/Latn) — skip
68-
[A-Za-z][A-Za-z] | [0-9][0-9][0-9]) region="$part" ;;
69+
[A-Za-z][A-Za-z] | [0-9][0-9][0-9])
70+
[ -z "$region" ] && region="$part"
71+
;;
6972
esac
7073
done
7174
if [ -n "$region" ]; then

path/test/git.test.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ const ANDROID_LOCALE_TO_LANG = [
465465
['en-US', 'en_US.UTF-8'],
466466
['ja-JP', 'ja_JP.UTF-8'],
467467
['en', 'en.UTF-8'],
468+
['th-TH-u-nu-thai', 'th_TH.UTF-8'],
468469
]
469470

470471
Deno.test('android_locale_to_lang normalizes BCP47 script tags for Termux LANG', async () => {

0 commit comments

Comments
 (0)