bug: Handling scenario when no data is passed to plugin
This commit is contained in:
parent
2e578a47be
commit
e5f4fe7824
2 changed files with 5 additions and 0 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue