lokalise / i18n-ally-jetbrains-docs

6 stars 4 forks source link

React: How to setup localization tags (instead of function calls) #24

Open derwaldgeist opened 2 years ago

derwaldgeist commented 2 years ago

We're using an i18n library for React that supports two different formats:

  1. Function calls, e.g. i18n.__('Common.chats')
  2. Tags, e.g. <T>Common.chats</T>

I was able to configure i18nally for the first format, but cannot find any option to define tags for the second format. In VSCode, this was possible with a custom framework file, but there seems to be no support for these framework files in WebStorm.

Here's how I had set it up for VSCode:

usageMatchRegex:
  - "[^\\w\\d]i18n.__\\(['\"`]({key})['\"`]"
  - '<T[^>]*>({key})</T>'