Moodle

Editing the country list in a language does not change the list in-site

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.5
  • Fix Version/s: 1.9.6
  • Component/s: Language
  • Labels:
    None
  • Environment:
    N/A - Tested on Server 2003 Apache and Wamp Apache
  • Database:
    Any
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

When doing the following

  • Log in as admin
  • Go to administration
  • Language
  • Language editing
  • Edit words or phrases
  • Countries.php
  • Find Taiwan, Prov...
  • Remove the ', Prov...' bit
  • Press 'Save countries.php'

Here the differences start. On the live server it says

Changes saved (C:\data\languagehouse\moodledata/lang/en_utf8_local/countries.php)

However it also says

No missing strings

On the test server it says

Changes saved (C:\wamp\moodledata/lang/en_utf8_local/countries.php)

However it also says

Number of missing strings: 1

Taiwan is highlighted green as a missing string and DOES have the new edited text.

The trouble is that this still doesn't change the country list in edit profile.

[What needs to change]

In moodlelib.php around line 5739

if (!file_exists($CFG->dirroot .'/lang/'. $lang .'/countries.php') &&
!file_exists($CFG->dataroot.'/lang/'. $lang .'/countries.php')) {

Must change to

if (!file_exists($CFG->dirroot .'/lang/'. $lang .'/countries.php') &&
!file_exists($CFG->dataroot.'/lang/'. $lang . '_local' . '/countries.php')) {

OR

When creating the folder in moodledata\lang the file should be called en_utf8 instead of en_utf8_local

Activity

Hide
Graham Robinson added a comment -

Some context to this bug is missing as it was copied from a forum. Some background - http://moodle.org/mod/forum/discuss.php?d=117990#p560021

Show
Graham Robinson added a comment - Some context to this bug is missing as it was copied from a forum. Some background - http://moodle.org/mod/forum/discuss.php?d=117990#p560021
Hide
Graham Robinson added a comment -

With some further testing it seems that you'd either need to find the function that displays the country (i.e. not just the country list) or use the second suggestion

Show
Graham Robinson added a comment - With some further testing it seems that you'd either need to find the function that displays the country (i.e. not just the country list) or use the second suggestion
Hide
Tim Hunt added a comment -

Ah, good detective work.

Your first solution is approximately right, but actually you need to check both locations under dataroot, and we should also check both locations under dirroot. That is, the logic here should be identical to the similar logic in the get_string function.

(And, in Moodle 2.0, this function needs to be moved into the string_manager class.)

Show
Tim Hunt added a comment - Ah, good detective work. Your first solution is approximately right, but actually you need to check both locations under dataroot, and we should also check both locations under dirroot. That is, the logic here should be identical to the similar logic in the get_string function. (And, in Moodle 2.0, this function needs to be moved into the string_manager class.)
Hide
Tim Hunt added a comment -

I'll try to find time to fix this soon.

Show
Tim Hunt added a comment - I'll try to find time to fix this soon.
Hide
Larry M Elchuck, Ph.D. added a comment -

Was this fixed Tim?
tnx ... L

Show
Larry M Elchuck, Ph.D. added a comment - Was this fixed Tim? tnx ... L
Hide
Tim Hunt added a comment -

As you can see from the status of this bug, No.

It is still on my list but I have been busy. I'll see what I can do. Thanks for the reminder.

Show
Tim Hunt added a comment - As you can see from the status of this bug, No. It is still on my list but I have been busy. I'll see what I can do. Thanks for the reminder.
Hide
Larry M Elchuck, Ph.D. added a comment -

Thanks Tim ... This issue is bigger than the countries example cited above .... it occurs for all files I have tried to create a local utf8 update (changing "courses" to "IHE modules" .... as this is what the institution calls it's courses). .. cheers... L

Show
Larry M Elchuck, Ph.D. added a comment - Thanks Tim ... This issue is bigger than the countries example cited above .... it occurs for all files I have tried to create a local utf8 update (changing "courses" to "IHE modules" .... as this is what the institution calls it's courses). .. cheers... L
Hide
Tim Hunt added a comment -

Fixed in Moodle 1.9.6.

Note there is a subtlety to do with parent languages. For example fr_ca does not supply a countries.php file because it is happy to use the one from fr. Therefore, if you want to rename a country in fr_ca, you have to edit the countries.php file for fr.

I'm working on 2.0 now.

Larry, I don't understand your issue. I'm sure other translation work there, or we would have heard about it. If you are still having problems, please post in http://moodle.org/mod/forum/view.php?id=43, and then create a new bug report if necessary.

Show
Tim Hunt added a comment - Fixed in Moodle 1.9.6. Note there is a subtlety to do with parent languages. For example fr_ca does not supply a countries.php file because it is happy to use the one from fr. Therefore, if you want to rename a country in fr_ca, you have to edit the countries.php file for fr. I'm working on 2.0 now. Larry, I don't understand your issue. I'm sure other translation work there, or we would have heard about it. If you are still having problems, please post in http://moodle.org/mod/forum/view.php?id=43, and then create a new bug report if necessary.
Hide
Tim Hunt added a comment -

See discussion here: http://moodle.org/mod/forum/discuss.php?d=134072

In 2.0 we have more scope with what we do, and thinking about it, I don't know what is best. Opinions please.

Show
Tim Hunt added a comment - See discussion here: http://moodle.org/mod/forum/discuss.php?d=134072 In 2.0 we have more scope with what we do, and thinking about it, I don't know what is best. Opinions please.
Hide
Tim Hunt added a comment -

OK. The attached patch is a nice solution for Moodle 2.0. There is a new admin option 'All country codes' on Site Administration ? Location ? Location settings. That has help text:

"This is the list of countries that may be selected in various places, for example in a user's profile. If blank (the default) the list in countries.php in the standard English language pack is used. That is the list from ISO 3166-1. Otherwise, you can specify a comma-separated list of codes, for example 'GB,FR,ES'. If you add new, non-standard codes here, you will need to add them to countries.php in your language pack."

The effectively it does get_string on each name in the list of codes - except that it uses a more efficient implementation that is about 10 times as fast. That removes all the anomalies about editing country names compared to editing other strings.

Review please.

Show
Tim Hunt added a comment - OK. The attached patch is a nice solution for Moodle 2.0. There is a new admin option 'All country codes' on Site Administration ? Location ? Location settings. That has help text: "This is the list of countries that may be selected in various places, for example in a user's profile. If blank (the default) the list in countries.php in the standard English language pack is used. That is the list from ISO 3166-1. Otherwise, you can specify a comma-separated list of codes, for example 'GB,FR,ES'. If you add new, non-standard codes here, you will need to add them to countries.php in your language pack." The effectively it does get_string on each name in the list of codes - except that it uses a more efficient implementation that is about 10 times as fast. That removes all the anomalies about editing country names compared to editing other strings. Review please.
Hide
Martin Dougiamas added a comment -

Nice! +1 from me!

Show
Martin Dougiamas added a comment - Nice! +1 from me!
Hide
Tim Hunt added a comment -

Revised patch after a CVS update.

Show
Tim Hunt added a comment - Revised patch after a CVS update.
Hide
Tim Hunt added a comment -

Yet another patch attempt.

Show
Tim Hunt added a comment - Yet another patch attempt.
Hide
David Mudrak added a comment -

My only questions discussed in Jabber. I like it. Thanks for you work Tim.

Show
David Mudrak added a comment - My only questions discussed in Jabber. I like it. Thanks for you work Tim.
Hide
Tim Hunt added a comment -

And now fixed in 2.0 too. Thanks for the review Martin and David.

Show
Tim Hunt added a comment - And now fixed in 2.0 too. Thanks for the review Martin and David.

People

Vote (0)
Watch (7)

Dates

  • Created:
    Updated:
    Resolved: