txty-io / texterify

The translation and localization management system.
https://texterify.com
Other
175 stars 14 forks source link

How to import FormatJS (react-intl) messages #42

Closed delucca closed 3 years ago

delucca commented 3 years ago

Hi everyone!

Amazing tool :) We're evaluating using it in our international projects.

I'm trying to setup our account, but facing an issue. We're using react-intl as our token generator. That tool has some standards regarding message extraction/compilation that you can find here: https://formatjs.io/docs/getting-started/message-distribution

Basically, a react-intl token file is like the following:

{
  "hak27d": {
    "defaultMessage": "Panneau de configuration",
    "description": "title of control panel section"
  },
  "haqsd": {
    "defaultMessage": "Supprimer l'utilisateur {name}",
    "description": "delete button"
  },
  "19hjs": {
    "defaultMessage": "nouveau mot de passe",
    "description": "placeholder text"
  },
  "explicit-id": {
    "defaultMessage": "Confirmez le mot de passe",
    "description": "placeholder text"
  }
}

Where each item on the JSON file is a token, with a given ID, default message and description.

After importing it to Texterify, the name field is set to the ID accordingly, but the description field is empty and the value is set to the entire token, like the following:

{
  "defaultMessage": "Supprimer l'utilisateur {name}",
  "description": "delete button"
}

How can I customize it to identify accordingly the description and value fields? We can't afford restructuring our tokens since we have thousands of tokens and they're integrated with other platforms as well.

Thanks in advance!

chrztoph commented 3 years ago

Hi, thank you for the kind words! 🙂

Currently it is not possible to import files correctly in such a format. As you already figured out it imports JSON in the format <key>:<translation>, but it should not be a big deal to add the possibility to import files like this and also automatically set the description.

I will look into it next week if you don't want to add it yourself. 😉

If you have any further feedback or feature requests let me know.

delucca commented 3 years ago

Hi, thank you for the kind words! slightly_smiling_face

Currently it is not possible to import files correctly in such a format. As you already figured out it imports JSON in the format <key>:<translation>, but it should not be a big deal to add the possibility to import files like this and also automatically set the description.

I will look into it next week if you don't want to add it yourself. wink

If you have any further feedback or feature requests let me know.

Great! It would be awesome 😄

Since many developers user react-intl in their apps, I think that feature would be great for other users too :)

Looking forward for it!

chrztoph commented 3 years ago

Importing strings with the Format.js JSON format is now possible by selecting JSON Format.js in the new file format selection. I hope this now works for you and your team. Please let me know if you experience any difficulties or if you have further feedback.

image

Thank you for your feedback! 😄