Moodle

Editing language file that is not part of the package breaks language packet if not saved.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.8
  • Fix Version/s: None
  • Component/s: Language
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE

Description

If you edit a language packet (e.g. en_us) file that is not part of that language pack (e.g. countries.php), but then don't make any changes and thus don't save, an empty version of that file now exists in that language package, effectively breaking the package. In the case of the example (countries.php), users will no longer be able to register as the countries drop-down can no longer be populated.

  1. MDL-12465.patch.txt
    07/Jul/08 11:53 PM
    2 kB
    David Mudrak
  2. MDL-12465.patch.txt
    20/Jan/08 8:08 AM
    3 kB
    David Mudrak

Activity

Hide
David Mudrak added a comment -

Strange. Yes, in some cases, lang.php creates empty PHP files. But this should not break the lang pack as Moodle should use the value from parent language or the default English one respectively.

Are you getting any sort of error message? (please, turn debugging to ALL)

Show
David Mudrak added a comment - Strange. Yes, in some cases, lang.php creates empty PHP files. But this should not break the lang pack as Moodle should use the value from parent language or the default English one respectively. Are you getting any sort of error message? (please, turn debugging to ALL)
Hide
Mike Churchward added a comment -

I don't get any errors, but its easy to duplicate...

1) Set your site to a default language - I used 'en_us'.
2) Go into 'Admin / Language / Language editing'.
3) Select your default language (en_us).
4) Select 'Edit words or phrases'.
5) Select 'countries.php'. This will create a zero-sized 'countries.php' file in the 'Moodledata/lang/en_us_utf8/' directory.
6) Navigate away without changing or saving anything.
7) Now, try to register a user using email based registration with the default language (en_us). If you can select a language, make sure it is the one you are testing with (en_us). You can't register because the country list is empty.

Show
Mike Churchward added a comment - I don't get any errors, but its easy to duplicate... 1) Set your site to a default language - I used 'en_us'. 2) Go into 'Admin / Language / Language editing'. 3) Select your default language (en_us). 4) Select 'Edit words or phrases'. 5) Select 'countries.php'. This will create a zero-sized 'countries.php' file in the 'Moodledata/lang/en_us_utf8/' directory. 6) Navigate away without changing or saving anything. 7) Now, try to register a user using email based registration with the default language (en_us). If you can select a language, make sure it is the one you are testing with (en_us). You can't register because the country list is empty.
Hide
David Mudrak added a comment -

The problem is caused by lib/moodlelib.php :: get_list_of_countries(). It just simply checks the existence of countries.php and not the content of it.

In attached MDL-12465.patch.txt, there is a patch fixing it. The patch checks that (1) countries.php exists in current language pack and that (2) it defines the list of countries. Otherwise, it tries parent language or en_utf, respectively.

Assigning this to skodak to review the patch.

Show
David Mudrak added a comment - The problem is caused by lib/moodlelib.php :: get_list_of_countries(). It just simply checks the existence of countries.php and not the content of it. In attached MDL-12465.patch.txt, there is a patch fixing it. The patch checks that (1) countries.php exists in current language pack and that (2) it defines the list of countries. Otherwise, it tries parent language or en_utf, respectively. Assigning this to skodak to review the patch.
Hide
David Mudrak added a comment -

Petr, can you please review the patch? Skype me if you need it in different diff format. Thanks.

Show
David Mudrak added a comment - Petr, can you please review the patch? Skype me if you need it in different diff format. Thanks.
Hide
Petr Škoda (skodak) added a comment -

Is this still a problem? If yes could you please make a new patch in unified format? thanks

Show
Petr Škoda (skodak) added a comment - Is this still a problem? If yes could you please make a new patch in unified format? thanks
Hide
Mike Churchward added a comment -

It is still an issue in 1.8. I checked the latest code today. In 1.9, the zero size file gets created, but the drop-down list is still populated okay. I think that is because 1.9 uses a different mechanism to resolve locally edited language strings.

Show
Mike Churchward added a comment - It is still an issue in 1.8. I checked the latest code today. In 1.9, the zero size file gets created, but the drop-down list is still populated okay. I think that is because 1.9 uses a different mechanism to resolve locally edited language strings.
Hide
David Mudrak added a comment -

The patch in unified format.

Show
David Mudrak added a comment - The patch in unified format.
Hide
Petr Škoda (skodak) added a comment -

we are very close to release, moving the target, sorry...

Show
Petr Škoda (skodak) added a comment - we are very close to release, moving the target, sorry...
Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
David Mudrak added a comment -

Closing, the translation is maintained now by AMOS.

Show
David Mudrak added a comment - Closing, the translation is maintained now by AMOS.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: