summaryrefslogtreecommitdiff
path: root/libs/androidfw/LocaleData.cpp
AgeCommit message (Collapse)Author
2018-12-11Fix cert-dcl16-c clang-tidy warnings.Chih-Hung Hsieh
Bug: 120614316 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl16-c Change-Id: I2dc262d3407aafa969e921236dc3fc3ae60eb9d4
2017-01-11Treat Latin American locales speciallyRoozbeh Pournader
Due to legacy reasons, Android translations of European Spanish were kept under 'es', while Latin American Spanish translations were kept under 'es-US'. The combination of this, and the new locale preference rules in Nougat, resulted in 'es' winning over 'es-US' for all Latin American locales, since 'es' was a direct ancestor, while 'es-US' was just a fallback. The changes in Nougat had assumed that app developers would put Latin American Spanish translations under 'es-419', but that could create a backward-compatibility problem under older Android versions that did not support three-digit region codes properly. This CL keeps the Nougat logic and its locale parent tree, but special-cases es-US and es-MX to be treated as equivalents of es-419 in cases where they are present and es-419 is not. Bug: 31545805 Bug: 34126460 Test: unit tests are included Change-Id: Iab26f41294587ee044685a5a6560520c7cbb06f7
2016-02-01Make default resources a better match for en-US requestsRoozbeh Pournader
When locale fallback landed, resources which specified an 'English' locale started to be considered a better match for en-US, even though traditionally, apps tend to ship US English resources under their default locale. This fixes that, and makes en-US requests match default locales. Bug: 26756573 Bug: 26789680 Bug: 26803868 Change-Id: I460c276bfc6ddba0439dcdf87497a0aece0fa05d
2016-01-21Implement smarter locale resource selectionRoozbeh Pournader
* Add support for determining script from language and region. * Add support for determining special parents of locales. * Add support for smart comparison of locales with only a difference in region, using the locale parentage tree. * Fix LocaleData.matchScore() to not fallback to old locale matching behavior if we can't determine a script. * Allow four-character variant codes. (Previously, only five- to eight-character variant codes were allowed.) Bug: 7296673 Bug: 26589793 Change-Id: Ibde0a48c0564ff383b41068095a5cbacfe7b94bc