Code Monkey home page Code Monkey logo

Comments (13)

jamuhl avatar jamuhl commented on June 16, 2024

Can you try again but with setting i18n format to "other" in your locize project settings? If using default format (i18next) it will handle part after _ as context...I guess you're not using i18next as that format looks different -> so setting your project to other format should at least solve that issue.

from locize-cli.

RomaKozeko avatar RomaKozeko commented on June 16, 2024

I change project setting now it looks
image

But result not changed.
In locize:

"tied with %{count} other %{test_one} test": "à égalité avec %{count} other %{test_one} test",
"tied with %{count} other %{test_one} test_plural": "à égalité avec %{count} others %{test_one} test"

After download or sync:

msgctxt "one} test"
msgid "tied with% {count} other% {test"
msgid_plural "tied with% {count} other% {test"
msgstr [0] "à égalité avec% {count} other% {test_one} test"
msgstr [1] "à égalité avec% {count} others% {test_one} test"

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

Just had to confirm...detection of plural will automatically assume i18next format

We will need to see what we can do to avoid that handling...will ping you asap.

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

can you please try with [email protected]

from locize-cli.

RomaKozeko avatar RomaKozeko commented on June 16, 2024

I checked the new version of locize-cli. The problem with "msgctxt" is fixed.
But there was a problem with plural forms.
Initially we have:

msgid "tied with %{count} other %{test_one} test"
msgid_plural "tied with %{count} others %{test_one} test"
msgstr [0] "à égalité avec %{count} other %{test_one} test"
msgstr [1] "à égalité avec %{count} others %{test_one} test"

The values ​​in "msgid" and "msgid_plural" are different.
After downloading or synchronization, the plural keys are as follows:

msgid "tied with %{count} other %{test_one} test"
msgid_plural "tied with %{count} other %{test_one} test"
msgstr [0] "à égalité avec %{count} other %{test_one} test"
msgstr [1] "à égalité avec %{count} others %{test_one} test"

And when we try to get the plural translation by the key "tied with %{count} others %{test_one} test" we do not find it.

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

May I ask what framework you're using for i18n? As I understand pluralforms in gettext (PHP) it's like the accepted reply here: https://stackoverflow.com/questions/12121515/multiple-plural-forms-in-gettext

msgid "%d Comment"
msgid_plural "%d Comments"
msgstr[0] "%d Komentarz"
msgstr[1] "%d Komentarze"
msgstr[2] "%d Komentarzy"

from locize-cli.

RomaKozeko avatar RomaKozeko commented on June 16, 2024

We use https://github.com/grosser/gettext_i18n_rails
Yea this is pluralforms in gettext.
msgid and msgid_plural values are different. gettext stores two key values plural and singular "%d Comment" and "%d Comments".

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

while I understand it stores two keys (for translators) in the po file - I'm not sure that the plural key / msgid_plural is needed for the lookup for translations? Is that really the case...I was in the believe it uses the msgid to find a key and takes the right form based on the index in msgstr...?

from locize-cli.

RomaKozeko avatar RomaKozeko commented on June 16, 2024

I can’t say exactly how pluralforms in gettext work. But at the moment I can’t get the pluralform translation in this case:
ns _ ('tied with %{count} other', 'tied with %{count} others', advocate_count) % {count: advocate_count}
After finding translated strings with gettext_i18n_rails, we see different keys in msgid and msgid_plural. And after downloading from locize, the keys become the same. I would like them to stay different.

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

The current big problem is that for non singular/plural language we store the pluralforms in JSON format with suffixed key_0, key_1, ... reflecting the index used in gettext msgstr - so in those cases we do only have the msgid (=key) in singular. And there is no way to get that msgid_plural.

Can't you just call: ns _ ('tied with %{count} other', 'tied with %{count} other', advocate_count) % {count: advocate_count} in that case?

We will have to think of a solution for this one...but currently, I have no idea how to solve this - as we do not have the plural key/msgid_plural.

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

The only way I currently see is adding an option to combine msgid and msgid_plural into one json key instead of using msgid only...will need to create a PR in an upstream module...might take a few days to get that through...

from locize-cli.

RomaKozeko avatar RomaKozeko commented on June 16, 2024

Thank you!
I'll wait.

from locize-cli.

jamuhl avatar jamuhl commented on June 16, 2024

Could you please retry with: [email protected]

msgid "tied with% {count} other% {test_one} test"
msgid_plural "tied with% {count} others% {test_one} test"
msgstr [0] "à égalité avec% {count} other% {test_one} test"
msgstr [1] "à égalité avec% {count} others% {test_one} test"

results now in JSON

"tied with% {count} other% {test_one} test|#|tied with% {count} others% {test_one} test": "à égalité avec% {count} other% {test_one} test",
"tied with% {count} other% {test_one} test|#|tied with% {count} others% {test_one} test_plural": "à égalité avec% {count} others% {test_one} test"

So we can convert po -> JSON (locize UI) -> po keeping the msgid_plural by merging that into the JSON key.

from locize-cli.

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.