From 826d54a0cac4c117fab93b54409b79088f447031 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Sun, 23 Mar 2025 21:30:15 +0100 Subject: [PATCH] chore(i18n): update regex patterns for i18n-ally (#2685) --- .vscode/i18n-ally-custom-framework.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.vscode/i18n-ally-custom-framework.yml b/.vscode/i18n-ally-custom-framework.yml index 6cb944e00..1ee83bc7e 100644 --- a/.vscode/i18n-ally-custom-framework.yml +++ b/.vscode/i18n-ally-custom-framework.yml @@ -12,17 +12,17 @@ languageIds: # 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 + # For direct t("your.i18n.keys") usage - "[^\\w\\d]t\\(['\"`]({key})['\"`]" + # For variable t assigned from getScopedI18n or useScopedI18n + - "\\bt\\(['\"`]({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*['\"](.*?)['\"]\\)" +scopeRangeRegex: "(?:const|let|var)\\s+t\\s*=\\s*(?:await\\s+)?(?:getScopedI18n|useScopedI18n)\\(\\s*['\"](.*?)['\"]\\)" # An array of strings containing refactor templates. # The "$1" will be replaced by the keypath specified.