diff --git a/packages/use-i18n/src/__tests__/locales/en.js b/packages/use-i18n/src/__tests__/locales/en.js deleted file mode 100644 index 4f0c139fa..000000000 --- a/packages/use-i18n/src/__tests__/locales/en.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - plurals: - 'You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}', - subtitle: 'Here is a subtitle', - 'tests.test.namespaces': 'test', - title: 'Welcome on @scaelway/ui i18n hook', -} diff --git a/packages/use-i18n/src/__tests__/locales/en.json b/packages/use-i18n/src/__tests__/locales/en.json new file mode 100644 index 000000000..bf5782609 --- /dev/null +++ b/packages/use-i18n/src/__tests__/locales/en.json @@ -0,0 +1,7 @@ +{ + "plurals": + "You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}", + "subtitle": "Here is a subtitle", + "tests.test.namespaces": "test", + "title": "Welcome on @scaelway/ui i18n hook" +} diff --git a/packages/use-i18n/src/__tests__/locales/es.js b/packages/use-i18n/src/__tests__/locales/es.js deleted file mode 100644 index bd7372cdd..000000000 --- a/packages/use-i18n/src/__tests__/locales/es.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - plurals: - 'You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}', - subtitle: 'Aquí hay un subtítulo', - 'tests.test.namespaces': 'test', - title: 'Bienvenido @scaelway/ui i18n hook', -} diff --git a/packages/use-i18n/src/__tests__/locales/es.json b/packages/use-i18n/src/__tests__/locales/es.json new file mode 100644 index 000000000..6a504bd59 --- /dev/null +++ b/packages/use-i18n/src/__tests__/locales/es.json @@ -0,0 +1,7 @@ +{ + "plurals": + "You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}", + "subtitle": "Aquí hay un subtítulo", + "tests.test.namespaces": "test", + "title": "Bienvenido @scaelway/ui i18n hook" +} diff --git a/packages/use-i18n/src/__tests__/locales/fr.js b/packages/use-i18n/src/__tests__/locales/fr.js deleted file mode 100644 index c3c5c2cf2..000000000 --- a/packages/use-i18n/src/__tests__/locales/fr.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - plurals: - 'You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}', - subtitle: 'Voici un sous-titre', - 'tests.test.namespaces': 'test', - title: 'Bienvenue sur @scaelway/ui i18n hook', -} diff --git a/packages/use-i18n/src/__tests__/locales/fr.json b/packages/use-i18n/src/__tests__/locales/fr.json new file mode 100644 index 000000000..7b70b685d --- /dev/null +++ b/packages/use-i18n/src/__tests__/locales/fr.json @@ -0,0 +1,7 @@ +{ + "plurals": + "You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}", + "subtitle": "Voici un sous-titre", + "tests.test.namespaces": "test", + "title": "Bienvenue sur @scaelway/ui i18n hook" +} diff --git a/packages/use-i18n/src/__tests__/usei18n.tsx b/packages/use-i18n/src/__tests__/usei18n.tsx index c2c874f33..83b2458d7 100644 --- a/packages/use-i18n/src/__tests__/usei18n.tsx +++ b/packages/use-i18n/src/__tests__/usei18n.tsx @@ -2,16 +2,16 @@ import { act, renderHook } from '@testing-library/react-hooks' import mockdate from 'mockdate' import React from 'react' import I18n, { useI18n, useTranslation } from '..' -import en from './locales/en' -import es from './locales/es' -import fr from './locales/fr' +import en from './locales/en.json' +import es from './locales/es.json' +import fr from './locales/fr.json' const LOCALE_ITEM_STORAGE = 'locales' const wrapper = ({ loadDateLocale = async (locale: string) => import(`date-fns/locale/${locale}/index`), - defaultLoad = async ({ locale }: { locale: string }) => import(`./locales/${locale}`), + defaultLoad = async ({ locale }: { locale: string }) => import(`./locales/${locale}.json`), defaultLocale = 'en', defaultTranslations = {}, enableDebugKey = false, diff --git a/tsconfig.json b/tsconfig.json index c2d5f3ea9..bc626263d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "moduleResolution": "node", "esModuleInterop": true, "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, "jsx": "preserve", }, "include": ["**/*.ts", "**/*.js", "**/.*.js", "**/*.tsx"]