Skip to content
sproctor edited this page Apr 7, 2013 · 3 revisions

Translation Guide

Introduction

This page contains the information on how to get localization working and how to update translations and create new translations.

Setup

In the install directory is a script translate.php. Execute that script either on the command line by running cd php-calendar/install; php translate.php or by visiting http://example.com/php-calendar/install/translate.php

If your server is Windows, you may need http://gnuwin32.sourceforge.net/packages/gettext.htm or http://www.cubicweb.org/blogentry/565331 . If those do not work, you may be able to create the .mo files locally (using one of those programs).

You must have the gettext extension for PHP for the translations to work. If your server is running Linux, you must have the appropriate locales installed. For Debian/Ubuntu this may require running apt-get install locales-all.

Updating a translation

The translations are now handled through transifex.com. Visit https://www.transifex.com/projects/p/php-calendar/ for more to work on translations.

The following section is outdated, but if you don't want to use transifex, it's still useful.

If you find an error or omission in a translation, you can fix the translation. The translation files are located at: php-calendar/locale/{language}/LC_MESSAGES/messages.po

There is an untranslated version of that file at: php-calendar/docs/messages.po

That file may not be the newest. To generate a new version of it, use xgettext. The command is something like: cd php-calendar; xgettext includes/*.php

Merge the existing translation with the new template (if necessary). msgmerge oldmessages.po newmessages.po

Edit the messages.po file. http://www.poedit.net/ has an editor, or you can use a standard text editor.

Re-run translate.php. For the new translations to take affect, you may need to restart your webserver. gettext caches the .mo files.

Creating a new translation

Visit https://www.transifex.com/projects/p/php-calendar/ to create a new translation.

The following section is outdated. It's no longer the preferred way of translating but still useful if you don't want to use Transifex.

Create the directory: php-calendar/locale/{language}/LC_MESSAGES where {language} is the 2-letter abbreviation for the new language.

Translate the untranslated messages.po file. See updating a translation for more information on this.

Put the translated messages.po file in the directory you created.

Edit php-calendar/includes/setup.php to add your language to the list of languages. There is a switch statement somewhere around line 137. Use the existing cases as a template and add a new case for your language. Keep in mind that it must be UTF-8 (or 7-bit ASCII), since that is the character set used to display PHP-Calendar.

Clone this wiki locally