Internationalization 1.0

From SubjectsPlus
Jump to: navigation, search

Version 1.0 of SubjectsPlus is using gettext to translate strings. This is a standard way of handling internationalization, and should work much better than the previous hacky way.

There is now a French version of the beta ready, thanks to Benoit H!

How to

Make sure there is a translation for your language

Look in sp/assets/locale/ Do you see an appropriate folder for your language? If so, check inside and see if there is a messages.mo file in there. If so, you should be good. If there is just messages.po, it hasn't been translated or compiled yet. You can try sending a message to the google group to see if it has already been translated (but not yet shared back), or you can write your own translation--making sure to share it back again!

Make sure you have the gettext() extension on your server

You can try doing this to check: https://phptal.org/manual/en/split/gettext.html. Alternately, you can just try turning it on with the instructions below and seeing if it works :)

Make sure your locale (i.e., language) is on your server

One user had an issue with gettext on ubuntu. This helped: https://stackoverflow.com/questions/5257519/cant-get-gettext-php-on-ubuntu-working

They just needed to run the following to get French running on their server:

 sudo locale-gen fr_FR
 sudo service apache2 restart

Set up the translation in sp/control/includes/config.php

Look for the section that begins

 // I18N support information here

There should be a section of commented out code.

1. Uncomment everything except the comments :)

2. Change the language to the appropriate one. If you want French, changed the $language to this:

 $language = 'fr_FR';

3. Go to a page in the admin, e.g., control/admin/index.php. Do you now see the text in French?

If it isn't working:

1. Make sure there is already a translation for your desired language in assets/locale/ As of today (April, 2016), there are only 3 languages in place: French, Spanish and Russian. If you have another translation, please share it back for other SubjectsPlus users!!!

2. If there is a language, but uncommenting and changing the $language didn't work, try restarting your web server.

3. Still not working? Try hard coding the $LocalePath. E.g.,

 $LocalePath = "/home/myname/www/sp/assets/locale";

Ron's Gettext Instructions