架空の地域を使ってアプリをテストする
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
架空言語とは、アプリを翻訳する際に、UI やレイアウトなど、翻訳関連の問題を引き起こす言語特性をシミュレーションできるように設計された言語です。架空言語は、ローカライズ可能なすべてのメッセージに対してインスタント自動翻訳を行うことで作成され、英語で判読可能な形式になっています。架空言語に変換されていないテキストがあった場合、ソースコード内に翻訳不可能なメッセージが存在していることを示します。
架空言語を利用すると、メッセージをソース リポジトリに commit する前に、UI テキストやそのレイアウトを調整し、後で送信して翻訳できるようになるため、時間とコストが節約されます。翻訳に関する潜在的な問題のリストについては、ローカライズに関する問題を発見するのセクションをご覧ください。
図 1. 英語(XA)架空言語
Android 架空言語の名前は標準の言語 / 地域命名規則に従い、その言語 / 地域 ID は BCP 47 準拠のプログラミング言語で解析可能です。この意味で、架空言語は、フランス語、中国語、ロシア語など、他の言語 / 地域と同じように使用できます。
Android プラットフォームでは、LTR(左から右)言語と RTL(右から左)言語を示す下記の 2 つの架空言語が用意されています。
図 2. AR(XB)架空言語
英語(XA): ベースの英語 UI テキストにラテン語のアクセントを追加し、さらに、アクセントなしテキストを追加して元のテキストを拡張し、各メッセージ ユニットを角かっこで囲みます。この拡張テキストから、潜在的な問題が明らかになります。潜在的な問題としては、レイアウトの破損やメッセージ構文形式の異常などがあります。たとえば、1 つの文が複数の部分に分割され、複数の角かっこ付きメッセージとして表示される場合などが該当します。英語(XA)架空言語を図 1 に示します。
AR(XB): 元の LTR(左から右)メッセージのテキスト方向を、RTL(右から左)方向に設定します。これにより、元のメッセージの文字の順序が逆になります。AR(XB)架空言語を図 2 に示します。
架空言語を利用すると、RTL 言語を書いたり話したりすることができなくても、アプリの RTL バージョンを作成できます。
架空言語を有効にする
架空言語は通常、デベロッパー向けのビルドに追加されます。デバイス上で架空言語を選択すると、架空言語をサポートするすべてのアプリに対して、選択した架空言語の特性が適用されます(設定アプリやクイック設定パネルなど、すべてのシステムアプリが含まれます)。
Android 架空言語を使用するには、Android 4.3(API レベル 18)以降を搭載したデバイス上で、開発者向けオプションを有効にする必要があります。また、デベロッパー オプションを有効にした後、デバイスを再起動する必要があります。
架空言語を有効にする手順は次のとおりです。
Android Studio 内で、build.gradle
ファイルに以下の構成を追加して、対象アプリの架空言語バージョンを有効にします。
Kotlin
android {
...
buildTypes.getByName("debug") {
isPseudoLocalesEnabled = true
}
}
アプリをビルドして実行します。
図 3. 架空言語を選択する
設定アプリを使用して、架空言語を選択します。以下に示すように、Android バージョンによって手順が異なります。
Android 5.0(API レベル 21)以降
- デバイス上で、設定アプリを開き、[言語と入力] > [言語の設定] をタップします。
- [言語の設定] リストで、架空言語のタブをドラッグしてリストの先頭に移動し、アクティブな言語に設定します(図 3 を参照)。
Android 4.4.4(API レベル 19)以下
- デバイス上で、設定アプリを開き、[言語と入力] > [言語の設定] > [言語を追加] をタップします。
- 架空言語をタップして、[言語の設定] リストに追加します。
- [言語の設定] リストで、架空言語のタブをドラッグしてリストの先頭に移動し、アクティブな言語に設定します(図 3 を参照)。
ローカライズに関する問題を発見する
架空言語を使用すると、UI 内に潜在しているローカライズに関する問題を効率的かつ効果的に発見することができます。以下のような領域に関する問題を検出できます。
- ハードコーディングされていて翻訳用に送信できない文字列は、架空言語内ではアクセントなしテキストとして表示されるため、認識できます。
- 架空言語でテキストを拡張したことで UI レイアウトに問題が発生した場合、現実の言語 / 地域でも、テキストの長さが原因で UI が損なわれるおそれがあります。
1 つのメッセージが 2 つ以上の角かっこ付きメッセージに分割されて表示された場合、文字列連結という問題が存在していることがわかります。翻訳者は、各部分が関連していることを知らずに各部分を個別に翻訳することになるため、正しく翻訳されなくなる可能性があります。また、言語によっては、文内の部分の順序が異なる場合や、文構造が完全に異なる場合があるため、文字列連結が存在すると、正しい翻訳が不可能になることがあります。たとえば、日本語や韓国語、タミル語などの言語では、動詞は文末に配置されます。文が連結されていると、翻訳者は必要に応じて単語の順序を変更することができなくなります。
双方向(BIDI)テキストに関する問題を発見できます。たとえば、架空言語に変換後、あるテキスト方向のコンテンツ内に、反対のテキスト方向のインライン フレーズが含まれていて、文字列が読みにくい場合、この問題が存在している可能性があります。
要素が正しく逆順に配置されていないケースなど、RTL(右から左)に関する問題を発見できます。たとえば、架空言語に変換後、UI 要素が RTL 方向になっていない場合や、テキストが反転せず、RTL 方向になっていない場合、句読点が誤って配置されている場合などがあります。「pseudolocales rule!」という文字列であれば、「!elur selacoloduesp」と変換される必要がありますが、「elur selacoloduesp!」と変換された場合は、句読点の配置が間違っています。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# Test your app with pseudolocales\n\nA pseudolocale is a locale that is designed to simulate characteristics of\nlanguages that cause UI, layout, and other translation-related problems when an\napp\nis translated. Pseudolocales are created by instant and automatic translations\nthat are readable in English for all *localizable* messages.\nUn-pseudolocalized text points to untranslatable messages in your source code.\n\nPseudolocales save time\nand money because you can make adjustments to the UI text and its layout before\nyou commit your messages to the source repository to be sent for translation\nlater. For a list of potential translation problems, see the\n[Spot localization issues](#spot_localization_issues) section. \n\n**Figure 1.** English (XA) pseudolocale.\n\nThe Android pseudolocale names follow standard locale naming conventions, and\ntheir locale IDs can be parsed by any BCP 47 compliant programming language.\nIn this sense, pseudolocales are just like any other locales, such as French,\nChinese, or Russian.\n\nThe Android platform provides the following two pseudolocales to represent\nleft-to-right (LTR) and right-to-left (RTL) languages: \n\n**Figure 2.** AR (XB) pseudolocale.\n\n**English (XA):** adds Latin accents to the base English UI text, expands the\noriginal text by adding non-accented text, and brackets each message unit to\nexpose potential issues from expanded text. Potential issues can be layout\nbreakage and badly formed message syntax, such as a sentence split\ninto multiple parts displaying as multiple bracketed messages. The English (XA)\npseudolocale is shown in figure 1.\n\n**AR (XB):** sets the text direction of the original left-to-right messages to\nthe right-to-left direction, which reverses the order of the characters in the\noriginal message. The AR (XB) pseudolocale is shown in figure 2.\n\nPseudolocales can help you make an RTL version of your app, even if you don't\nwrite or speak any RTL languages.\n\nEnable pseudolocales\n--------------------\n\nPseudolocales are usually added to developer-oriented builds. When you choose a\npseudolocale on your device, all the apps that support pseudolocales take on\nthe characteristics of the selected pseudolocale, including all the system apps\nsuch as the Settings app and Quick Settings panel.\n\n\u003cbr /\u003e\n\n\nTo use the Android pseudolocales, you must be running\nAndroid 4.3 (API level 18) or higher and have\n[developer options](/studio/debug/dev-options) enabled\non your device. You must also reboot your device after enabling\ndeveloper options.\n\nThe following procedure explains how to enable pseudolocales:\n\n1. In Android Studio, enable pseudolocales for a specific app by adding the\n following configuration to your `build.gradle` file:\n\n ### Groovy\n\n ```groovy\n android {\n ...\n buildTypes {\n debug {\n pseudoLocalesEnabled true\n }\n }\n }\n ```\n\n ### Kotlin\n\n ```kotlin\n android {\n ...\n buildTypes.getByName(\"debug\") {\n isPseudoLocalesEnabled = true\n }\n }\n ```\n2. [Build and run your app](/studio/run).\n\n **Figure 3.** Select a pseudolocale.\n3. Use the Settings app to select a pseudolocale. This step varies based on your\n Android version, as follows:\n\n **Android 5.0 (API level 21) or higher**\n 1. On the device, open the Settings app and tap **Languages and input \\\u003e\n Language preferences**.\n 2. In the **Language preferences** list, drag the tab to move a pseudolocale to the top of the list and make it the active language. See figure 3.\n\n **Android 4.4.4 (API level 19) or lower**\n 1. On the device, open the Settings app and tap **Languages and input \\\u003e\n Language preferences \\\u003e Add a language**.\n 2. Tap a pseudolocale to add it to the **Language preferences** list.\n 3. In the **Language preferences** list, drag the tab to move a pseudolocale to the top of the list and make it the active language See figure 3.\n\nSpot localization issues\n------------------------\n\nPseudolocales provide a time-saving and effective way to spot potential\nlocalizability issues in the UI by helping you identify problems in the\nfollowing areas:\n\n- Hardcoded strings, which can't be sent to translation, display as unaccented text in the pseudolocale to make them noticeable.\n- UI layout issues caused by text expansion, showing where the UI can break due to text length.\n- String concatenation, which displays as one message split across two or\n more brackets. This can make correct translation difficult, because translators\n have to translate each part independently without knowing that the parts\n are related. String concatenation can also make correct translation impossible,\n because different\n languages might require a different order of parts or a completely different\n sentence structure. For example, languages such as Japanese, Korean, and\n Tamil place the verb at the end of a sentence. When a sentence is concatenated,\n translators can't change the word order as needed.\n\n- Bidirectional (BIDI) text problems, such as when content in one text\n direction\n includes an inline phrase in the opposite text direction, making the string\n difficult to read.\n\n- Right-to-left (RTL) problems, such as elements not being mirrored. Some examples are\n a UI element not moving to the left, text not reversing and moving to the\n left, or misplaced punctuation, such as \"pseudolocales rule!\" changing to\n \"elur selacoloduesp!\" instead of \"!elur selacoloduesp\"."]]