News Archive
PhpRiot Newsletter
Your Email Address:

More information

Making Create.js more international

Note: This article was originally published at Planet PHP on 21 April 5000.
Planet PHP

We're now making good progress at releasing the big 1.0 of Create.js soon. The various CMS integrations - from Symfony CMF to TYPO3, and possibly Drupal and many others - have brought us a lot of new features and bug fixes, and will ensure a wide international audience for this inline editing toolkit.

To make things nice for the users, it is also important that Create.js speaks their language. For this, I recently implemented localization features into the system.

This actually shows the power social networks: I tweeted about localizing Create.js, and within a day we had a nice selection of translations available, consisting of Czech, Danish, German, Spanish, Finnish, French, Italian, Dutch, Norwegian, Polish, Brazilian Portuguese, and Russian. Thanks again for everybody who contributed!

Running Create.js in your own language

So, now that the translations are in, how do you actually run Create in your language? There are two options.

First of all, Create.js takes the default language from the language of the document. So if you have something like this in your page, then Create will be in Finnish:

The language codes here follow the ISO 639-1 standard.

There are some situations where you may want to use a different language for the user interface than the one of the page itself. In these cases you can also pass the language to Create on instantiation:

jQuery('body').midgardCreate({ // Other options here language: 'fi' });

Translating Create.js

If you would like to translate Create into your own language, it is quite easy. Simply fork the GitHub repo, add a new locale file (it is probably easiest to start from the English one), translate the string values, and send a pull request.

Of course, the number of strings in Create.js will change over time, and so, if you make a translation, it would be a good idea to also subscribe to the mailing list. I will send notifications whenever there are new strings needing translation.

The current set of messages should be enough for the features of the 1.0.0 release.