%1$s を壊さずに Android の strings.xml を翻訳
<b> が消えた、または %2$s を 2 回使う values-de/strings.xml でもビルドは通ります。以下で、一つのコマンドがそうした行と足りない複数形を見つけ、もう一つがファイルを翻訳し直します。
KAERISはこのページを翻訳し、すべての行を逆翻訳して確認しました。ネイティブスピーカーによるレビューはまだ行われていません。 英語原文
サンプルプロジェクト
小さな Android strings.xml プロジェクト: 英語のソースと、更新が遅れたドイツ語ファイル。以下のコマンドはまさにこのファイルで実行しました。
<resources>
<string name="app_name" translatable="false">Tasky</string>
<string name="welcome">Welcome back, %1$s!</string>
<string name="due">Due %1$s at %2$s</string>
<string name="tap_here">Tap <b>here</b> to continue</string>
<plurals name="tasks_left">
<item quantity="one">%d task left</item>
<item quantity="other">%d tasks left</item>
</plurals>
<string name="sign_out">Sign out</string>
</resources>
<resources>
<string name="welcome">Willkommen zurück, %s!</string>
<string name="due">Fällig am %2$s um %2$s</string>
<string name="tap_here">Tippe hier, um fortzufahren</string>
<string name="sign_out">Abmelden</string>
</resources>
1. 足りないものを見つける
kaeris check は各翻訳をソースファイルと比較します。キーもアカウントも不要でオフラインで動き、問題が見つかるとコード 1 で終了するので、CI ジョブをそこで止められます。
$ npx kaeris check --source res/values/strings.xml --langs de
✗ de: 1 missing key(s): tasks_left (plural)
✗ de: 2 placeholder mismatch(es):
welcome: missing ['%1$s'], added ['%s']
due: missing ['%1$s'], added -
✗ de: 6 translation fault(s):
welcome: lost placeholder %1$s
welcome: invented placeholder %s (not in source)
due: lost placeholder %1$s
due: placeholder %2$s appears 2× vs 1× in source (duplicated)
tap_here: lost inline tag </b>
tap_here: lost inline tag <b>
✗ 1 missing key, 2 placeholder mismatches, 6 translation faults
2. ファイルを翻訳する
このリリースの --only-new は JSON と ARB のみ対応です。strings.xml では CLI がその旨を表示してファイル全体を翻訳し直し、壊れた行も置き換わります。コマンドは Python パッケージに入っています: pip install kaeris。
$ kaeris translate res/values/strings.xml --langs de --only-new
→ no key: free demo limits 10,000 chars per file, 8 languages per run, get a key: kaeris.dev/developer
! --only-new supports JSON/ARB only (zero-dependency CLI); translating the whole .xml file instead
→ Translating strings.xml → de
✓ Wrote 1 file(s) to ./res/values-de
res/values-de/strings.xml
✓ Translation QA: no placeholder loss, no overflow risks
→ Run: openai/gpt-6-luna · Free · 1/1 languages · 6 strings · 5.7s
95 charged
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by KAERIS i18n Tool — de -->
<resources>
<string name="welcome">Willkommen zurück, %1$s!</string>
<string name="due">Fällig am %1$s um %2$s</string>
<string name="tap_here">Tippe <b>hier</b>, um fortzufahren</string>
<plurals name="tasks_left">
<item quantity="one">%d Aufgabe übrig</item>
<item quantity="other">%d Aufgaben übrig</item>
</plurals>
<string name="sign_out">Abmelden</string>
</resources>
3. もう一度チェックする
終了コード 0: すべてのキーがあり、すべてのプレースホルダーがソースと一致しています。
$ npx kaeris check --source res/values/strings.xml --langs de ✓ de: complete & placeholder-safe ✓ all locales complete & placeholder-safe
2026 年 11 月 2 日、キーなしの無料プランで実行: チェックは npx kaeris 0.2.42、翻訳は PyPI の kaeris 0.2.42。出力は表示されたままで、進捗行とローカルのフォルダパスだけを省いています。
Android strings.xml で kaeris check が見つけるもの
足りない文字列と複数形
values-deに無い<plurals name="tasks_left">は報告されます。translatable="false"の文字列は求められません。位置指定子
%1$sの代わりの%sも、2 回使われた%2$sも、どちらも報告されます。インラインのマークアップ
文字列から消えた
<b>は報告されます。
料金
kaeris checkは無料お使いのマシンで動きます。キー不要、アカウント不要、上限なし。
翻訳は無料で始められます
キーなし: 1 ファイル 10,000 文字、1 日 300,000 文字、1 回の実行で最大 8 言語。無料キーがあれば 1 ファイル 50,000 文字、月 1.5M 文字に増えます。量は対象言語ごとに文字数を 1 回ずつ数えます。
無料プランを超える場合
Lifetime は $79 の一回払いで、ご自身の OpenRouter キーで動くため、モデルの費用は別途かかります。Pro は月 $19 または年 $190 で、月 12M 文字です。料金
よくある質問
translatable="false" はどうなりますか?
それらの文字列は対象外です。チェックは求めず、翻訳にも含まれません。上の app_name と同じです。
XML は解析しても安全ですか?
はい。DOCTYPE または外部エンティティを持つファイルは、解析前に拒否されます。
CIで実行できますか?
はい。npx kaeris check は問題が見つかるとコード 1 で終了します。手順: GitHub Actions、GitLab CI、pre-commit。
続ける
check リファレンス · CLI リファレンス · ブラウザで無料チェック · ブラウザで翻訳
ほかのスタック: react-i18next · next-intl · vue-i18n · Flutter · iOS