Files
TEESimulator-RS/module/action.sh
T
Enginex0 60b6ec64c2 feat(action): i18n the clear-keys confirmation
Add action_i18n.sh with 22 language arms (ar, az, bn, de, el, es-ES,
fa, fr, id, it, ja, ko, pl, pt-BR, ru, th, tl, tr, uk, vi, zh-CN,
zh-TW) plus an English default. Detect device locale via
persist.sys.locale with ro.product.locale and ro.system.locale
fallbacks; split Chinese on Hans/Hant.

action.sh sources the helper at top and substitutes every echoed
literal with $(_msg <key>). The confirm() flow stays unchanged.

Wire action_i18n.sh into customize.sh's per-file extraction list so
the helper lands alongside action.sh in /data/adb/modules/tricky_store
at install time.

Pattern mirrors tricky-addon-enhanced/install_i18n.sh.
2026-05-19 18:43:46 +01:00

68 lines
1.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/system/bin/sh
MODDIR=${0%/*}
CONFIG_DIR=/data/adb/tricky_store
. "$MODDIR/action_i18n.sh"
echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " ⚠️ $(_msg confirm_header)"
echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " "
echo " $(_msg confirm_warning_1)"
echo " $(_msg confirm_warning_2)"
echo " "
echo " 🔊 $(_msg confirm_vol_up)"
echo " 🔉 $(_msg confirm_vol_down)"
echo " "
confirm() {
vol_tmp="${TMPDIR:-/data/local/tmp}/teesim_vol_key"
seconds=10
: > "$vol_tmp"
getevent -qlc 1 > "$vol_tmp" 2>/dev/null &
ge_pid=$!
while [ "$seconds" -gt 0 ]; do
sleep 1
if ! kill -0 "$ge_pid" 2>/dev/null; then
key=$(awk '/KEY_/{print $3}' "$vol_tmp" 2>/dev/null)
case "$key" in
KEY_VOLUMEUP)
rm -f "$vol_tmp"
return 0
;;
KEY_VOLUMEDOWN)
rm -f "$vol_tmp"
return 1
;;
esac
: > "$vol_tmp"
getevent -qlc 1 > "$vol_tmp" 2>/dev/null &
ge_pid=$!
fi
seconds=$((seconds - 1))
done
kill "$ge_pid" 2>/dev/null
wait "$ge_pid" 2>/dev/null
rm -f "$vol_tmp"
return 1
}
if ! confirm; then
echo " "
echo " ❌ $(_msg confirm_cancelled)"
exit 0
fi
if [ -d "$CONFIG_DIR/persistent_keys" ]; then
rm -rf "$CONFIG_DIR/persistent_keys"
mkdir -p "$CONFIG_DIR/persistent_keys"
echo " "
echo " ✅ $(_msg confirm_cleared)"
else
echo " "
echo " $(_msg confirm_not_found)"
fi