Merge pull request #3 from tmickel/localization-codes

Use short localization codes
This commit is contained in:
Tim Mickel 2016-01-12 15:19:13 -05:00
commit 75a36adfe4
5 changed files with 8 additions and 6 deletions

View file

@ -1,2 +1,3 @@
/official
/arc
/pbs

View file

@ -17,10 +17,10 @@ window.Settings = {
categoryStopColor: '#D62222',
paletteBlockShadowOpacity: 0.8,
autoSaveInterval: 30 * 1000,
defaultLocale: 'en-US',
defaultLocale: 'en',
defaultLocaleShort: 'en',
supportedLocales: {
'English': 'en-US',
'Español': 'es-AR'
'English': 'en',
'Español': 'es'
}
};

View file

@ -46,12 +46,13 @@ Localization.includeLocales = function () {
} else {
Localization.currentLocale = localizationCookie;
}
var topLevel = Localization.currentLocale.split('-')[0];
// Intl locale-data
document.write('<script src="' + Localization.root +
'jssource/external/Intl/locale-data/jsonp/' + Localization.currentLocale + '.js"><\/script>');
'jssource/external/Intl/locale-data/jsonp/' + topLevel + '.js"><\/script>');
// MessageFormat locale-data
var topLevel = Localization.currentLocale.split('-')[0];
document.write('<script src="' + Localization.root +
'jssource/external/intl-messageformat/locale-data/' + topLevel + '.js"><\/script>');
@ -63,7 +64,7 @@ Localization.includeLocales = function () {
// Get messages synchronously
var xhr = new XMLHttpRequest();
xhr.open('GET', Localization.root + 'localizations/' + Localization.currentLocale + '.json', false);
xhr.open('GET', Localization.root + 'localizations/' + topLevel + '.json', false);
xhr.send(null);
Localization.localizationMessages = JSON.parse(xhr.responseText);