Git Product home page Git Product logo

Comments (3)

JanCizmar avatar JanCizmar commented on July 28, 2024

Hey! This behaviour is actualy expected. The example_params.po file contains also sprintf params (e.g., %s, %d), and this message format was detected under the hood.

Are you encountering such issue with another file?

As a workaround you can use Tolgee CLI, or our single step import REST API endpoint. It enables you to force specific message format.

Docs for format option of the CLI: https://tolgee.io/tolgee-cli/project-configuration#format
Single step import endpoint docs: https://tolgee.io/api/do-import

from tolgee-platform.

sinukaarel avatar sinukaarel commented on July 28, 2024

Yes, the sprintf variables seem to be picked up and converted just fine. It might be a conflict of two formats being used simultaneously.

Another example is a .po file consisting of only one message in ICU format.

msgid ""
msgstr ""
"Project-Id-Version: Tolgee 1.0.1\n"
"Report-Msgid-Bugs-To: [email protected] \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgid "welcome"
msgstr "Willkommen, {name}"

Using the single-step endpoint with the PO_ICU format still gives the same result. The resulting translations ICU token is escaped.
image

Exporting the same translation with "format":"PO", "messageFormat:"ICU" however, results as correctly formatted message, same as the input.

msgid ""
msgstr ""
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals = 2; plural = (n !== 1)\n"
"X-Generator: Tolgee\n"

msgid "welcome"
msgstr "Willkommen, {name}"

When I correct the translation value in UI to reflect that the {name} is a placeholder by removing ' around brackets. Then, the UI reflects that the value is a placeholder and the exported result is the same as before.

image

So I still think that the import adds unnecessary escape characters around ICU formatted value brackets, resulting in UI not displaying the value properly. The import should result in the final image, not the first one.

from tolgee-platform.

JanCizmar avatar JanCizmar commented on July 28, 2024

Hey, you're right the new example, you've provided seems like a bug. I have reproduced it 👍

Please let me look into that :)

from tolgee-platform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.