tolgee-js icon indicating copy to clipboard operation
tolgee-js copied to clipboard

i18n Ally compatibility

Open baptisteArno opened this issue 2 years ago • 3 comments

Is there any plan to make the SDK compatible with i18n-ally? Or maybe there's already a framework implementation that is close enough to the tolgee syntax?

I've been trying with react-i18next framework settings. It works fine for t('...') but not for <T keyName="...">

baptisteArno avatar Oct 18 '23 09:10 baptisteArno

Hey, I haven't investigated this yet. I guess it should be compatible with i18next.

The <T> component is not part of i18next.

stepan662 avatar Oct 18 '23 09:10 stepan662

We have a plan to make our own code editors plugins, since our flow is a bit different with context gathering and so on.

stepan662 avatar Oct 18 '23 09:10 stepan662

Here is a i18n-ally-custom-framework.yml file for Tolgee:

# 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:
  - 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\\([\\s\\n]*'({key})'"
  - 'keyName="({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

How to use it: https://github.com/lokalise/i18n-ally/wiki/Custom-Framework

baptisteArno avatar Oct 24 '23 09:10 baptisteArno