Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
fix: format Norwegian timeAgo to bokmal (#172)
Browse files Browse the repository at this point in the history
As reported by @SanderRemote20, the Norwegian locale is using nokmal, but formatted timestamps using nynorsk.
This commit aligns both to use bokmal
  • Loading branch information
nielsmaerten authored Dec 8, 2021
1 parent 4ec32f1 commit fa00cfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gluco-check-core/src/main/i18n/loadDayJsLocale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function tryLoadingLocale(locale: string) {
function getPossibleLocaleIds(locale: string) {
const lowercaseLocale = locale.toLowerCase(); // 'en-US' -> 'en-us'
const twoLetterLocale = lowercaseLocale.substring(0, 2); // 'en-US' -> 'en'
const customLocale = customFallbackMap.get(twoLetterLocale); // 'en-US' -> 'custom'
const customLocale = customFallbackMap.get(twoLetterLocale); // 'no-NO' -> 'nb'

const possibleLocales = [lowercaseLocale, twoLetterLocale];

Expand All @@ -59,4 +59,4 @@ function getPossibleLocaleIds(locale: string) {
* If both the main locale (eg en-US) and its fallback (eg en) fail,
* select a fallback from this map.
*/
const customFallbackMap = new Map<string, string>([['no', 'nn']]);
const customFallbackMap = new Map<string, string>([['no', 'nb']]);
4 changes: 2 additions & 2 deletions gluco-check-core/test/specs/i18n/loadDayJsLocale.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('loadDayJsLocale', () => {
expect(actual).toBe(expected);
});

it("falls back to 'nn' for 'no-NO'", async () => {
const expected = 'nn';
it("falls back to 'nb' for 'no-NO'", async () => {
const expected = 'nb';
const actual = await loadDayJsLocale('no-NO');
expect(actual).toBe(expected);
});
Expand Down

0 comments on commit fa00cfa

Please sign in to comment.