plp050452 / simplesamlphp

Automatically exported from code.google.com/p/simplesamlphp
Other
0 stars 0 forks source link

Language related patches #463

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Purpose of code changes on this branch:

1. setLanguage.patch: add $setLanguageCookie option to 
SimpleSAML_XHTML_Template::setLanguage() to allow setting 
SimpleSAML_XHTML_Template::$language without setting language cookie in order 
to enable the same behaviour in custom getLanguage function as in original.

2. getAcceptLanguage.patch: convert HTTP_ACCEPT_LANGUAGE to lower case, because 
some browsers send region subtag in uppercase (e.g. Chrome: pt-BR), and some in 
lowercase (e.g. Firefox: pt-br). According to 
http://www.w3.org/International/articles/language-tags/ there is only 
convention for this, so IMO it's best to use only lower case.

3. pt-BR.patch: change pt-BR to pt-br.

When reviewing my code changes, please focus on:

-

After the review, I'll merge this branch into:
/trunk

Original issue reported on code.google.com by comel...@gmail.com on 9 Dec 2011 at 10:01

Attachments:

GoogleCodeExporter commented 8 years ago
I think the first patch is OK, but the second and third requires more work. 
Specifically, we need to handle the case where the user already has a cookie 
with the wrong "casing". Also, just changing the dictionary like that is a bit 
intrusive, and means that anyone that may have their own dictionary using 
subtags may have to update it.

I will need to discuss how we going to handle this in the translation portal 
with Andreas here at UNINETT.

Original comment by olavmrk@gmail.com on 12 Dec 2011 at 1:40

GoogleCodeExporter commented 8 years ago
Hm, could we then just add 'pt-br' => 'pt-BR' in 
SimpleSAML_XHTML_Template::$defaultLanguageMap, and left everything else as is?

Original comment by Andjelko...@gmail.com on 13 Dec 2011 at 8:39

GoogleCodeExporter commented 8 years ago
If someone uses custom subtags, we could move $defaultLanguageMap in 
configuration?

Original comment by Andjelko...@gmail.com on 13 Dec 2011 at 8:45

GoogleCodeExporter commented 8 years ago
Adding the language tag to the language map could work, and so could making it 
configurable, but I would still like to discuss this with Andreas. 
Unfortunately, he is not back until Thursday.

Original comment by olavmrk@gmail.com on 13 Dec 2011 at 10:02

GoogleCodeExporter commented 8 years ago
What I though may be an issue wrt. the translation portal turned out to not be 
a problem. I therefore think that you can commit these patches.

I do not think it very likely that someone has custom dictionaries using this 
kind of language tag, but we may want to add a note to the upgrade notes.

Could you also update the code that reads the cookie and the code that checks 
the query string parameter so that they lowercase the string?

Original comment by olavmrk@gmail.com on 19 Dec 2011 at 10:02

GoogleCodeExporter commented 8 years ago
OK, committed this in r3001 and r3002.

Original comment by comel...@gmail.com on 19 Dec 2011 at 1:09