My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for

Translations & What is i18n?

We'd like to see K2 translated to as many languages as possible, and to do that, we need your help. This page contains instructions on how to get started with translating K2 and how we deal with translations in general. If you have any questions, let us know over at the support mailing list.

i18n is short for 'internationalization' (the 18 being the 18 letters between the i and the n in internationalization), and the general denomination for the translation process used for K2. You can read more about the process at WordPress's translation page.

The next release of K2, version 1.1 will most likely be the first release to include current translations.

How to get WP/K2 translation working

K2 uses the same language set as WordPress (read more) and the appropriate language file (the .mo file) for K2 must be present in the /wp-content/themes/k2/languages/ folder in K2. Translations can be found at the K2 i18n repository.

You only need the .mo file for your locale to get the translation working. You can also download the .po file (which is editable) to change anything you like in the translation.

To set the language you want for Wordpress (which plugins, and themes like K2 also pick up on) simply edit your wp-config.php file and add (or change) the following line:

define ('WPLANG', 'nl_NL');

Instead of ‘nl_NL’ (which is for Dutch) use the country code you need, such as ‘es_ES’ (for Spanish). The naming is done as follows:

  1. ISO 639-1 language code (lowercase) (click for list, use the 2 letter one)
  2. an underscore
  3. ISO 3166-1 alpha-2 country code (uppercase) (click for list)

To have the rest of your Wordpress installation in your own language, follow these instructions.

How To Translate K2

There are other ways to perform the actual translation, however the step-by-step outlined here, should work on most platforms:

  1. Download the latest k2.pot file, which contains the text that needs translating.
  2. Download Poedit. This program is used for doing the actual translation.
  3. Fill in any configuration questions asked by Poedit.
  4. Choose File > New Catalog From POT File... and select the k2.pot file from the first step. Poedit may throw an error; that's okay, it'll work regardless.
  5. Fill in the Project Info (name, country, email, etc)
  6. Special note on the plural forms: The .pot file ships with "nplurals=INTEGER; plural=EXPRESSION;". See below to learn how to input the correct form for your language here.
  7. and click OK.
  8. Read more about the naming conventions before you save your .PO file (the .PO file is your project file, the .MO file, which is also automatically saved, is the binary file K2 needs).
  9. The Poedit window should now should the original K2 strings on the left and an empty column on the right.
  10. Select a string and start translating.
  11. Test your translation (as described above) for layout issues as you go along, to save yourself the trouble later on.
  12. If the language you're translating to doesn't already exist in the K2 i18n repository, let us know and we'll see about setting you up with access to the repository and inclusion of your translation into the core of K2.

And that's how that's done.

How to Update From a New .POT

Whenever something changes in K2 that requires new translations, we generate a new .POT file and put it in the subversion repository. Here's how you update your existing .PO and .MO files when a new one comes out:

  1. Get the .POT file.
  2. In Poedit, with your .PO file open, go to Catalog > Update from POT file... and select the new .POT file.
  3. Possibly, you might need to adapt your file for Plural Forms (again).
  4. Poedit will show you new and obsolete strings.
  5. The new strings will be at the top of Poedit for your convenience.
  6. To delete obsolete strings, go to Catalog > Purge deleted translations

That's that.

Target SVN or Releases?

We suggest going with the actual releases. In the past the release schedule has been a little erratic, and as a consequence nightlies were the best source for the latest K2. But from now on the releases will be the safest bet (to maintain ones sanity).

Right now that means targeting K2 version 1.0.3.

You can get the k2.pot for 1.0.3 here. When you're done you can share it via the 1.0.3 translation ticket. Note that K2 1.0.3 does not yet use plural forms, so no need to worry about those (yet).

(If this is your first attempt at getting your translation included, it might be better to post on the K2 mailing list)

How to share your translation with us (and others)

For now, upload it somewhere and post the links on the K2 mailing list. If it’s a good one, we’ll add it to the SVN which means it’ll be included in the next release!

Plural Forms

Wordpress (theme) translations allow for words to be translated in their singular and plural forms. Because different languages have different plural forms, Poedit needs to be told what kind of plural forms your language follows.

Before creating new catalog from pot template in poedit, you have to manualy open the .POT file (in a text editor) and search for any instance of 'msgid_plural'. Below that add as many plurals your language has. For example, Croatian has 3, so you'd end up with 3 lines as follows:

msgstr[0] ""
msgstr[1] ""
msgstr[2] ""

In your "Project Info" screen, simply replace nplurals=INTEGER; plural=EXPRESSION; with the correct code for your language:

  • Danish, Norwegian, Swedish, Finnish, Estonian, Dutch, German, Italian, Portuguese, Spanish, Esperanto, Hungarian, Greek, Hebrew, Faroese, English:
  • Plural-Forms: nplurals=2; plural=n != 1;
  • French, Brazilian Portuguese:
  • Plural-Forms: nplurals=2; plural=n>1;
  • Gaeilge (Irish):
  • Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;
  • Slovak, Czech:
  • Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;
  • Latvian:
  • Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
  • Lithuanian:
  • Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
  • Romanian:
  • Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;
  • Croatian, Serbian, Russian, Ukrainian:
  • Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
  • Slovenian:
  • Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
  • Polish:
  • Plural-Forms: nplurals=4; plural=(n==0 ? 0 : n==1 ? 1 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 2 : 3);

  • Turkish, Japanese, Korean, Vietnamese:
  • Plural-Forms: nplurals=1; plural=0;

(compiled by Kreso & maciej.szudejko, from http://www.gnu.org/software/gettext/manual/gettext.html%23Plural-forms , thanks!)

Powered by Google Project Hosting