@ttoss/react-i18n 2.0.15 → 2.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -11
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -50,11 +50,11 @@ import App from './App';
50
50
  const loadLocaleData: LoadLocaleData = async (locale) => {
51
51
  switch (locale) {
52
52
  case 'pt-BR':
53
- return import('../i18n/compiled/pt-BR.json');
53
+ return (await import('../i18n/compiled/pt-BR.json')).default;
54
54
  case 'es':
55
- return import('../i18n/compiled/es.json');
55
+ return (await import('../i18n/compiled/es.json')).default;
56
56
  default:
57
- return import('../i18n/compiled/en.json');
57
+ return (await import('../i18n/compiled/en.json')).default;
58
58
  }
59
59
  };
60
60
 
@@ -219,9 +219,11 @@ import type { AppProps } from 'next/app';
219
219
  const loadLocaleData: LoadLocaleData = async (locale) => {
220
220
  switch (locale) {
221
221
  case 'pt-BR':
222
- return import('../../i18n/compiled/pt-BR.json');
222
+ return (await import('../../i18n/compiled/pt-BR.json')).default;
223
+ case 'es':
224
+ return (await import('../../i18n/compiled/es.json')).default;
223
225
  default:
224
- return import('../../i18n/compiled/en.json');
226
+ return (await import('../../i18n/compiled/en.json')).default;
225
227
  }
226
228
  };
227
229
 
@@ -649,11 +651,9 @@ Enable verbose logging during development:
649
651
  const loadLocaleData: LoadLocaleData = async (locale) => {
650
652
  console.log(`Loading locale: ${locale}`);
651
653
  try {
652
- const data = await import(`../i18n/compiled/${locale}.json`);
653
- console.log(
654
- `Loaded ${Object.keys(data.default).length} messages for ${locale}`
655
- );
656
- return data.default;
654
+ const data = (await import(`../i18n/compiled/${locale}.json`)).default;
655
+ console.log(`Loaded ${Object.keys(data).length} messages for ${locale}`);
656
+ return data;
657
657
  } catch (error) {
658
658
  console.error(`Failed to load locale ${locale}:`, error);
659
659
  throw error;
@@ -673,6 +673,6 @@ const loadLocaleData: LoadLocaleData = async (locale) => {
673
673
 
674
674
  - **[FormatJS Documentation](https://formatjs.io/)** - Complete guide to ICU message format and FormatJS features
675
675
  - **[ICU Message Format](https://unicode-org.github.io/icu/userguide/format_parse/messages/)** - Specification for message formatting
676
- - **[Building a Multilingual Blog with Next.js and @ttoss/react-i18n](/blog/building-a-multilingual-blog-site-with-next.js-and-@ttoss-react-i18n)** - Comprehensive tutorial
676
+ - **[Building a Multilingual Blog with Next.js and @ttoss/react-i18n](https://ttoss.dev/blog/2023/09/26/building-a-multilingual-blog-site-with-next.js-and-@ttoss-react-i18n)** - Comprehensive tutorial
677
677
 
678
678
  This library enables efficient internationalization following FormatJS standards while integrating seamlessly with the ttoss development ecosystem. For complete workflow setup including message extraction and compilation, see the [@ttoss/i18n-cli documentation](https://ttoss.dev/docs/modules/packages/i18n-cli/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-i18n",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "license": "MIT",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -35,9 +35,9 @@
35
35
  "jest": "^30.0.4",
36
36
  "react": "^19.1.0",
37
37
  "tsup": "^8.5.0",
38
- "@ttoss/i18n-cli": "^0.7.32",
39
- "@ttoss/test-utils": "^2.1.26",
40
- "@ttoss/config": "^1.35.6"
38
+ "@ttoss/config": "^1.35.7",
39
+ "@ttoss/i18n-cli": "^0.7.33",
40
+ "@ttoss/test-utils": "^2.1.27"
41
41
  },
42
42
  "keywords": [
43
43
  "React",