Allows you to easily create text string files for new locales, to see which strings will be used in a given locale, and to identify strings that have yet to be translated, all without having to work directly in XML-formatted files.
To start the Localization Files Editor, simply double-click one of the XML files containing the strings to be localized (or an XML file containing the localized strings). Within an Android project, the base strings file is res/values/strings.xml.
The Localization Files Editor consists primarily of a table in which each row represents a key and each column (except the first, which contains the key names) represents a locale. Each locale column corresponds to a strings.xml file within a directory named for that locale. The table cells represent key/value pairs within the strings.xml files. Wherever a cell contains a value, the strings.xml file corresponding to the cell's column defines that value for the key corresponding to the cell's row. This tabular presentation allows you to quickly see, for a single key, the strings that will be displayed in each supported locale. It also makes evident those strings that don't have a value defined specifically for that locale.
Within an Android project, you have a file that contains base, or default, values for each key: these values can be found in res/values/strings.xml (if this file does not exist, it is created for you with blank values when you open the Localization Files Editor). These default values are used for string resources that aren't specifically defined for a given locale.
If you prefer, you can view and edit the strings.xml files as XML: the tabs across the bottom of the view containing the Android Localization Files Editor allow direct access to the files. The various tabs are kept in sync, such that changes made in the Localization Files Editor appear immediately in the corresponding strings.xml tab, and changes made to an XML file in one of the strings.xml tabs are immediately reflected in the Android Localization Files Editor.
The Localization Files Editor options are displayed immediately above the table. Normally these options are not displayed, to allow the table to occupy most of the view. Click the disclosure triangle next to the word Options to show or hide the editor options. The Localization Files Editor has the following options:
Highlight Changes | When selected, those cells whose values that have changed since the underlying strings.xml files were last loaded or saved are highlighted. |
Show Cell Comments | Causes comments attached to a given locale-specific string to be displayed when you hover over the cell (without clicking) in which the string value is defined. The text box that presents the comment is editable; simply click within the comment to edit it. |
Search values | Used to locate particular string values within the table. Those cells that contain the search string are highlighted. Note that the search not case sensitive. |
Filter by Key | Limits the rows displayed in the table to those that contain the string entered here. The match between the filter string and the keys is case-insensitive. |
<string name="app_name">Internationalisation Test<!--This is the name of the app--></string>
If you delete the contents of a cell, any comments applied to that cell are also deleted.
Right-click within the table to bring up a menu of commands.
Show Columns | Show or hide value columns. Use this to hide locales that you aren't currently editing. Note that this command only controls the visibility of the columns; it does not affect the underlying XML files in any way. When you select this command you are presented with the set of "values" columns corresponding to the XML strings files in your project; those with check marks preceding them will be shown. Below the column list are two additional commands: Show All and Hide All, which show and hide all value columns, respectively. |
Undo | Reverts the previous Add Key, Remove Key, Add Column, or Remove Column command. |
Redo | Re-executes the command that was reverted using Undo. |
Add Key | Adds a new table row (or rows, if adding a string array), corresponding to a string to be localized. You will be asked to supply the key, after which the row will be created with only the key filled in (all "values" columns for that key are left blank). Note that until you actually supply a value for that key, none of the XML strings file in your project are affected. |
Remove Key | Deletes the selected keys and their associated values from each of the XML strings files in your project that specify a value for those keys. Note that even locales whose corresponding columns are hidden are affected. |
Add Column | Creates a new column corresponding to a specific locale. You will be prompted for the column ID, which must follow the pattern for a localized string directory: values-locale, where locale follows the ISO 639-1 pattern for locale names. This command creates a directory named after the column ID and within it a strings.xml file that contains two tags: the <?xml> tag that specifies the XML version and encoding (UTF-8), and an empty <resources> tag. Use Clone if you want to create a new locale that contains all of the keys and values defined in an existing locale. |
Remove Column | Deletes the column that currently has the cursor. Because this command deletes the corresponding strings.xml file (and its parent directory, if it contains no other files), you are prompted to confirm the action. |
Revert to Saved | Reloads the column that currently has the cursor from its corresponding file. |
Clone | Creates a new column that contains a copy of the values from an existing column. This command creates a directory named after the ID of the new column and within it a strings.xml file that is a copy of the one from the existing column. |
Translate column | Translates all of the text strings in the selected column to a different language using a selected translation service. Note that a column corresponding to the language to which you are translating must not already exist. |
Translate cell(s) | Translates the text in the selected cell or cells to a different language (or languages) using a selected translation service. This function allows you to translate a given string or strings into multiple different languages at one time. Note that localization files for the target languages must already exist. |