marhali / easy-i18n

This is a IntelliJ IDE based plugin for internationalization. Supports the most common translation file types.
MIT License
79 stars 24 forks source link

Disable type conversion #315

Open razorness opened 11 months ago

razorness commented 11 months ago

First of all: thank you for this plugin. It's really valuable.

But I have a feature request. In my usecase, I have a Vue project using vue-i18n. Everything is working fine, except one issue: your plugin does type conversion where it shouldn't. vue-i18n requires all translations to be string. Otherwise it doesn't get translated. But your plugin converts number like strings to numbers.

For example: I have dozens of positions where the address of the company gets displayed. My solution was to throw this into vue-i18n like everything else text related which gets displayed on the website. So I have a json like this:

{
    "company"        : {
        "city"         : "Berlin",
        "contactMail"  : "info{'@'}domain.com",
        "name"         : "Company GmbH",
        "phone"        : "+49 (0)30 1234 5678",
        "postalCode"   : "12345",
        "street"       : "John Doe Street",
        "streetNumber" : "42",
    }
}

Using easy-i18n produces this:

{
    "company"        : {
        "city"         : "Berlin",
        "contactMail"  : "info{'@'}domain.com",
        "name"         : "Company GmbH",
        "phone"        : "+49 (0)30 1234 5678",
        "postalCode"   : 12345, // number
        "street"       : "John Doe Street",
        "streetNumber" : 42, // number
    }
}

Result: vue-i18n cannot handle this. Given path (company.streetNumber) is not getting translated to 42.

It would be really nice to have an option to disable this conversion.

janekx21 commented 7 months ago

I have the same problem and its unusable in this state.

rozekfr commented 5 months ago

Same here

janekx21 commented 5 months ago

This write method must be changed de.marhali.easyi18n.io.parser.json.JsonMapper.write