Translate PHP Array files

WebTranslateIt supports PHP array files.

.php array file example

$lang = array(
  'string0' => 'some text',
  'string1' => 'some text
with a linebreak.',
  'string2' => 'some text with a\' quote',
  # a comment
  'string3' => "some text with a ' quote",
); ?>
  $LANG['_MONDAY'] = "Monday";
  $LANG["_TUESDAY"] = 'Tuesday';
  // This is a comment
  $LANG["_WEDNESDAY"] = '';
  $LANG["_Thursday"] = "Thursday";
  • Each string must end with a ,, except for the last string of the Array where comma is optional.
  • Strings can contain linebreaks.
  • $lang can be replaced by any other variable or array, for instance $LOCALE = array() or $LANG['fr'] = array().
  • Make sure to add a newline between $lang = array( and the list of strings.
  • Strings can be single quoted or double quoted.
  • If a string is single quoted, single quotes must be escaped.
  • If a string is double quoted, double quotes must be escaped.
  • Instructions can be left to translators by including a line starting by #.
  • The PHP closing tag ?> is optional. If no PHP closing tag is present when importing a file WebTranslateIt will generate files without a closing tag.


$LANG = array(
  'January' => 'January',
  'February' => "February",
  "March" => 'March \'quote\' or "quote"',
  "April" => "April 'quote' or \"quote\"",
); ?>


$LANG = array(
  'January' => 'January 'quote'',
  'February' => "February "quote"",
); ?>