tweaks to test language modules

This commit is contained in:
Stewart Allen 2020-03-17 09:36:36 -04:00
commit 3a801ae15f
2 changed files with 14 additions and 12 deletions

View file

@ -425,12 +425,6 @@ let gs_kiri_lang = exports;
ag_paws_l: "comma-separated list of layers\nto inject pause commands before" ag_paws_l: "comma-separated list of layers\nto inject pause commands before"
}; };
LANG['test'] = { bogus: "not a valid key" };
Object.keys(LANG.en).forEach(key => {
LANG.test[key] = `*${LANG.en[key]}*`;
});
LANG.current = {}; LANG.current = {};
LANG.set(lset, lset.split('-')[0]); LANG.set(lset, lset.split('-')[0]);

View file

@ -69,7 +69,8 @@ self.kiri.license = exports.LICENSE;
camStock = null, camStock = null,
camTopZ = 0, camTopZ = 0,
topZ = 0, topZ = 0,
showFavorites = SDB['dev-favorites'] === 'true'; showFavorites = SDB['dev-favorites'] === 'true',
alerts = [];
// seed defaults. will get culled on save // seed defaults. will get culled on save
settings.sproc.FDM.default = clone(settings.process); settings.sproc.FDM.default = clone(settings.process);
@ -80,11 +81,6 @@ self.kiri.license = exports.LICENSE;
DBUG.enable(); DBUG.enable();
if (SETUP.rm) renderMode = parseInt(SETUP.rm[0]);
if (SETUP.ln) KIRI.lang.set(SETUP.ln[0]);
let alerts = [ [ `${LANG.version} ${KIRI.version}`, Date.now() ] ];
// add show() to catalog for API // add show() to catalog for API
CATALOG.show = showCatalog; CATALOG.show = showCatalog;
@ -187,6 +183,7 @@ self.kiri.license = exports.LICENSE;
hide: { hide: {
import: function() { UI.import.style.display = 'none' } import: function() { UI.import.style.display = 'none' }
}, },
language: KIRI.lang,
modal: { modal: {
show: showModal, show: showModal,
hide: hideModal, hide: hideModal,
@ -335,6 +332,10 @@ self.kiri.license = exports.LICENSE;
while (alerts.length > 5) { while (alerts.length > 5) {
alerts.shift(); alerts.shift();
} }
// return if called before UI configured
if (!UI.alert) {
return;
}
if (alerts.length > 0) { if (alerts.length > 0) {
UI.alert.text.innerHTML = alerts.map(v => ['<p>',v[0],'</p>'].join('')).join(''); UI.alert.text.innerHTML = alerts.map(v => ['<p>',v[0],'</p>'].join('')).join('');
UI.alert.dialog.style.display = 'flex'; UI.alert.dialog.style.display = 'flex';
@ -1822,4 +1823,11 @@ self.kiri.license = exports.LICENSE;
kirimod.forEach(function(mod) { mod(kiri.api) }); kirimod.forEach(function(mod) { mod(kiri.api) });
} }
// allow language modules to load first
if (SETUP.ln) KIRI.lang.set(SETUP.ln[0]);
if (SETUP.rm) renderMode = parseInt(SETUP.rm[0]);
// show version on startup
API.show.alert(`${LANG.version} ${KIRI.version}`);
})(); })();