diff --git a/README.md b/README.md index 58f7976..b426537 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ You can ignore a specific function by adding `// i18n-validate-disable-next-line For dynamic keys, we check the typescript type of the key. If the type is a `const` type, the type is used as the key. Otherwise, the key is ignored. Type can be an union type or a literal type. +For ts files + ```ts const a = 'namespace:key1'; @@ -73,7 +75,11 @@ t(`namespace:${b}` as const); declare const c: 'namespace:key3' | 'namespace:key4'; t(c); +``` +For js files + +```js /** * @type {'a:key5' | 'a:key6'} */ @@ -81,7 +87,7 @@ const d = `a:${b}`; t(d); -const e = /** @type {'a:key7' | 'a:key8'} */ `a:${b}`; +const e = /** @type {'a:key7' | 'a:key8'} */ (`a:${b}`); t(e); ``` diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 6e243ad..3a8abdf 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. +## [i18n-validate@1.4.0](https://github.com/imranbarbhuiya/i18n-validate/compare/v1.2.1...i18n-validate@1.4.0) - (2023-07-18) + +### 🐛 Bug Fixes + +- Add file count ([2b2002c](https://github.com/imranbarbhuiya/i18n-validate/commit/2b2002cdca4ea31edc76bb2d018c378a161b7ee5)) +- Add time taken log ([91a1533](https://github.com/imranbarbhuiya/i18n-validate/commit/91a153309bbfef7450b46cced9091a68ccb6e9f8)) + +### 🚀 Features + +- Support dynamic key using ts type ([3673637](https://github.com/imranbarbhuiya/i18n-validate/commit/36736374577a15030a80929870de98fb43d520a7)) +- Support ternary and string concatenation in key ([943682f](https://github.com/imranbarbhuiya/i18n-validate/commit/943682f7aefac0da152ae2ae240c1c314c6d1f16)) + ## [i18n-validate@1.3.0](https://github.com/imranbarbhuiya/i18n-validate/compare/v1.2.1...i18n-validate@1.3.0) - (2023-07-18) ### 🐛 Bug Fixes diff --git a/packages/core/README.md b/packages/core/README.md index 8e7ae1d..cacd2c6 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -58,6 +58,8 @@ You can ignore a specific function by adding `// i18n-validate-disable-next-line For dynamic keys, we check the typescript type of the key. If the type is a `const` type, the type is used as the key. Otherwise, the key is ignored. Type can be an union type or a literal type. +For ts files + ```ts const a = 'namespace:key1'; @@ -72,7 +74,11 @@ t(`namespace:${b}` as const); declare const c: 'namespace:key3' | 'namespace:key4'; t(c); +``` +For js files + +```js /** * @type {'a:key5' | 'a:key6'} */ @@ -80,7 +86,7 @@ const d = `a:${b}`; t(d); -const e = /** @type {'a:key7' | 'a:key8'} */ `a:${b}`; +const e = /** @type {'a:key7' | 'a:key8'} */ (`a:${b}`); t(e); ``` diff --git a/packages/core/package.json b/packages/core/package.json index 3b0e3b3..a969631 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "i18n-validate", - "version": "1.3.0", + "version": "1.4.0", "description": "A cli tool to find invalid i18n keys, missing variables and many more", "main": "./dist/index.js", "types": "./dist/index.d.ts",