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

Language and Country Detection bugs #504

Closed
robocoder opened this issue Jan 15, 2009 · 6 comments
Closed

Language and Country Detection bugs #504

robocoder opened this issue Jan 15, 2009 · 6 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@robocoder
Copy link
Contributor

- core/Common.php: extractLanguageCodeFromBrowserLanguage returns the country code;
should rename this to extractCountryCodeFromBrowserLanguage and add a new extractLanguageCodeFromBrowserLanguage function
- plugins/LanguagesManager/LanguagesManager.php: calls above function, extractLanguageCodeFromBrowserLanguage, expecting a language code, but for “en-ca”, it gets “ca” (Catal) instead of “en”
- Visitors | Locations & providers | Countries data table shows “Unknown” for “en-US”; need to call strtolower(), probably in core/Common.php’s getBrowserlanguage()

@robocoder
Copy link
Contributor Author

Tasks from #504:
- rename lang/cn.php to lang/zh-cn.php
- rename lang/tw.php to lang/zh-tw.php

I’m guessing this one should be renamed too (judging from General_Locale):
- rename lang/pt.php to lang/pt-br.php

@robocoder
Copy link
Contributor Author

Attachment:
[504.diffs](http://issues.piwik.org/attachments/504/504.diffs)

@robocoder
Copy link
Contributor Author

Attachment: new
[LanguageToCountry.php](http://issues.piwik.org/attachments/504/LanguageToCountry.php)

@robocoder
Copy link
Contributor Author

Updated patch (and new file):
- config/global.ini.php: added config option ‘enable_language_to_country_guess’ to turn on the language to country guess (when no region provided in the preferred language tag)
- core/DataFiles/LanguageToCountry.php: new
- core/DataFiles/Countries.php: updated with respect to ISO 3166-1 alpha-2 list
- lang/en.php: updated with respect to above
- tests/core/Common.test.php: more tests
- core/Common.php: lots of changes

@mattab
Copy link
Member

mattab commented Mar 1, 2009

end of fix in 931; thanks anthon!

@robocoder
Copy link
Contributor Author

(In 1038) refs #504 – check that valid_languages and valid_countries is not null;
http://ca2.php.net/manual/en/function.in-array.php#86695 describes
in_array() returning true if haystack is 0 or false, and not in strict
mode

@robocoder robocoder added this to the RobotRock milestone Jul 8, 2014
@robocoder robocoder self-assigned this Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants