Languages

en and en_us

 
Picture of Robert Brenstein
en and en_us
 
Is the American English no longer a child of English as the language pack or has the operation of the multilang filter changed? I am used to provide multilang strings for "en" and see the same when I select "en_us" as the language. However, I just set some strings in MoodleCloud and I see "en" strings only when I select English but not when I select American.
 
Average of ratings: -
Picture of Robert Brenstein
Re: en and en_us
 
Further troubling discovery:

when en_us is selected as the language in the language popup menu in moodlecloud, the multilang filter displays the entry for the first language in the entry not the default language.

To be more verbose:

I have span tags for de and en in a field. When de or en is the active language, the content is displayed as expected. When en_us is the active language, I see the text for de not en -- en should be shown because it is both the parent language and the default language for this site.

If I add a span block for pl before the span block for de, then the Polish text is shown when the active language is en_us. pl is shown as expected when pl is the active language.

What is going on ???


 
Average of ratings: -
Picture of Robert Brenstein
Re: en and en_us
 
I just confirmed that the problem described above is not specific to the moodlecloud. I replicated this behavior in the local Moodle at the university, which I believe is version 2.9.
 
Average of ratings: -
Picture of David Mudrák
Re: en and en_us
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersPlugins guardiansTestersTranslators

Thanks for raising this Robert. Reading the code, I have a suspicion. The English (en) is implicit parent of all language packs in Moodle (so if a string is not translated, the English original is used). In most places in the code, if the parent language is reported to be English (en), it is actually interpreted as if there was no parent language. And I believe this is what is happening here.

The code here https://github.com/moodle/moodle/blob/v3.1.1/filter/multilang/filter.php#L101-L108 finds that there is no "en_us" multilang part defined and it does not use the "en" part as expected, but it uses the first one on the list.

As a solution, I would recommend to use the English part as the first one in the multilang block.

 
Average of ratings: -
Picture of Robert Brenstein
Re: en and en_us
 
Thanks for checking the Code, David. I bet you are right about the issue. What you suggest as the solution is actually a workaround. Relatively simple and effective but nonetheless a workaround which will work only if there is a single child language used on a site.

I just filed a tracker issue for this: MDL-55197
 
Average of ratings: -
Alex Briones
Re: en and en_us
 

Just wondering if you installed Moodle 3.1. We are having some issues between UK English and US English for words such as "enrolled" and "enroled." I am wondering if you have examined the issue you reported in 2.9 on 3.1?

 
Average of ratings: -
Picture of Robert Brenstein
Re: en and en_us
 
I did not check in 3.1 but spelling issue is definitely a different problem. When I select en_us, I do get American spelling alright. I mean the Moodle interface. The problem I reported in this thread was about user-provided texts.
 
Average of ratings: -