Creating localization dictionary using Android SDK resources

Android Platform SDK- where it is?

When you install the latest versions of Embarcadero RAD Studio, the Android Platform SDK is automatically installed as well (if the corresponding option was selected during installation). The Android Platform SDK installation includes a vast collection of localization files for various target languages. Utilizing these files for your projects can be a great idea. These localization files can be found under the 'platforms\android-XX\data\res' folder (where XX represents the Android version). Within this folder, you will find numerous sub-folders named 'values' with different suffixes corresponding to the target languages. By opening any 'strings.xml' file from these folders, you will discover an extensive list of resource strings that have been localized for the respective language. Leveraging this extensive localization database in all our applications can significantly reduce the time and costs involved in project localization.

Import Android Platform SDK localization terms.

TsiLang Dictionary Manager (starting from version 4.0.7) offers the ability to import these localization strings into the dictionary. This means that you can simply utilize the ‘Auto-translate’ feature from any TsiLang editor to automatically insert them into your projects. Additionally, with just a few simple steps, you can create a comprehensive dictionary with translations for commonly used user interface terms.

Just a few easy steps!

Let’s begin by creating a new dictionary file and naming it ‘android.dic’ (although you can use your existing dictionary and add the new content to it). Open the Dictionary Manager and you will be presented with its main window:

Dictionary Manager Main Window
Dictionary Manager Main Window

In the application’s menu, select the ‘Import’ command and choose the Android SDK localization XML file from the Platform SDK folder, for example:

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 XML Wizard
Import XML Wizard

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

Then click the “Next” button to continue.

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

Settings for Importing Android localization XML file
Settings for Importing Android localization XML file

Android Platform SDK localization file content.

The Android Platform SDK localization XML file contains string entries identified with the ‘name’ attribute, and the localized content is stored in the value of each XML entry. The ‘name’ attribute will also 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 using 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. Since we have selected the ‘default’ (English) localization file, we will name the importing language as ‘English’.

Configuring language names for importing Android SDK localization strings
Configuring language names for importing Android SDK localization strings

Click ‘Next’ after you have specified the language names. The Wizard will then perform the import using the gathered information. Once the importing process is complete, simply close the Wizard. The Dictionary Manager will now display the newly imported languages:

Dictionary with imported English localizations from Android SDK
Dictionary with imported English localizations from Android SDK

Adding more languages from Android Platform SDK localization files.

Now our dictionary includes the Android string ID language and English localization for strings used in the Android Platform SDK. To add more languages, we will repeat the steps above. Run the ‘Import XML’ Wizard again, this time with other 'strings.xml' files from the 'values' sub-folders that correspond to the desired languages. For example, to add the German language, you can import strings from the 'values-de' sub-folder, and to add the French language, you can import strings from the 'values-fr' sub-folder.

Note: Make sure to activate the ‘Smart Importing’ option while importing!

Dictionary with English, German and French localizations from Android SDK
Dictionary with English, German and French localizations from Android SDK


As you can see, building your own dictionary with approximately 1600 localization items took less than a couple of minutes. Now you have a robust extension to your localization database that can assist in translating your multi-language applications, even without the need for a translator service. Simply utilize the ‘Auto-translate’ feature from SIL Editor or TsiLang Translations Editor to retrieve translations from the dictionary for your projects.

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

TsiLang Components Suite:

Copyright © 1998-2024 Igor Siticov, SiComponents. TsiLang®, Resource Builder® and SiComponents® are registered trademarks of Igor Siticov.
RAD Studio, Delphi and C++Builder are trademarks and/or registered trademarks of Embarcadero Technologies, Inc.

Follow us: