Skip to content

Commit ec2b220

Browse files
committed
fix(l10n): do not call addTranslation without translation
There is no translation for the `en` locale. Use the string `seconds` directly. Signed-off-by: Max <[email protected]>
1 parent f21d51e commit ec2b220

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ moment.locale(locale)
1515
// track in transifex, so we prefer the included translation. Always prefer our default english
1616
// translation.
1717
if (locale === 'en' || locale in translations) {
18-
const gt = getGettextBuilder()
19-
.setLanguage(locale)
20-
.addTranslation(locale, translations[locale])
21-
.build()
18+
const s = locale === 'en'
19+
? 'seconds'
20+
: getGettextBuilder()
21+
.setLanguage(locale)
22+
.addTranslation(locale, translations[locale])
23+
.build()
24+
.gettext('seconds')
2225

2326
moment.updateLocale(moment.locale(), {
24-
relativeTime: {
25-
s: gt.gettext('seconds'),
26-
},
27+
relativeTime: { s },
2728
})
2829
}
2930

0 commit comments

Comments
 (0)