diff --git a/package-lock.json b/package-lock.json index 249f0fc..b44edc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,9 @@ "@babel/preset-env": "^7.6.2", "@babel/register": "^7.9.0", "mocha": "^7.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/rsimon" } }, "node_modules/@babel/code-frame": { diff --git a/package.json b/package.json index 27603a1..cd82cd9 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "url": "https://github.com/recogito/recogito-client-core/issues" }, "homepage": "https://github.com/recogito/recogito-client-core/wiki", + "funding": "https://github.com/sponsors/rsimon", "devDependencies": { "@babel/core": "^7.6.2", "@babel/plugin-proposal-class-properties": "^7.5.5", diff --git a/src/i18n/index.js b/src/i18n/index.js index ecf8bf6..483db64 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -86,16 +86,13 @@ timeago.register('tr', tr); /** * Helper function that allows plugins to register their - * own I18N labels + * own additional I18N labels */ -i18n.registerMessages = dict => { - const currentLocale = i18n.locale(); - const messages = dict[currentLocale]; - - if (messages) - i18n.extend(messages); +i18n.registerMessages = (lang, messages) => { + if (MESSAGES[lang]) + MESSAGES[lang] = {...MESSAGES[lang], ...messages }; else - console.warn(`Locale ${currentLocale} not supported by plugin widget - falling back to defaults`); + MESSAGES[lang] = messages; } export default i18n;