PHP Arrays (.php)
Nick Ustinov avatar
Written by Nick Ustinov
Updated over a week ago

Here is a PHP file with a sample array definition:

<?php

$lang["username"] = "Username";
$lang["password"] = "Enter password";
$lang["app"] = "Lokalise";

By default, the variable name is $lang but you can provide any other name, for example $_["username"]. During the export, a variable with the same name will be used as well.

Known limitations

While custom variable names are supported, this feature has certain limitations:

  • The custom variable name is being set only if you're importing a file with new keys (meaning this name is not updatable).

  • The custom variable name cannot be modified using Lokalise editor.

  • You can't have different custom variables in a single file.

  • Multiple assignment written in the following way is not supported $lang["key1"] = $lang["key2"] = "Translation";.

Did this answer your question?