зеркало из https://github.com/mozilla/ubiquity.git
L10nUtils: Fixed a bug where global keys are duplicated on refreshing feeds.
This commit is contained in:
Родитель
9a4131cdc6
Коммит
6e39457da2
|
@ -48,11 +48,13 @@ var _ = (function prepareGettext({LocalizationUtils}, {UbiquitySetup}) {
|
|||
: x);
|
||||
|
||||
var {languageCode} = UbiquitySetup;
|
||||
if (!LocalizationUtils.loadLocalPo(feed.id, languageCode))
|
||||
if (!LocalizationUtils.loadLocalPo(feed.id, languageCode)) {
|
||||
LocalizationUtils.getFeedGlobals(feed.id).splice(0, 1/0);
|
||||
return function registerTemplate(x, data) {
|
||||
"l10n" in context || LocalizationUtils.registerFeedGlobal(feed.id, x);
|
||||
return renderTemplate(x, data);
|
||||
};
|
||||
}
|
||||
|
||||
var feedKey = LocalizationUtils.getLocalFeedKey(feed.id, languageCode);
|
||||
return function gettext(x, data) {
|
||||
|
|
|
@ -123,12 +123,11 @@ var LocalizationUtils = {
|
|||
},
|
||||
|
||||
getFeedGlobals:
|
||||
function LU_getFeedGlobals(feedUrl) feedGlobalsDict[feedUrl] || [],
|
||||
function LU_getFeedGlobals(feedUrl)
|
||||
feedGlobalsDict[feedUrl] || (feedGlobalsDict[feedUrl] = []),
|
||||
|
||||
registerFeedGlobal: function LU_registerFeedGlobal(feedUrl, key) {
|
||||
(feedGlobalsDict[feedUrl] || (feedGlobalsDict[feedUrl] = [])).push(key);
|
||||
return this;
|
||||
},
|
||||
registerFeedGlobal: function LU_registerFeedGlobal(feedUrl, key)
|
||||
LocalizationUtils.getFeedGlobals(feedUrl).push(key),
|
||||
|
||||
// === {{{ LocalizationUtils.localizeCommand(cmd, langCode) }}} ===
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче