Do you want to make a web application (quickly and instantly) which has the content in multi language using PHPMaker? When we are talking about a web application, then let's to be focus on a web application which has the ability to access the multi tables that integrated between one to another, as well as when we are making a desktop application which has the ability to access several tables that integrated between one to another. Also, let's to be focus on how to generate those content pages using a code generator tools, instead of using CMS such as WordPress, Drupal, or Joomla. We are not also talking about how to use the framework such as CodeIgniter, Symfony or Zend.
Well, did I mention PHPMaker? Yep. PHPMaker has the ability to generate your website which has the unlimited pages only within a few seconds (it's still counted in a few seconds even it generates within a few minutes!). If you want to generate your web content only in a few seconds, then you should use PHPMaker. It also has the ability to make your website to support for multi language content. Since PHPMaker 8+, now it has supported for multi language in user values. Suppose you have a field which has a field type of enum, and it has a value of "one, two, three", then you can translate those user values into your language!
If you want to use the Multi Language feature in PHPMaker, then follow these steps:
- First of all, make sure you have already created the .xml language file in your languages. You can copy the C:\Program Files\PHPMaker 8\languages\english.xml file to another file name in your language. For example, I want to use Indonesian language in my web application, so I copy that file to indonesian.xml.
Open your .xml file (in that example above, I open indonesian.xml file), and then I change the code that located on the second line from:
<ew-language date="2011/1/17" version="8.0.0" id="en" name="English" desc="English" author="e.World Technology Ltd.">
<ew-language date="2011/8/21" version="8.0.0" id="id" name="Indonesian" desc="Indonesian" author="Masino Sinaga">
This information will be needed by PHPMaker to identify your languages you use in your web application.
Still in the indonesian.xml file, translate all the strings after the value= into your language.
From that example above, then I modify this following code:
<phrase id="ActionDeleted" value="Deleted"/>
<phrase id="ActionDeleted" value="Dihapus"/>
Do the same way with the other phrases, and so on.
- Next step, open your PHP Maker project (.pmp) using your PHPMaker application.
- Click on PHP tab, and make sure you have already click on the General Options sub-tab.
Give a check mark at the Multi-language, and you will see a message box appears that informs you about "Note that data stored in your database must be in unicode or utf-8 for multi-language to work properly. Project charset must be 'utf-8'. To select languages, click Tools->Languages". That message inform us that if we want to use the multi language feature in PHPMaker, then make sure our database must be in unicode or support for "utf-8" charset type, especially if you are using the languages such as Arabic, Chinese, Thailand, Japan, Korea, etc.
Next step, click on OK button to close that message box.
- Click on Tools -> Languages, then make sure you have already given a check mark at the languages you want to use. Click OK button to save the changes.
- (Re)Generate all your script files using PHPMaker.
Of course, you can add your own phrases beside the ones that have been already exist in the .xml language files. Each time you want to add your own new phrases (based on the example above), then you have to add them into the english.xml and indonesian.xml file. You can see and learn about how to write the code for usage of the language phrases in the .php generated files.