Skip to content

Commit

Permalink
fix: extract supportedLocales to avoid to define it twice
Browse files Browse the repository at this point in the history
  • Loading branch information
siljec committed Aug 18, 2023
1 parent a7bba9c commit 73a81f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { LinguiConfig } from '@lingui/conf';
import { supportedLocales } from './packages/i18n';

const config: LinguiConfig = {
locales: ['en', 'nb', 'fi'],
locales: supportedLocales,
catalogs: [
{
include: ['packages/breadcrumbs/src/**/*.{ts,tsx}'],
Expand Down
1 change: 1 addition & 0 deletions packages/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const supportedLocales = ['en', 'nb', 'fi'];
2 changes: 1 addition & 1 deletion packages/utils/src/useI18n.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from 'react';
import { dynamicActivateI18n } from './dynamicActivatei18n';
import { supportedLocales } from '../../i18n';

function detectLocale() {
const supportedLocales = ['en', 'nb', 'fi'];
const defaultLocale = 'en';

if (typeof window === 'undefined') {
Expand Down

0 comments on commit 73a81f6

Please sign in to comment.