Question regarding string replacements

Hi folks,

I had a closer look at string replacements today.

There is one thing that I couldn’t figure out even after quite some time. I can find the following code in “modules\School Admin\rollGroup_manage.php“:

$page->breadcrumbs->add(__(‘Manage Roll Groups’));

Despite of not having set any string replacement for that entry, it shows as “Manage Form Groups”.

Can you explain this to me?

Kind regards,
Roman

Hi Roman,

It may be that you’re using the en_GB locale, where they’re called Form Groups, and in the en_US locale they’re called Roll Groups. We do aim keep the codebase written in en_GB by default, but over the years there are a couple strings that got mismatched between the two locales. Since this one in particular has already been translated many times, is was best to keep the Roll Group string encoded in the core, and use the language file to translate it into Form Group. If you’re string-replacing it to something else entirely, couldn’t hurt to add both cases to your replacements :smile:

Hi Sandra,

Yeah, it’s true! I did the installation using en_GB locale.

I tried to switch to american terminology using menu System Admin> Manage Languages. I installed en_US locale and made it my default as well.

The terminology remains the same. Still I always see “form group” instead of “roll group”.

It seems that my system is somehow stuck to en_GB in terms of terminology.

Can you reproduce this?

Kind regards,
Roman

Hi Roman,

On your server do you have en_US installed as a locale?

I am not familiar with using gettext via WAMP, or on Windows at all, I’m afraid.

Thanks,

Ross

Hi Ross,

Yeah, the download of the translation file for en_US worked (i18n\en_US\LC_MESSAGES\gibbon.mo).

Translation seems to work since I get UK terminology. I’m just wondering why I keep getting the same translations after setting default to US.

I noticed something strange though. If I remove all translation files, e.g. by deleting folder i18n the terms are still translated into UK terms independent of choosing UK or US. Isn’t this weird?

Are you able to reproduce this?

Kind regards,
Roman

Hi Ross,

I’m still stuck here!

I added another language today, which is French, after en_GB and en_US it’s the third language.

Things are still stuck in en_GB, e.g. “Manage Roll Group” is translated into “Manage Form Group”. This is happening independently from the language selected at login, e.g. fr_FR.

Can it be, that I’m missing something here? Why is it, that translation is still working even if I delete the translation files as mentioned in the post above?

And can you also try to reproduce this?

Kind regards,
Roman

Hi Roman, I’ve been really busy recently, and so not had a chance to take a look. I’ll try and do so within the next 48 hours and then get back to you. Thanks! Ross.

Hi Ross,

I was able to partly find explanations.

Wamp does actually have a bug, which is that locale cannot be changed using php as it should be. Instead Wamp takes and locks to the locale set for Windows.

In my case Windows was set to en_GB and therefore Gibbon was stuck to those translations no matter what language I chose at login.

If I want to switch to a different language I can’t do it at Gibbon login. Instead I can do it using the Windows Control Panel by changing the default language to the one I like.

What remains a mystery to me is the problem mentioned in the two previous posts above.

How come, that I can delete translation files at it doesn’t affect Gibbons translations?

Apparently they are cached somewhere probably to improve performance. Can you give me some insights on what is happening here?

Kind regards,
Roman

Hi Roman,

The strings for each script in Gibbon are written in en_GB by default, so no translation files are required to use them, and if translations are missing this is the fallback locale that is displayed. This may help explain the behaviour you’re seeing.

That sounds like a pretty frustrating bug/limitation for WAMP. I guess this means you can only have one language available at a time, by pre-selecing it in Windows config? :confused: If you come across any solutions to this please let us know so we can add this to the docs for other wamp users.

Thanks!