Replies: 3 comments 11 replies
-
For me, the main win here is to be able to plug a site into services like https://crowdin.com. So, if it is a two-way translation layer (no pun intended) I guess you get best of two worlds. |
Beta Was this translation helpful? Give feedback.
-
@ivanhofer I am trying to integrate this library with Lokalise that might be the replacement for an old RMS that we have. I did an export, and upload the file to Lokalise in 1.6 seconds 🥇 Now looking at the result (still not sure how to tweak one and the other) I find a "problem" with the Lokalise supports ICU messages: https://unicode-org.github.io/icu/userguide/format_parse/messages/#messageformat For example like this: https://docs.lokalise.com/en/articles/5042246-application-resource-bundle-arb What is your opinion here? Are you thinking in some kind of configuration to select the used format or an adapter pattern to apply conversions at import/export? It might be better (if configured) to use ICU format, then a dev will write code in such way and if read the translations in the translations' provider also match. But probably you foresee some other edge cases. |
Beta Was this translation helpful? Give feedback.
-
Hi @artola,
Like all decisions, there are always tradeoffs. In this case it's beeing incompatible with other formats. I haven't spent time yet on writing a converter for different formats. But my solution would be to have a process like this:
And of course also the other way around to sync translations from code to Each message syntax would require to have a "convert SYNTAX to object representation" and "convert object representation to SYNTAX". With this approach a lot of different syntaxes could be supported. An open question remains what to do with concepts that are not supported in both syntaxes. But I do not expect this to be a major problem. The solution above would be the easiest to implement, because the actual runtime could stay the same. I am aware that the used syntax of |
Beta Was this translation helpful? Give feedback.
-
typesafe-i18n
currently uses it's own syntax for writing translation messages. This has a few reasons:No overly complex code is neededd.
typesafe-i18n
is lightweight. The parser + runtime are less tahn 1kb small. Alone the parser for the ICU format is about 7.8kb big (https://bundlephobia.com/package/@formatjs/[email protected])I (personally) find the ICU message syntax not so easy to read. Especially for more complex translations
But not all people may like or due to business reasons can use the
typesafe-i18n
syntax. By providing the option to choose a format,typesafe-i18n
could e accessible to more users.How this could work:
typesafe-i18n
uses, so no ICU parser is needed on runtime. The code that is running in the browser doesn't care i what format the translations are written because it always get's the same object-structure.Beta Was this translation helpful? Give feedback.
All reactions