fix: convert katakana proper nouns (e.g. ヨルシカ) to romaji in sort tags
When kuromoji marks a katakana token as reading '*' (unknown word — common for band names like ヨルシカ), the code fell back to the surface_form which is still katakana. _hiraToRomaji can't handle katakana so it passed through unchanged, causing sort tags to show ヨルシカ instead of Yorushika. Fix: if the surface_form contains katakana and reading is *, convert it mechanically via _kataToHira + _hiraToRomaji — katakana-to-romaji is always unambiguous and needs no dictionary. Also add a Japanese-char guard in the frontend when applying romaji index values, so stale cache entries can never overwrite correct values with Japanese. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
e6d85e63a8
commit
212491aa89
2 files changed
+16
-6
No files matched your search
@@ -364,10 +364,13 @@ export function toggleInfoEdit() {
|
||||
fetchRomajiIndex().catch(() => null).then(() => {
|
||||
const rm = romajiLookup(_sId);
|
||||
if (rm) {
|
||||
document.getElementById('ie-titlesort').value = rm.titleRomaji || '';
|
||||
document.getElementById('ie-artistsort').value = rm.artistRomaji || '';
|
||||
document.getElementById('ie-albumartistsort').value = rm.artistRomaji || '';
|
||||
document.getElementById('ie-albumsort').value = rm.albumRomaji || '';
|
||||
const _jp = /[ぁ-んァ-ン一-龯]/;
|
||||
if (rm.titleRomaji && !_jp.test(rm.titleRomaji)) document.getElementById('ie-titlesort').value = rm.titleRomaji;
|
||||
if (rm.artistRomaji && !_jp.test(rm.artistRomaji)) {
|
||||
document.getElementById('ie-artistsort').value = rm.artistRomaji;
|
||||
document.getElementById('ie-albumartistsort').value = rm.artistRomaji;
|
||||
}
|
||||
if (rm.albumRomaji && !_jp.test(rm.albumRomaji)) document.getElementById('ie-albumsort').value = rm.albumRomaji;
|
||||
}
|
||||
if (!S.cfg.backendUrl || !_sId) return null;
|
||||
const p = new URLSearchParams({ ndUrl: S.cfg.url, user: S.cfg.user, pass: S.cfg.pass, songId: _sId });
|
||||
|
||||
Reference in new issue
Block a user