commit dc77ed376ca0dc35bce4779ca4742f64c20a2229
Author: David Fifield <david(a)bamsoftware.com>
Date: Sun Jun 9 10:50:45 2013 -0700
Make language tags case-insensitive.
---
ChangeLog | 3 +++
proxy/flashproxy-test.js | 2 ++
proxy/flashproxy.js | 1 +
3 files changed, 6 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 01e12bd..57696cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,9 @@
o The badge localization now understands language subtags such as
"ru-RU". Fixes bug 8828.
+ o Language tags for badge localization are now case-insensitive.
+ Patch by Eduardo Stalinho. Fixes bug 8829.
+
Changes in version 1.1
o Programs that use certificate pins now take a --disable-pin option
that causes pins to be ignored.
diff --git a/proxy/flashproxy-test.js b/proxy/flashproxy-test.js
index 9615588..e17df66 100755
--- a/proxy/flashproxy-test.js
+++ b/proxy/flashproxy-test.js
@@ -312,7 +312,9 @@ function test_lang_keys()
{
var TESTS = [
{ code: "de", expected: ["de"] },
+ { code: "DE", expected: ["de"] },
{ code: "de-at", expected: ["de-at", "de"] },
+ { code: "de-AT", expected: ["de-at", "de"] },
];
for (var i = 0; i < TESTS.length; i++) {
var test = TESTS[i];
diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
index 0ecc4dd..17e1a29 100644
--- a/proxy/flashproxy.js
+++ b/proxy/flashproxy.js
@@ -891,6 +891,7 @@ var DEFAULT_LOCALIZATION = { filename: "badge.png", text: "Internet Freedom" };
/* Return an array of progressively less specific language tags, canonicalized
for lookup in LOCALIZATIONS. */
function lang_keys(code) {
+ code = code.toLowerCase();
var result = [code];
var m = code.match(/^(\w+)/);
if (m !== null) {