Skip to content

Commit

Permalink
Add support for i18n-ally extension (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brainicism authored Jul 4, 2022
1 parent da49413 commit 4bd282c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"workspaceFolder": "/workspace",
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"lokalise.i18n-ally"
],
"remoteUser": "node"
}
27 changes: 27 additions & 0 deletions .vscode/i18n-ally-custom-framework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .vscode/i18n-ally-custom-framework.yml

# An array of strings which contain Language Ids defined by VS Code
# You can check avaliable language ids here: https://code.visualstudio.com/docs/languages/overview#_language-id
languageIds:
- typescript

# 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]LocalizationManager.localizer.translate\\([\\n\\r\\s]*.+,[\\n\\r\\s]*['\"`]({key})['\"`]"
- "[^\\w\\d]LocalizationManager.localizer.translateByLocale\\([\\n\\r\\s]*.+,[\\n\\r\\s]*['\"`]({key})['\"`]"
- "[^\\w\\d]LocalizationManager.localizer.internalLocalizer.t\\([\\n\\r\\s]*['\"`]({key})['\"`]"

# 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
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"files.insertFinalNewline": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib",
"i18n-ally.localesPaths": [
"i18n"
],
"i18n-ally.enabledParsers": ["json"]
}

0 comments on commit 4bd282c

Please sign in to comment.