L10nUtils: Fixed a bug where global keys are duplicated on refreshing feeds.

This commit is contained in:
satyr 2010-04-26 02:21:17 +09:00
Родитель 9a4131cdc6
Коммит 6e39457da2
2 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -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) }}} ===
//