tolgee / tolgee-js

Tolgee JavaScript libraries monorepo
https://tolgee.io
MIT License
218 stars 24 forks source link

Defining `defaultVariables` value in Tolgee config #3292

Closed amir2mi closed 1 month ago

amir2mi commented 4 months ago
 interpolation: {
    defaultVariables: {
      brandName: 'test',
    },
  },

I did not find this option using solely Tolgee, it is available in i18next and helps to have minimal translations without the need to define some variables every time.

stepan662 commented 1 month ago

I don't like this approach very much, it makes things easier, but also can feel more like magic, because it makes it harder to see where is the parameter coming from. Also, you can do this easily by creating your custom T component or t function where you pass this manually.

stepan662 commented 1 month ago

What do you think @JanCizmar

JanCizmar commented 1 month ago

The only issue I see in creating the custom T or t is that the extractor wouldn't understand these. Apart from this I agree.

stepan662 commented 1 month ago

I'd be for making the extractor more relaxed, e.g. not to check where is the <T> component coming from.