commonplace
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -267,3 +267,3 @@ var fs = require('fs'); | ||
_check_version(src_dir, undefined, undefined, function() { | ||
check_version(src_dir, undefined, undefined, function() { | ||
console.error('No Commonplace installation found.'); | ||
@@ -270,0 +270,0 @@ process.exit(1); |
{ | ||
"name": "commonplace", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "url": "git://github.com/mozilla/commonplace.git", |
@@ -27,2 +27,5 @@ define('helpers', | ||
safe_filter('nl2br', function(obj) { | ||
if (typeof obj !== 'string') { | ||
return obj; | ||
} | ||
return obj.replace(/\n/g, '<br>'); | ||
@@ -41,2 +44,4 @@ }); | ||
filters.translate = utils.translate; | ||
filters.numberfmt = function(num) { | ||
@@ -43,0 +48,0 @@ if (typeof num === 'number' && num.toLocaleString) { |
@@ -63,9 +63,11 @@ define('login', | ||
}; | ||
if (settings.persona_unverified_issuer) { | ||
// We always need to force a specific issuer because bridged IdPs don't work with verified/unverified. | ||
// See bug 910938. | ||
opt.experimental_forceIssuer = settings.persona_unverified_issuer; | ||
} | ||
if (!navigator.id._shimmed) { | ||
// When on B2G (i.e. no shim), we don't require new accounts to verify their email | ||
// address. When on desktop, we do require verification. | ||
_.extend(opt, { | ||
experimental_forceIssuer: settings.persona_unverified_issuer || null, | ||
experimental_allowUnverified: true | ||
}); | ||
opt.experimental_allowUnverified = true; | ||
} | ||
@@ -93,3 +95,3 @@ | ||
var should_reload = !user.logged_in(); | ||
user.set_token(data.token, data.settings); | ||
@@ -96,0 +98,0 @@ user.update_permissions(data.permissions); |
@@ -93,3 +93,3 @@ define('notification', ['defer', 'helpers', 'jquery', 'templates', 'z'], function(defer, helpers, $, nunjucks, z) { | ||
confirmationDef.resolve(); | ||
}).on('touchend click', '.btn-cancel', function(e) { | ||
}).on('touchend click', '.btn-cancel, .close', function(e) { | ||
e.preventDefault(); | ||
@@ -96,0 +96,0 @@ confirmationDef.reject(); |
@@ -125,2 +125,27 @@ define('utils', ['jquery', 'underscore'], function($, _) { | ||
function translate(data, default_language, lang) { | ||
if (typeof data === 'string') { | ||
return data; | ||
} | ||
// TODO: Make this a setting somewhere. | ||
default_language = default_language || 'en-US'; | ||
lang = lang || (window.navigator.l10n ? window.navigator.l10n.language : 'en-US'); | ||
if (lang in data) { | ||
return data[lang]; | ||
} | ||
var short_lang = lang.split('-')[0]; | ||
if (short_lang in data) { | ||
return data[short_lang]; | ||
} | ||
if (typeof default_language === 'string') { | ||
return data[default_language]; | ||
} else if (typeof default_language === 'object' && | ||
'default_language' in default_language && | ||
default_language.default_language in data) { | ||
return data[default_language.default_language]; | ||
} | ||
for (var x in data) { return data[x]; } | ||
return ''; | ||
} | ||
var osStrings = { | ||
@@ -154,5 +179,6 @@ 'windows': 'Windows', | ||
'urlparams': urlparams, | ||
'urlunparam': urlunparam | ||
'urlunparam': urlunparam, | ||
'translate': translate | ||
}; | ||
}); |
@@ -102,2 +102,18 @@ (function() { | ||
test('translate', function(done) { | ||
var dlobj = {'default_language': 'def_loc'}; | ||
eq_(filters.translate('foobar', dlobj, 'en-CA'), 'foobar'); | ||
eq_(filters.translate({'en-CA': 'foobar', 'en-US': 'us'}, dlobj, 'en-CA'), | ||
'foobar'); | ||
eq_(filters.translate({'en': 'foobar', 'en-US': 'us'}, dlobj, 'en-CA'), | ||
'foobar'); | ||
eq_(filters.translate({'blah': 'blah', 'bar': '1'}, 'bar', 'es-PD'), '1'); | ||
eq_(filters.translate({'blah': 'blah', 'def_loc': '2'}, dlobj, 'es-PD'), '2'); | ||
eq_(filters.translate({'blah': '3'}, dlobj, 'es-PD'), '3'); | ||
eq_(filters.translate({'foo': 'bar', 'en-US': '3'}, null, 'es-PD'), '3'); | ||
eq_(filters.translate({}, dlobj, 'es-PD'), ''); | ||
done(); | ||
}); | ||
})(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
833128
11124