summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/translator.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index e9e388f3..c89b43ff 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -299,7 +299,7 @@ class Translator {
async expandTags(names, title) {
const tags = [];
for (const name of names) {
- const base = name.split(':')[0];
+ const base = Translator.getNameBase(name);
const meta = await this.database.findTagForTitle(base, title);
const tag = {name};
@@ -318,7 +318,7 @@ class Translator {
async expandStats(items, title) {
const stats = {};
for (const name in items) {
- const base = name.split(':')[0];
+ const base = Translator.getNameBase(name);
const meta = await this.database.findTagForTitle(base, title);
const group = stats[meta.category] = stats[meta.category] || [];
@@ -346,4 +346,9 @@ class Translator {
return stats;
}
+
+ static getNameBase(name) {
+ const pos = name.indexOf(':');
+ return (pos >= 0 ? name.substr(0, pos) : name);
+ }
}