tolgee / tolgee-platform

Developer & translator friendly web-based localization platform
https://tolgee.io
Other
1.3k stars 101 forks source link

Support ${...} format #2362

Open jdimeo opened 3 weeks ago

jdimeo commented 3 weeks ago

We've discussed this before, but I don't think there is an outstanding issue (at least, I couldn't find it- apologies if it's a duplicate)

Please support ${...} placeholder syntax. This is very similar to the existing {...} but just adds a $. This is used in XLSForms, Java (like https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html and Maven) and is the standard in several contexts.

jdimeo commented 3 weeks ago

Oh I think this was already basically covered by: https://github.com/tolgee/tolgee-platform/issues/1574

JanCizmar commented 3 weeks ago

Hey! I closed the second issues. It's outdated. Anyway, we can add the support for import / export, is that what you're looking for? We decided to support only ICU in the UI and handle the conversion when importing / exporting strings. Adding support for your format would be simple, but the UI will always show visualized ICU syntax.

jdimeo commented 3 weeks ago

I only ever use API calls to manage our keys. Is there format support in API endpoints? I could hack it somewhat in my client code e.g. "replace ${ with {" but I would rather not do that since the logic may be brittle or error prone.

JanCizmar commented 3 weeks ago

Is there format support in API endpoints?

There is not. Would it be possible for you tu use the import & export endpoints?

jdimeo commented 2 weeks ago

In our case, no, we can't use import and export (not easily). We have very complicated business rules and are also copying keys between projects. We are continually syncing Tolgee with YAML files that are the master copy. So when a single new YAML file is added, API calls create the new key with all the metadata and start initializing different language codes, but only for active countries at the time, etc.

JanCizmar commented 2 weeks ago

OK, understood. Can you please specify the endpoints you're using, so we might add the messageFormat option there?

jdimeo commented 2 weeks ago

Well we use tons of endpoints since we use an access token and the full API with a generated client from the spec. But the key one is: https://tolgee.io/api/create-or-update-translations

JanCizmar commented 2 weeks ago

Cool! I am adding this to the plan.