From 4ba9e94dd6f632492ed250ccc267f5ac72805290 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 18 Nov 2024 05:37:01 +0900 Subject: [PATCH] fix: fix i18n-ally extension config (#1462) * fix: fix i18n-ally extension config * fix: update scopeRangeRegex to support useScopedI18n and remove unused locales path --- .vscode/extensions.json | 3 ++- .vscode/i18n-ally-custom-framework.yml | 36 ++++++++++++++++++++++++++ .vscode/settings.json | 13 ++++++---- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .vscode/i18n-ally-custom-framework.yml diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0653e1f75..f0cdbe63c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "yoavbls.pretty-ts-errors", - "million.million-lint" + "million.million-lint", + "lokalise.i18n-ally" ] } diff --git a/.vscode/i18n-ally-custom-framework.yml b/.vscode/i18n-ally-custom-framework.yml new file mode 100644 index 000000000..6cb944e00 --- /dev/null +++ b/.vscode/i18n-ally-custom-framework.yml @@ -0,0 +1,36 @@ +# .vscode/i18n-ally-custom-framework.yml + +# An array of strings which contain Language Ids defined by VS Code +# You can check available language ids here: https://code.visualstudio.com/docs/languages/identifiers +languageIds: + - javascript + - typescript + - javascriptreact + - typescriptreact + +# An array of RegExes to find the key usage. **The key should be captured in the first match group**. +# You should unescape RegEx strings in order to fit in the YAML file +# To help with this, you can use https://www.freeformatter.com/json-escape.html +usageMatchRegex: + # The following example shows how to detect `t("your.i18n.keys")` + # the `{key}` will be placed by a proper keypath matching regex, + # you can ignore it and use your own matching rules as well + - "[^\\w\\d]t\\(['\"`]({key})['\"`]" + +# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys +# and works like how the i18next framework identifies the namespace scope from the +# useTranslation() hook. +# You should unescape RegEx strings in order to fit in the YAML file +# To help with this, you can use https://www.freeformatter.com/json-escape.html +scopeRangeRegex: "(getScopedI18n|useScopedI18n)\\(\\s*['\"](.*?)['\"]\\)" + +# An array of strings containing refactor templates. +# The "$1" will be replaced by the keypath specified. +# Optional: uncomment the following two lines to use + +# refactorTemplates: +# - i18n.get("$1") + + +# If set to true, only enables this custom framework (will disable all built-in frameworks) +monopoly: true \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 28d5f189e..0cf8dc65f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,9 +27,12 @@ "Umami" ], "i18n-ally.dirStructure": "auto", - "i18n-ally.enabledFrameworks": ["next-intl"], - "i18n-ally.localesPaths": ["./packages/translation/src/lang/"], - "i18n-ally.enabledParsers": ["ts"], - "i18n-ally.extract.keyMaxLength": 0, - "i18n-ally.keystyle": "flat" + "i18n-ally.displayLanguage": "en", + "i18n-ally.enabledFrameworks": [ + "custom" + ], + "i18n-ally.localesPaths": [ + "packages/translation/src/lang", + ], + "i18n-ally.keystyle": "auto", }