Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Copyright 2012 Mozilla Corporation. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * @description Tests that appropriate fallback locales are provided for
6 * supported locales.
7 * @author Norbert Lindenberg
8 */
10 $INCLUDE("testIntl.js");
12 testWithIntlConstructors(function (Constructor) {
13 var info = getLocaleSupportInfo(Constructor);
14 var fallback;
15 info.supported.forEach(function (locale) {
16 var pos = locale.lastIndexOf("-");
17 if (pos !== -1) {
18 fallback = locale.substring(0, pos);
19 if (info.supported.indexOf(fallback) === -1) {
20 $ERROR("Locale " + locale + " is supported, but fallback " + fallback + " isn't.");
21 }
22 }
23 var match = /([a-z]{2,3})(-[A-Z][a-z]{3})(-[A-Z]{2})/.exec(locale);
24 if (match !== null) {
25 fallback = match[1] + match[3];
26 if (info.supported.indexOf(fallback) === -1) {
27 $ERROR("Locale " + locale + " is supported, but fallback " + fallback + " isn't.");
28 }
29 }
30 });
31 });