Fix incorrect assumptions about locales codes.
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 5 May 2010 13:50:15 +0000 (13:50 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 5 May 2010 13:50:15 +0000 (13:50 +0000)
commitce411ca8f5ee0ed4276bd560bb71500d375b2f4b
treeb15e68515541d225a4da16c39d2b6e565631ecf2
parentfd61f684454470dfe94e476dedfd482aa86554d7
Fix incorrect assumptions about locales codes.

wx incorrectly assumes that Unix locale codes have the form of xx_YY,
where both xx and yy are two characters long. This is wrong, xx is
ISO 639 code, which can often have 3 characters ("ast", "gez" etc.);
future ISO 639-6 will have up to 4 chars. Similarly, ISO 3166 has
alpha-3 variant of country codes too (even though they aren't used in
this context today).

For parsing needs, we can just look for '_' in the code. The only place
where a check for xx_YY code was performed was GetSystemLanguage().
Instead of bothering with correct check (or a heuristic), let's simply
assume locale is xx_YY code and only do alternative handling if that
assumption fails. According to the comments, this alternative handling
was for cases such as LANG=german environment on SuSE, but it's safe to
say that no modern systems do that anymore, so it's OK that this patch
is marginally less efficient on such legacy systems.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
src/common/intl.cpp
src/common/translation.cpp