Downloading files and using webhooks

Updated a few seconds ago ​by Nick Ustinov


Lokalise is a project-based platform, which means we do not keep files as logical entities. There are two ways to group data by filenames when you are exporting.

Option 1. Group by language code (recommended)

For most projects, this is a recommended option. All you need to do is select the file format. Optionally, you may configure exported .zip structure as required using flexible placeholder options, for example setting structure to locale/%LANG_ISO%.%FORMAT% would produce the following structure:


Option 2. Use original filenames

In case you require more complex .zip structure (keys need to be split across multiple files, for example), there are several things to pay attention to:

  • When importing a file, keys are automatically assigned to filenames.
  • Keys can be assigned to different filenames per platforms (that is useful if you share keys between platforms, e.g. Cancel button text). As an example, you can assign a key to frontend.json on Web and strings.xml on Android.
  • If you need to rotate language code in the filename, use %LANG_ISO% placeholder in the filename, e.g. backend_%LANG_ISO%.%FORMAT%
  • Adding a new key via web interface or API, you can either keep it unassigned to filename or assign to existing / create new filename.

Sometimes in large-scale projects it is necessary to maintain original file structure. Lokalise does this automatically. When downloading files, enable "Use original filenames" switch. Please note, in most cases you would not need to stick to original filename structure, as Lokalise has flexible exporting options, including building custom .zip bundles.

Webhooks and export options

The webhooks are assigned per project per user, meaning if you share a project with another owner, the other person will not have the same webhooks or export options you set up for the project. If you need to share the webhook settings with other project users, simply use the sidebar chat.

Once a webhook fires (once the export has been performed), the request is sent to a specified URL. Lokalise sends HTTP POST['file'] to a URL you set. For security reasons only the filename is sent, so you need to add in front when pulling. Here is a sample PHP script to pull and unzip the bundle: 

// requires php curl 
$url = '' . $_POST['file'];
$local_file = '/tmp/';
$extract_path = '/var/www/';
$zip = new ZipArchive;
$ch = curl_init(); 
$fp = fopen($local_file, "w");     
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
if ($zip->open($local_file)) {
} else {
    echo "Could not download remote file.";

How did we do