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

Support ${...} format

Open jdimeo opened this issue 1 year ago • 12 comments

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 avatar Jun 11 '24 02:06 jdimeo

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

jdimeo avatar Jun 11 '24 02:06 jdimeo

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.

JanCizmar avatar Jun 11 '24 05:06 JanCizmar

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.

jdimeo avatar Jun 11 '24 13:06 jdimeo

Is there format support in API endpoints?

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

JanCizmar avatar Jun 11 '24 13:06 JanCizmar

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.

jdimeo avatar Jun 19 '24 11:06 jdimeo

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

JanCizmar avatar Jun 19 '24 11:06 JanCizmar

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

jdimeo avatar Jun 19 '24 11:06 jdimeo

Cool! I am adding this to the plan.

JanCizmar avatar Jun 19 '24 11:06 JanCizmar

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 20 '24 01:07 github-actions[bot]

Please don't close this yet! It's hopefully a low effort item that will add significant usability and data quality help to our translators

jdimeo avatar Jul 20 '24 01:07 jdimeo

Sorry! It won't be closed any more.

JanCizmar avatar Jul 22 '24 05:07 JanCizmar

By the way, using the new format feature out of the box even without support for ${ has already dramatically reduced translators disrupting our syntax during translation!

jdimeo avatar Aug 08 '24 13:08 jdimeo