Skip to content

Commit ee189df

Browse files
authored
Improve name-for-locale (#8207)
1 parent 86c2144 commit ee189df

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

app/javascript/components/localization/glossary-entries/show/Proposed/TranslationHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function TranslationHeader({ locale }: TranslationHeaderProps) {
1212
<div className="text-h4">
1313
{nameForLocale(locale)} ({locale})
1414
</div>
15-
<div className="status">Needs Reviewing</div>
15+
<div className="status">Needs Sign-off</div>
1616
<div className="flag">{flagForLocale(locale)}</div>
1717
</div>
1818
)

app/javascript/components/localization/glossary-entries/show/Unchecked.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ export function Unchecked({ translation }: { translation: GlossaryEntry }) {
8080
<div className="body">
8181
<p className="text-16 leading-140 mb-10">
8282
How should we translate this word in the context of Exercism? What is
83-
the most natural equivelent in LANGUAGE.
83+
the most natural equivelent in{' '}
84+
{nameForLocale(translation.locale, { displayInEnglish: true })}?
8485
</p>
8586
<div className="flex items-center gap-8 mb-12">
8687
<div className="text-16 w-[105px]">Original (en):</div>
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { capitalize } from 'lodash'
22

3-
export function nameForLocale(locale: string) {
3+
export function nameForLocale(
4+
locale: string,
5+
options: { displayInEnglish?: boolean } = { displayInEnglish: false }
6+
) {
47
const [language] = locale.split('-')
5-
const languageName = new Intl.DisplayNames([locale], { type: 'language' }).of(
6-
language
7-
)
8+
const displayLocale = options.displayInEnglish ? 'en' : locale
9+
const languageName = new Intl.DisplayNames([displayLocale], {
10+
type: 'language',
11+
}).of(language)
812

913
return capitalize(languageName)
1014
}

0 commit comments

Comments
 (0)