Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on Elgg 1.8: with system cache enabled language files with more than 2 characters in filename are not recognized #7187

Closed
iionly opened this issue Aug 31, 2014 · 3 comments

Comments

@iionly
Copy link
Contributor

iionly commented Aug 31, 2014

See discussion: https://community.elgg.org/discussion/view/1852424/elgg-1819-isnt-recognizing-pt-br

If you have system cache enabled, language files don't work if their name has anything else than lowercase letters (e.g. hyphens, underscores, upper case letters).

If the language (for example pt_br) has been selected with system cache disabled, it is still used after system cache is enabled. But you wouldn't be able to re-select it again, if you switched to another language and new users can't select it at all (if the site's language isn't pt_br).

The problem exists on:

  • 1.8.19 (since 1.8.14)
  • 1.9 (1.9.0-rc.7)

We should choose a language code standard in order to fix this properly. See #6856

@ewinslow
Copy link
Contributor

ewinslow commented Sep 1, 2014

Thanks so much for your research into this, @iionly. Wouldn't be too much to ask to narrow it down to a specific Elgg version or even a particular commit?

@iionly
Copy link
Contributor Author

iionly commented Sep 1, 2014

It's broken since Elgg 1.8.14. The problem was introduced by the fix for #4840 (see 58ebe3f).

I think the problem is in engine/lib/languages.php in function reload_all_translations():

if (preg_match('/([a-z]+)\.[^.]+$/', $filename, $matches)) {

Underscores are not taken into account (and also no upper case letters in language file names).

@juho-jaakkola
Copy link
Member

Is there a reason why cache handler allows only those characters? Could we just allow more?

Edit: the cache handler already allows those characters: https://github.com/Elgg/Elgg/blob/1.8/engine/handlers/cache_handler.php#L47

So yes, it seems like we should allow those characters also in the language codes.

juho-jaakkola pushed a commit to juho-jaakkola/Elgg that referenced this issue Sep 3, 2014
Name of a cached language file can now have the following structure:
 - language code (2-3 lowercase alphabets)
 - underscore followed by regional designator (2 lowercase alphabets)

Fixes Elgg#7187
juho-jaakkola pushed a commit to juho-jaakkola/Elgg that referenced this issue Sep 3, 2014
Name of a cached language file can now have the following structure:
 - language code (2-3 lowercase alphabets)
 - underscore followed by regional designator (2 lowercase alphabets)

Fixes Elgg#7187
juho-jaakkola pushed a commit to juho-jaakkola/Elgg that referenced this issue Sep 3, 2014
… codes

Name of a cached language file can now have the following structure:
 - language code (2-3 lowercase alphabets)
 - underscore followed by regional designator (2 lowercase alphabets)

Fixes Elgg#7187
jeabakker pushed a commit to jeabakker/Elgg that referenced this issue Sep 17, 2014
… codes

Name of a cached language file can now have the following structure:
 - language code (2-3 lowercase alphabets)
 - underscore followed by regional designator (2 lowercase alphabets)

Fixes Elgg#7187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants