Localization Files Editor

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 should open, showing all of the strings and string arrays defined in each of the strings.xml files in your project's resources directory. If it does not, open it as follows:
  1. Right-click one of the the XML files containing localized strings.
  2. From the context-sensitive menu select Open With > Other .
  3. In the Editor Selection dialog select Localization Files Editor.
Note: The Localization Files Editor forces every project to have a default values file (values.xml). If your project doesn't have one, when you open the editor this file will be created with empty keys.

The editor

The Localization Files Editor consists primarily of a table in which each row is identified by a key (or, for an array entry, a key and an array index) and each column (except the first, which contains the keys and indexes) 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.

The following actions can be performed by clicking the icons arrayed across the top of the table:

Adds a new table row (or rows, if you click the downward-pointing arrow to the right of the icon and specify a number of rows to be added) representing a string to be localized. Each new row will initially have a default key value; replace this value with the key by which the string should be referenced.
Adds to the table a string array (an array of strings collectively identified by a single key; each string is then accessed using an integer index value). Click the downward-pointing arrow to the right of the icon and specify a number to add multiple arrays at once. Each new array will initially have a default key value; replace this value with the key by which the array should be referenced. As created an array will only have a single entry; use (Add Array Item) to add additional entries to the array.
Available only when you have selected an array, this command adds a new entry to the end of the array. Click the downward-pointing arrow to the right of the icon and specify a number to add multiple entries to the array.
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. If an individual array item is selected when you issue this command, that item is deleted. If the table row containing an array's key is selected, the entire array is deleted.
Collapses all arrays to a single table row, hiding those rows corresponding to each array's entries.
Expands all arrays so that all array entries are visible.
Reverts the previous command.
Re-executes the command that was reverted using (Undo).

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.

Options

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:

Expand row size according to number of lines When selected, the table rows expand vertically to accommodate multiple lines of text. All table rows expand to the same height: the height required by the row with the most lines of text in one cell. Clear this option to view the table at its most compact, with only a single line of text showing for each row. Note that this option only affects how the row is presented in the Localization Files Editor; a cell can contain more text than is initially displayed.
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.
Highlight Changes When selected, those cells whose values that have changed since the underlying strings.xml files were last loaded or saved are highlighted.
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.

Cell comments

For each key/value pair defined for a given locale, you can also add a comment. If Show Cell Comments is enabled (you may need to click Options to see or change the state of this option), simply hover over a cell (without clicking) in which a value is defined and a floating text box will appear in which you can enter your comment or view the comment currently attached to the cell. Note that there must be a value in the cell in order to comment on it; you cannot apply comments to empty cells. Within the strings.xml file, the comment is attached to the string value like this:
<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.

Context-sensitive commands

Right-click within the table to bring up a menu of commands. Note that many of these commands correspond to the action icons arrayed across the top of the table.

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 command.
Redo Re-executes the command that was reverted using Undo.
Add String Adds a new table row representing a string to be localized. The row will initially have a default key value; replace this value with the key by which the string should be referenced.
Add Array Adds to the table a string array (an array of strings collectively identified by a single key; each string is then accessed using an integer index value). The array will initially have a default key value; replace this value with the key by which the array should be referenced. As created the array will only have a single entry; use Add Array Item to add additional entries to the array.
Add Array Item Available only when you have selected an array, this command adds a single new entry to the end of the array.
Remove Line 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. If an individual array item is selected when you issue this command, that item is deleted. If the table row containing an array's key is selected, the entire array is deleted.
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.
Collapse All Collapses all arrays to a single table row, hiding those rows corresponding to each array's entries.
Expand All Expands all arrays so that all array entries are visible.
Related tasks
Creating a new locale
Adding new strings
Adding new string arrays
Editing a localized string
Editing a localized string array