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

Defining `defaultVariables` value in Tolgee config

Open amir2mi opened this issue 1 year ago • 6 comments

 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.

amir2mi avatar Jan 02 '24 09:01 amir2mi

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 avatar Apr 15 '24 10:04 stepan662

What do you think @JanCizmar

stepan662 avatar Apr 15 '24 10:04 stepan662

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.

JanCizmar avatar Apr 15 '24 11:04 JanCizmar

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

stepan662 avatar Apr 15 '24 11:04 stepan662

This hasn't been implemented, right? Issue was closed as completed, but I can't find anywhere how to do this.

empz avatar Sep 23 '24 09:09 empz

Hello, you are right. I can reopen this, but I'm still not sure if it's a good approach. Global settings are powerful, however make it harder for code readability.

stepan662 avatar Sep 23 '24 11:09 stepan662