Multi-Language Project

Important
  1. Multi-Language project must use utf-8 for everything. The charset of the project must be "utf-8".
  2. The data in your database must be stored in unicode, otherwise your data will not be displayed properly.
  3. Only the English language file is provided by our products, you'll need to prepare the language files for other languages yourself. You may also check our website and see if there are any user submitted language files. If you want to share your language files with others (without any conditions), you can submit your language file to us too.

 

Making Language Files

Note Language files are placed in the subfolder "languages" under the PHPMaker folder (e.g. C:\Users\<user>\AppData\Roaming\PHPMaker2025\languages). The files are used by all templates and extensions.

To translate a language, duplicate the shipped *english.en-US.xml* and rename it. The file name should contain alphanumeric characters, "-", "_" and "." only.

  1. Open the new XML file with any text or XML editor, you'll see the root node:

    You must change the id attribute.

  2. The id is an identifier for identifying the language, it must be a locale identifier using RFC 4646 language tags (which use hyphen, not underscore). The language ID should includes the region (e.g. "en-US", "de-DE").

    For example, if you want to make language file for Spanish, you can rename the file as *spanish.es-ES.xml* and modify the node as:

  3. Since v2022 there is NO need to have a corresponding locale file for each language file, PHP built-in locale settings will be used. If you need to customize the settings, see Tools -> Locale Settings
  4. You can edit or even add your own phrases. Just open the language file with any text or XML editor, edit/add your <phrase> nodes. Make sure you provide a unique id to each phrase. The id must be alphanumerical only.

    The phrases are not limited to text, you can also use CSS class, e.g.

  5. Language file is a XML file, when you edit the file, make sure that you keep it well-formed. If you use HTML tags or special characters in the attributes of the XML tags, you need to use entity references. For example, to insert the > symbol, you need to use &lt;. Make sure your characters are supported by the encoding of the XML file specified in the processing instruction node (the first line). You can load the file in your browser to check if the file is well-formed, if it is, the browsers should be able to load and display it without any errors.

**Notes** 1. DO NOT use old language files from previous versions directly or the new phrases will be missing. You should compare the English version of the language files from old and new version and then add the new phrases to your new language file. 1. Since v2024 multiple language files are supported, you can put more than one language files in the language folder for each language, e.g. *spanish.es-ES.xml* and *my-spanish.es-ES.xml*. All language files with the same language ID will be loaded and merged. So you must not use the same phrase ID under the same parent element (e.g. ````) in different language files or they will overwrite each other. You can however put them under your own parent element, see [Language Files](extension.html?id=language-files) of extensions as example.

 

Selecting Languages

Click Tools -> Languages to select the languages you want to use in the project. If more than one language is selected, links will appear on the top of the generated site for users to select language. If you want to customize the text of the links, you can customzie the file C:\Users\\\\AppData\Roaming\PHPMaker2025\languages\languages.xml.

 

 

Enabling Multi-Language and Selecting Default Language

If you want to use multi-language project, make sure you have enabled Multi-Language in the PHP->General tab (see PHP Settings).

Then, select a Default Language in the PHP->General tab (see PHP Settings).

 

 

Multi-Language Property Editor

Note If you use single language, you do NOT need to use this editor, just enter your phrases in the general user interface. Only use this editor if you use Multi-Language.

Some text properties support Multi-Language. This editor allows you to enter your property values for each language. Supported properties are:

  • Table/Field Captions
  • Menu Text
  • Site Title and Footer Text
  • Table Page Names
  • Field Edit Tag Title
  • Field Error Message
  • Field Custom Message
  • Field Image Tag Alt
  • Field User Values

To edit these properties, click Tools -> Multi-Language Property Editor to open the editor. Alternatively, you can also click the small button next to above properties in the user interface to open.

Select a property in the Property pane on the left to edit, then enter your properties in unicode. For example, you can copy and paste from Word.

The editor supports import/export of the phrases (of the mutli-language properties only, not including the phrases in the language files):

Click the export button to export the phrases to a XML file so you can edit the file with text or XML editor or share the file with other project. Click thie import button to choose the XML file that you want to import so you can quicky use edited phrases or easily reuse other project's XML file.

Note Previously saved properties are displayed in bold font. Once you use this editor to save your unicode text, the saved unicode property values will always be used prior to the original property values (in the general user interface) . The original property value will only be used if unicode property value of the language cannot be found. If you want to edit the property, always go back to this editor. After editing and saving unicode properties, remember to re-generate the languages file and upload them again.

 

Notification Templates

The notification templates are also located in the subfolder "languages" under the PHPMaker folder (e.g. C:\Users\\\\AppData\Roaming\PHPMaker2025\languages):

  • ChangePassword.en-US.php
  • Notify.en-US.php
  • OneTimePassword.en-US.php
  • OneTimePasswordSms.en-US.php
  • Register.en-US.php
  • ResetPassword.en-US.php

As indicated by the file names, the above files are in English (en-US). To make notification templates in other languages, you can EITHER enter your translated template under [Language-Specific -> Templates](customscripts.html?id=language-specific-templates), OR copy and rename the files and translate the content to the your languages. Similar to XML language files, the translated files must be renamed as *\.\.php*. For example, the file *Notify.en-US.php* should be renamed as *Notify.es-ES.php* if the file is to be translated into Spanish. Do NOT change the first part of the original file name (e.g. *Notify*).

The email contents in the template can be customized, the template supports PHP tags and the following predefined variables:

``$Subject`` - Email subject
``$From`` - Sender email address
``$To`` - User email address
``$Table`` - Table name
``$Key`` - Primary key of record
``$Action`` - Action
``$UserName`` - User name for resetting password
``$ActivateLink`` - Link for activating account or resetting password
``$Account`` - User account (email or phone) for one time password
``$Code`` - One time password
``$Fields`` - Associative array, the key is the field name and the value is an object with only two properties, ``caption`` and ``value`` (for _Register.*.php_ only)

For example, the _Register.en-US.php_ is like:

**Notes** - **The email template files must be saved in utf-8 encoding.** - NOT all above variables are available in all notification templates, always refer to the original English (en-US) version as example. - If translated files not found during generation, they cannot be copied to the generated "lang" subfolder, the default English (en-US) version will be used as fallback during runtime.

 

Server Events

1. If you prefer to customize the language phrases by code, you can use the Language_Load server event. 1. If you want to change the email content by server event, use Email_Sending server event to customize the ``Content`` property of the Email object. 1. You can use the global function ``CurrentLanguageID()`` to get the current language ID and write your code accordingly. See Server Events and Client Scripts for more details.

 

 

 ©2002-2025 e.World Technology Ltd. All rights reserved.