Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mf format can't handle plurals #92

Open
iambibhas opened this issue Nov 4, 2020 · 4 comments
Open

mf format can't handle plurals #92

iambibhas opened this issue Nov 4, 2020 · 4 comments

Comments

@iambibhas
Copy link

Expected Behavior

I have this entry in my po file -

#: test/registry.py:63
msgid "You only have %1 lesson left to finish %2."
msgid_plural "You only have %1 lessons left to finish %2."
msgstr[0] "asd %1 %2"
msgstr[1] "asd %1 %2"
msgstr[2] "asd %1 asd %2"

#: test/registry.py:68
msgid "An access token is required to access this resource"
msgstr ""

which should convert to a format that works fine with both gettext() and ngettext() in gettext.js.

Actual Behavior

If I use raw format, it generates -

{ 
	"You only have %1 lesson left to finish %2.": [
      "You only have %1 lessons left to finish %2.",
      "asd %1 %2",
      "asd %1 %2",
      "asd %1 asd %2"
   ],
   "An access token is required to access this resource": [
      null,
      ""
   ],
   ...
}

Which, when using gettext.js, doesn't work with gettext(), and only works with ngettext(%s, 1) even for the singular value as the second string.

If I use mf format, it generates -

{
   "You only have %1 lesson left to finish %2.": "asd %1 %2",
   "An access token is required to access this resource": "",
   ...
}

Which works fine with gettext() in gettext.js, but the plural values are ignored when converting to json.

Steps to Reproduce

after following recommended workflow.

@nirajstockx
Copy link

@iambibhas I am also facing similar issue. Did you by chance get any solution for 'mf' not able to handle plurals?

@markerviolence
Copy link

Same problem

@matmarlow
Copy link

Same problem.

@hthetiot
Copy link

I think it's related to https://github.com/smhg/gettext-parser not this lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants