Lokalise does not keep files (or file templates) as such. Instead, as you upload, we parse the files, extract keys and values and store in the database. As you need to export we generate files of any format you require.

Once a key is parsed and stored in the database it may have a filename attribute


Lokalise supports four platforms – iOS, Android, Web and Other. Assigning a key to one or multiple platforms actually means that this file will get exported to file formats, associated with the platform, i.e. assigning a key to iOS platform means it would get included with Apple Strings and Apple Xliff file exports, but would not get exported with JSON export (as it belongs to Web platform).

Each key can be attributed to a single filename per platform. You can set the attribution using Key editor (click key name in the editor, then navigate to Advanced tab).

Uploading and downloading different file structure patterns

There are several approaches how you may organize your keys into files and folders. Below we will try to cover all the possible options, but feel free to contact us in the web support chat if you need additional cases covered. There are multipe ways to exchange files with Lokalise, the most popular are Web UI, Lokalise CLI tool and GitHub/GitLab/Bitbucket integrations

You can use %LANG_ISO%  placeholder in filenames in order to rotate the language code on export.

The following example are based on Lokalise CLI tool, which you'd need installed.

Example 1. Single file per language.

As soon as you start using a translation management system there is no real need to break your keys to hundreds of files – it just creates unneeded overhead. We recommend keeping all your keys in single file per language, whichever the file format is.



# lokalise --token <token> import <project_id> --file locale/en.json --lang_iso en

# lokalise --token <token> import <project_id> --file locale/ru.json --lang_iso ru


# lokalise --token <token> export <project_id> --type json --bundle_structure locale/%LANG_ISO%.json --unzip_to .

We've used bundle_structure  parameter when exporting.

Example 2. Language code is part of the folder name

This pattern is used on Android and iOS. Quite similar to Example 1, the only difference is that %LANG_ISO% variable is being rotated in folder name:



# lokalise --token <token> import <project_id> --file values/strings.xml --lang_iso en

# lokalise --token <token> import <project_id> --file values-ru/strings.xml --lang_iso ru


# lokalise --token <token> export <project_id> --type xml --bundle_structure values-%LANG_ISO%/strings.xml --unzip_to .

Note, we are using values-%LANG_ISO%/strings.xml here, however in case it's a base language, the system would omit -%LANG_ISO%  part as required by Android.

Example 3. Multiple files per language folder



# lokalise --token <token> import <project_id> --lang_iso en --file en.lproj/\*.strings

# lokalise --token <token> import <project_id> --lang_iso ru --file ru.lproj/\*.strings

Note, we've escaped *  on Linux/Mac.


# lokalise --token <token> export <project_id> --type strings --directory_prefix %LANG_ISO%.lproj --use_original 1 --unzip_to .

We've added --directory_prefix  along with --use_original  parameters here.

Example 4. Multiple folders, language code part of the filename or folder.



# lokalise --token <token> import <project_id> --lang_iso en --file ModuleFirst/src/main/res/values/strings.xml,ModuleSecond/src/main/res/values/strings.xml --include_path 1

# lokalise --token <token> import <project_id> --lang_iso ru --file ModuleFirst/src/main/res/values-ru/strings.xml,ModuleSecond/src/main/res/values-ru/strings.xml --include_path 1

We've used --include_path 1  as a parameter to include relative path as a part of the filename.


lokalise --token <token> export <project_id> --type xml --use_original 1 --no_language_folders 1 --unzip_to . 

Note, we are using --no_language_folders  parameter here to omit creation of language folders, as they are part of the filename.

Different language codes for different platforms

As Lokalise allows storing multipe platform files in the same project it's often important to have different language codes depending to which format you are exporting. You need to adjust this manually in Web UI and the Downloads page. Once adjusted, click "Build" to save the setting. Now, when using the CLI tool, the system will apply last saved setting for particular file format.

Did this answer your question?