OneSky Dev

How to localize PHP applications

Tutorial from PHP.NET with Gettext

http://php.net/manual/en/book.gettext.php
You may use sprintf() to handle variables like %s.

Examples:

locale/en_US/LC_MESSAGES/app.po
msgid "hello_name"
msgstr "Hello %s"

msgid "home"
msgstr "Home"

msgid "person"
msgid_plural "people"
msgstr[0] "1 person"
msgstr[1] "%d people"
locale/zh_TW/LC_MESSAGES/app.po
msgid "hello_name"
msgstr "%s你好"

msgid "home"
msgstr "首頁"

msgid "person"
msgid_plural "people"
msgstr[0] "1個人"
msgstr[1] "%d個人"