Manifesto User Manual 5.04
Prev: 5.03 Newswire column commentsNext: 5.05 Moving to a new server
Localization
Method
Manifesto has been completely rewritten for version .94 to support full internationalization. After investigating a number of different methods for supporting multiple languages, it was decided that the GNU gettext utility was the most mature, comprehensive method for offering localization options. PHP has internal functions to support gettext (though it must be compiled into PHP in advance), and this method permits the most unobtrusive method for internationalization that I've seen.
Calling gettext is almost as simple as an "echo" statement, using only a single character "_" to call the function, so you have fully localized text with a simple statement like
echo _("This string is easy to display in any language");
Gettext works on as a simple hash table lookup, as do most internationalization hacks, but it provides several advantages:
- The base language text is still included in the source code, so the code remains relatively readable without needing to refer to the value of a variable like
$userLoginFailureMessage. - The translated localization files are compiled into machine-readable format for faster access.
- You're not storing a million variable names from a lookup file every time a page loads. There are 650+ strings of static text in Manifesto, which would make for an unwieldy variable file!
In addition to gettext translation of static strings, the entire Date class has been re-written to support localized Date and Time formats, so even calendar events and posting dates are displayed in local format. Pulldown menu with the names of months? Fully localized. It's cool.
Articles now have a language field to indicate their language and character set. User accounts can specify their default language choice. Information documents, the extensible "extra pages" of Manifesto, now support a language field, so you can easily provide things like your mission statement, editorial policy, and meeting dates in whatever languages you choose!
Translators needed!
Currently, Manifesto uses US English as its default language. Translators are desperately needed to provide translations of the 800+ static text strings in the code. Don't be daunted by the quantity -- many of these strings are single words, plural versions of words, etc. There's some work to be done, but hey, you could have your translations appear on dozens of sites around the world!
The translation process itself is relatively simple:
- Download the master .po file in English
- Read the guidelines below for some pointers
- Insert your translation between the empty quotes on the "msgstr" line below the English text
- Send the translated file back to support(at)dadaimc.org to be compiled into the final release
I would like to offer support for any language currently supported by Linux installations, from the Indo-European languages to Greek, Turkish, Hebrew, Arabic, etc.
Guidelines
- The format of the PO file is described here.
- Be sure to add the proper attribution information at the top of the file. It's pretty straightforward, but there's more information about it here. (look at section 5.2 especially)
- Bear in mind the length of your translation, where you have some flexibility. Especially for things like button text, where the length of your translation will have a direct effect on the size of the button.
- The variations in static text in Manifesto have been condensed wherever possible, so that different pages often take advantage of the same strings. It is possible that you may find situations where this was possible for me to do in English, but it cannot be done in the language you are using, e.g. "Edit", which is both a verb ("to edit") and a noun ("I made an edit to my article"). I've tried to avoid this, but if you find such an instance, let me know at support(at)dadaimc.org
- The manual for GNU gettext has tons and tons of information.
- You might want to join the Manifesto mailing list if you haven't already.
- If anything isn't clear, ASK!
Prev: 5.03 Newswire column commentsNext: 5.05 Moving to a new server
