This bundle receives the webhook from lokalise.co and uploads the new translation files to your directories.
Require it with composer.
composer require alicorn/lokalise-bundle
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Alicorn\LokaliseBundle\AlicornLokaliseBundle(),
// ...
);
}
# app/config/routing.yml
# Webhook url configuration
alicorn_lokalise:
resource: "@AlicornLokaliseBundle/Controller/"
type: annotation
prefix: /lokalise/webhook/ # your webhook url
# app/config/config.yml
# ...
alicorn_lokalise:
# Webhook configuration
host: "https://s3-eu-west-1.amazonaws.com/lokalise-assets/" # Lokalise host for downloads can be overwritten
web_path: "web/locales" # Path for locale files #1
symfony_path: "app/Resources/translations" # Path for locale files #2, can be blank
extract_file: "/tmp/langs.zip"
# API configuration
api:
api_token: "XXXXXXXXXXXXXXXXXXXXXX"
project_id: "XXXXXXXXXXXXXXXXXXXXXX"
type: "json"
use_original: "0"
bundle_structure: "%%LANG_ISO%%.%%FORMAT%%"
base_url: "https://lokalise.co/api/"
directory_prefix: "%%LANG_ISO%%"
Configure your webhook on lokalise.
When building the project in lokalise, it will trigger the webhook and unzip the translation files to the configured directories.
If the API is configured, you can use the import command to update all translation files locally.
php bin/console lokalise:import