Skip to content

Commit be8852c

Browse files
caugneryin1999
andauthored
enhance(l10n): localize "(en-US)" indicator (#10996)
Links in other locales that point to the English locale often have an indicator "(en-US)", but this is rather technical and not ideal from a user experience point of view. This PR replaces the indicator by a localized one, added via CSS. --------- Co-authored-by: A1lo <[email protected]>
1 parent b7bbcaa commit be8852c

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

Diff for: build/flaws/broken-links.ts

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function mutateLink(
5454
// As we still suggest the translated version even if we only
5555
// have an English (US) version.
5656
$element.attr("href", enUSFallback);
57-
$element.append(` <small>(${DEFAULT_LOCALE})<small>`);
5857
$element.addClass("only-in-en-us");
5958
$element.attr("title", "Currently only available in English (US)");
6059
} else if (suggestion) {

Diff for: client/src/document/index.scss

+40
Original file line numberDiff line numberDiff line change
@@ -942,3 +942,43 @@ kbd {
942942
opacity: 0.4;
943943
}
944944
}
945+
946+
html a.only-in-en-us:after {
947+
content: "(en-US)";
948+
font-size: smaller;
949+
vertical-align: super;
950+
}
951+
952+
html[lang="es"] a.only-in-en-us:after {
953+
content: "(inglés)";
954+
}
955+
956+
html[lang="fr"] a.only-in-en-us:after {
957+
content: "(angl.)";
958+
}
959+
960+
html[lang="ja"] a.only-in-en-us:after {
961+
content: "(英語)";
962+
}
963+
964+
html[lang="ko"] a.only-in-en-us:after {
965+
content: "(영어)";
966+
}
967+
968+
html[lang="ru"] a.only-in-en-us:after {
969+
content: "(англ.)";
970+
}
971+
972+
html[lang="pt-BR"] a.only-in-en-us:after {
973+
content: "(inglês)";
974+
}
975+
976+
html[lang="zh-CN"] a.only-in-en-us:after {
977+
content: "(英语)";
978+
vertical-align: baseline;
979+
}
980+
981+
html[lang="zh-TW"] a.only-in-en-us:after {
982+
content: "(英語)";
983+
vertical-align: baseline;
984+
}

Diff for: kumascript/src/api/web.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const web = {
155155
return (
156156
'<a class="only-in-en-us" ' +
157157
'title="Currently only available in English (US)" ' +
158-
`href="${enUSPage.url}"${flawAttribute}>${content} <small>(en-US)</small></a>`
158+
`href="${enUSPage.url}"${flawAttribute}>${content}</a>`
159159
);
160160
}
161161
}

0 commit comments

Comments
 (0)