Blue Static

Localization in Bugdar 1.2.2

Posted on March 24, 2008 at 03:22 UTC, filed under the category Bugdar. Tags: Bugdar, Gettext, localization,

Some people have been running into issues with the PHP Gettext extension. The problem is that to use the extension right, it requires that a lot of server environmental variables to be tinkered just right. And I’m not even sure it works on Windows (to be honest, I don’t test on Windows servers at all).

However, I was looking at the MO format specification and it is pretty easy to parse, so I wrote a custom implementation of Gettext in PHP. This custom implementation does not rely on the Gettext extension at all, so this will also solve the problem for people who need to localize and don’t have the extension installed.

Because I didn’t want to introduce such a sweeping change in a point-release, this is currently disabled. With a hidden toggle and a simple query, you can try out the new localization feature if Gettext is giving you trouble.

Steps to enable the new MOReader localization system:

  1. Open includes/config.php and add this line anywhere in the file:

$debug = 1;

  1. Go to Administration –> Bugdar Settings and find the setting labeled “Custom Gettext Localizer” and enable it.

  2. Run this SQL query to clear the template cache (and thus all the calls to the old localization system):

TRUNCATE TABLE template

  1. Back in includes/config.php, remove the line you added above. Debug mode should not be used in a production environment.

This hidden toggle will disappear in 2.0 because it will be the default (and only) translation system. But like I said, it was too big to make the default in a maintenance release. You will only have to enable this once (it will stick across upgrades, etc.). If you want to disable it, just follow the above steps, but just flip the switch to “No.”

Comments

Comment by maty1206 on 2009-03-17 01:34:50 +0000

Great! I had followed oyur instructions and now my translation works properly!

I appreciate it!