This commit is contained in:
2024-05-10 14:16:20 +08:00
parent 5d0b921d1d
commit d0e0cc8775

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name MusicBrainZ 生成 OpenCD 信息 // @name MusicBrainZ 生成 OpenCD 信息
// @namespace https://github.com/lifegpc/userscript // @namespace https://github.com/lifegpc/userscript
// @version 0.0.1 // @version 0.0.2
// @description MusicBrainZ 生成 OpenCD 所需信息 // @description MusicBrainZ 生成 OpenCD 所需信息
// @author lifegpc // @author lifegpc
// @match https://musicbrainz.org/release/* // @match https://musicbrainz.org/release/*
@@ -11,18 +11,24 @@
const typeI18n = { const typeI18n = {
album: '专辑', album: '专辑',
single: '单曲', single: '单曲',
soundtrack: '原声带',
} }
const areaI18n = { const areaI18n = {
japan: '日本', japan: '日本',
} }
const languageI18n = { const languageI18n = {
japanese: '日语', japanese: '日语',
'[multiple languages]': '[多种语言]',
} }
/**@param {string} type */ /**@param {string} type */
function getTypeI18n(type) { function getTypeI18n(type) {
const t = type.toLowerCase(); const li = [];
const i = typeI18n[t]; const tmp = type.split(" + ");
return i ?? type; for (const t of tmp) {
const i = typeI18n[t.toLowerCase()];
li.push(i ?? t);
}
return li.join(" + ")
} }
function getAreaI18n(area) { function getAreaI18n(area) {
const a = area.toLowerCase(); const a = area.toLowerCase();