1
0
Fork 0

bug: Handling scenario when no data is passed to plugin

This commit is contained in:
Joost De Cock 2018-12-20 08:30:34 +01:00
parent 2e578a47be
commit e5f4fe7824
2 changed files with 5 additions and 0 deletions

View file

@ -10,6 +10,10 @@ export default {
}
},
insertText: function(locale, text, data) {
if(data === false) {
console.log("No data was passed to the i18n plugin. This plugin won't do much without injecting data into it");
return text;
}
let prefix = data.prefix || "";
if(typeof data.strings[locale][prefix+text] === "undefined") return text;
else return data.strings[locale][prefix+text];