Skip to content

Commit

Permalink
fix: add logs and use localePath
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Jul 16, 2023
1 parent 41f3156 commit 347dc75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ npx i18n-validate
Usage: i18n-validate [options] <file ...>

Options:
-V, --version output the version number
-c, --config <config> Path to the config file (default:
"./i18n-validate.json")
--log-level <logLevel> Log level (default: "info")
--exclude <exclude...> Exclude files from parsing (default:
"**/node_modules/**")
--exitOnError Exit immediately if an error is found (default:
false)
-h, --help display help for command
-V, --version output the version number
-c, --config <config> Path to the config file (default:
"./i18n-validate.json")
--log-level <logLevel> Log level (default: "info")
--exclude <exclude...> Exclude files from parsing (default:
"**/node_modules/**")
--exit-on-error Exit immediately if an error is found (default:
false)
-h, --help display help for command

Examples:

Expand All @@ -55,7 +55,7 @@ You can customize the behavior of `i18n-validate` by adding a `i18n-validate.jso
```json
{
"$schema": "https://raw.githubusercontent.com/imranbarbhuiya/i18n-validate/.github/i18n-validate.schema.json"
"$schema": "https://raw.githubusercontent.com/imranbarbhuiya/i18n-validate/main/.github/i18n-validate.schema.json"
}
```
Expand Down
4 changes: 3 additions & 1 deletion src/validateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const importLocaleFile = async (url: string) => {
};

export const validateKey = async (node: TranslationNode, options: OptionsWithDefault) => {
const filePath = `${options.localeFolder}/${options.sourceLang}/${node.namespace}.json`;
const filePath = `${options.localeFolder}/${options.localePath.replaceAll('{{lng}}', options.sourceLang).replaceAll('{{ns}}', node.namespace)}`;

log(`Fetching translation keys from ${filePath}`, 'debug', options);

const url = new URL(filePath, import.meta.url);

Expand Down

0 comments on commit 347dc75

Please sign in to comment.