feat: romaji override list — manual kanji→romaji corrections for sort tags
Adds a maintained list in Settings where you can map kanji artist/album/title strings to their correct romaji reading (e.g. 照井順政 → Terui Yoshimasa). Overrides are applied last (highest priority) when the edit-metadata modal opens, so saving the song writes the correct sort tags permanently to the file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
db7a515ee4
commit
8c3a23ad14
4 files changed
+81
-9
No files matched your search
+16
@@ -98,6 +98,22 @@ export async function fetchRomajiIndex() {
|
||||
|
||||
export function invalidateRomajiIndex() { _romajiIndex = null; _romajiMap = null; _artistRomajiMap = null; }
|
||||
|
||||
// ─── ROMAJI OVERRIDES ───
|
||||
// Manual kanji → romaji corrections stored in localStorage. Always take priority over auto-conversion.
|
||||
export function getRomajiOverrides() {
|
||||
try { return JSON.parse(localStorage.getItem('ns_romaji_overrides') || '{}'); } catch { return {}; }
|
||||
}
|
||||
export function setRomajiOverride(kanji, romaji) {
|
||||
const o = getRomajiOverrides();
|
||||
if (romaji?.trim()) o[kanji.trim()] = romaji.trim(); else delete o[kanji.trim()];
|
||||
localStorage.setItem('ns_romaji_overrides', JSON.stringify(o));
|
||||
}
|
||||
export function removeRomajiOverride(kanji) {
|
||||
const o = getRomajiOverrides();
|
||||
delete o[kanji];
|
||||
localStorage.setItem('ns_romaji_overrides', JSON.stringify(o));
|
||||
}
|
||||
|
||||
export function dispArtistById(id, name) {
|
||||
if (!S.cfg.showRomaji || !_artistRomajiMap) return name || '';
|
||||
return _artistRomajiMap.get(String(id)) || name || '';
|
||||
|
||||
Reference in new issue
Block a user