feat: show English alias for non-Latin script artists
Extract primary English alias from MusicBrainz artist data when the canonical name uses non-Latin script (CJK, Cyrillic, etc.). Display it as the primary name in search results and artist detail header, with the native script name as a subtitle beneath. Example: 山下達郎 now shows 'Tatsuro Yamashita' prominently with '山下達郎' as a subtitle. Artists with Latin names are unchanged.
This commit is contained in:
@@ -169,6 +169,15 @@ export class ExploreArtistDetails extends LitElement {
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.artist-native-name {
|
||||
font-size: var(--yj-text-md);
|
||||
color: var(--yj-text-secondary, #b3b3b3);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.artist-meta {
|
||||
font-size: var(--yj-text-md);
|
||||
color: var(--yj-text-secondary, #b3b3b3);
|
||||
@@ -611,6 +620,11 @@ export class ExploreArtistDetails extends LitElement {
|
||||
return name.charAt(0).toUpperCase();
|
||||
}
|
||||
|
||||
/** English name if available, otherwise the native name. */
|
||||
private get displayName(): string {
|
||||
return this.artist?.englishName || this.artistName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Group release groups by type, returning entries in the
|
||||
* canonical order: Albums → EP → Single → Other Albums → ...rest.
|
||||
@@ -695,12 +709,15 @@ export class ExploreArtistDetails extends LitElement {
|
||||
class="artist-avatar"
|
||||
style="background: hsl(${hue}, 45%, 35%)"
|
||||
>
|
||||
${this.getInitial(this.artistName)}
|
||||
${this.getInitial(this.displayName)}
|
||||
</div>
|
||||
<div class="artist-info">
|
||||
<h1 class="artist-title" title="${this.artistName}">
|
||||
${this.artistName}
|
||||
<h1 class="artist-title" title="${this.displayName}">
|
||||
${this.displayName}
|
||||
</h1>
|
||||
${this.artist?.englishName
|
||||
? html`<div class="artist-native-name">${this.artist.name}</div>`
|
||||
: nothing}
|
||||
${this.renderArtistMeta()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -303,6 +303,16 @@ export class ExploreView extends LitElement {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.artist-native-name {
|
||||
color: var(--yj-text-secondary, #aaa);
|
||||
font-size: var(--yj-text-xs);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 100%;
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
.artist-disambiguation {
|
||||
color: var(--yj-text-tertiary, #888);
|
||||
font-size: var(--yj-text-xs);
|
||||
@@ -769,7 +779,7 @@ export class ExploreView extends LitElement {
|
||||
class="artist-avatar"
|
||||
style="background: hsl(${hue}, 45%, 35%)"
|
||||
>
|
||||
${a.name.charAt(0).toUpperCase()}
|
||||
${(a.englishName || a.name).charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div class="top-card-info">
|
||||
<div class="top-card-name">${a.name}</div>
|
||||
@@ -826,11 +836,14 @@ export class ExploreView extends LitElement {
|
||||
class="artist-avatar"
|
||||
style="background: hsl(${hue}, 45%, 35%)"
|
||||
>
|
||||
${a.name.charAt(0).toUpperCase()}
|
||||
${(a.englishName || a.name).charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div class="artist-name" title="${a.name}">
|
||||
${a.name}
|
||||
<div class="artist-name" title="${a.englishName || a.name}">
|
||||
${a.englishName || a.name}
|
||||
</div>
|
||||
${a.englishName
|
||||
? html`<div class="artist-native-name">${a.name}</div>`
|
||||
: nothing}
|
||||
${a.disambiguation
|
||||
? html`<div class="artist-disambiguation">
|
||||
${a.disambiguation}
|
||||
|
||||
Reference in New Issue
Block a user