You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

next-intl-split

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-intl-split - npm Package Compare versions

Comparing version

to
1.2.4

2

load/index.d.ts

@@ -1,2 +0,2 @@

export declare const loadI18nTranslations: (dictionariesPath: string, locale: string) => any;
export declare const loadI18nTranslations: (dictionariesPath: string, locale: string, enableTypeCheck?: boolean) => any;
export declare const loadMessages: (dictionariesPath: string) => {

@@ -3,0 +3,0 @@ [key: string]: any;

{
"name": "next-intl-split",
"version": "1.2.3",
"version": "1.2.4",
"description": "A loader for next-intl to split translation files properly.",

@@ -23,3 +23,8 @@ "author": {

"next-intl-split",
"split"
"split",
"intl",
"internationalization",
"i18n",
"next.js",
"next"
],

@@ -26,0 +31,0 @@ "scripts": {

@@ -10,2 +10,3 @@ # About

- <a href="#how_to_use">How to use the package?</a>
- <a href="#how_to_add_types">How to add types?</a>

@@ -36,2 +37,4 @@ ## <a id="installation"></a> Installation

- Cleaner `JSON` files.
- Support for TypeScript.
- Support for Next.Js Config file with `.ts/.js/.mjs` extensions.

@@ -246,1 +249,29 @@ ## <a id="how_to_use"></a> How to use the package?

```
## <a id="how_to_add_types"></a>Add Support for TypeScript
Starting from `v1.2.4` you'll be able to enable type check.
1. Add global type declaration as mentioned in `next-intl` documentation. [Check this](https://next-intl.dev/docs/workflows/typescript)
2. Based on your default locale, ensure that there is a `.json` file for that in your messages (or translations) folder.
As an example if your default locale is `en` and you have your messages in `./src/messages/`, make sure there is an `en.json` module in it, even an empty one or you can build your project once to have them merged automatically.
3. Inside the `getRequestConfig`, add the `true` parameters to the `loadI18nTranslations` utitlity as the 3rd param.
```ts
// ./src/i18n/request.ts
...
export default getRequestConfig(async ({ locale }) => {
...
messages = loadI18nTranslations(
'./src/messages',
locale,
true // This will enable type check
);
...
});
...
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet