Android Platform SDK- where it is?

When you install the recent versions of the Embarcadero RAD Studio you will also get installed Android Platform SDK (if the respective install option was activated during install). The Android Platform SDK installation includes resources with a huge amount of localization files for different target languages. So it could be a good idea to use them for your projects. These localization files are placed under platforms\android-XX\data\res folder (where XX is Android version). There are plenty of sub-folders named “values” with different suffixes that relate to target language. So, by opening any “stings.xml” file from those folders you can discover that it contains a long list of resource strings that are localized for target language. Reusing this huge localization database in all our applications could help significantly reduce time and costs of projects localization.

Import Android Platform SDK localization terms.

TsiLang Dictionary Manager (starting from version 4.0.7) allows importing these localization strings to dictionary. So, later you can just use “Auto-translate” feature from any TsiLang editor to automatically insert them into your projects. Moreover, just a few easy steps and you can build a solid dictionary with many commonly used user interface terms translated.

Just a few easy steps!

Let’s start with the new dictionary file and name it “android.dic” (of course you can use your existing dictionary to extend it with the new content). So run the Dictionary Manager and you will see its main window:

Import localization from Android SDK. Step 1.

Figure 1. Dictionary Manager Main Window

Select in application’s menu “Import” command and select Android SDK localization XML file from Platform SDK folder, for example:
“C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\platforms\android-19\data\res\values\strings.xml”.
So let’s start with content from “values” folder (without any suffixes) as it contains the default English localization.

Import XML Wizard.

In the “Import XML” Wizard select “Android SDK Localization File” option as XML format:

Import Android SDK XML Wizard

Figure 2. Import XML Wizard

So Dictionary Manager will know how to parse the XML file.

Then click “Next” button to continue.

On the next step activate “Simple importing” option to speed-up importing since our dictionary is empty on this step.

Android SDK XML Importing Options

Figure 1. Importing Options

Android Platform SDK localization file content.

Android Platform SDK localization XML file contains string entries identified with “name” attribute and localized content in the value of XML entry. The “name” attribute also will be used to identify the entry in the dictionary, so it will be imported as a separate language. Select the name for this language in the dictionary. We recommend to use the default value “Android_Name_ID” as the language name. However, you can always enter your own name for this language. Also specify the language name for the string localization values from the importing file. As we’ve selected “default” (English) localization file we will name importing language as “English”:

Configuring language names for importing Android SDK localization XML

Figure 4. Configuring language names for importing

So click “Next” after you have specified the language names. As a result, the Wizard will perform the import because it has gathered all the necessary information. Then just close the Wizard upon completion of the importing process. The Dictionary Manager now displays new languages that have been imported:

Dictionary with imported English localisations from Android SDK XML

Figure 5. Dictionary with imported English localisations from Android SDK XML

Adding more languages from Android Platform SDK localization files.

Now our dictionary includes Android string ID language and English localization for strings used in Android Platform SDK. To add more languages we will repeat the steps above. So run the “Import XML” Wizard again with other “strings.xml” files from “values” sub-folders that correspond to the needed languages. For example, to add German language you can import strings from “values-de” sub-folder, and to add French language you can import strings from “values-fr” sub-folder. Be sure to use “Smart Importing” option activated while importing.

Dictionary with English, German and French localisations from Android SDK

Figure 5. Dictionary with English, German and French localisations from Android SDK

As you can see now, building your own dictionary with about 1600 localization items required less than couple of minutes. So now you have a solid extension to your localization database that might help to translate your multi-language applications even without translator service. Just use “Auto-translate” feature from SIL Editor or TsiLang Translations Editor to retrieve translations from the dictionary to your projects.

TsiLang Components Suite home page: http://www.tsilang.com.

Latest version can be downloaded from: our download page.

You can download this article in PDF format here: creating_localization_dictionary_using_android_sdk_resources.pdf.

We are using cookies on our website

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.