Skip to content

Documentation

Management

Translate PHP Define files

PHP Define .php files use define() calls as translation entries for PHP apps. Covers magic comments and how to translate them with WebTranslateIt. 2 min read

What are PHP Define files?

PHP Define files are PHP files used as language files to localize PHP apps. Their file extension is .php.

WebTranslateIt is a software localization platform that can help localize PHP Define .php files.

PHP Define file example

php
<?php
  define("January", "January");
  # An instruction to translators.
  define("February", "February");
  define("March", "March");
  define("April", "April");
  define("May", "May");
  define("June", "June");
  define("July", "July");
  define("August", "August");
  define("September", "September");
  define("October", "October");
  define("November", "November");
  define("December", "December");
?>
  • Each string must end with a ;.
  • define can be spelt in lowercase or uppercase.
  • 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.

Magic Comments

This file handler support the following magic comments:

  • Comments containing [MAXCHAR=xx] will set a max character limit to xx. Example: // [MAXCHAR=20]
  • Comments containing [LABEL=xxxx] will assign the label to xxxx. Example: // [LABEL=new feature]

More Information

PHP