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

msgplural index parsing logic is wrong #14

Open
rsun-wish opened this issue May 12, 2022 · 0 comments
Open

msgplural index parsing logic is wrong #14

rsun-wish opened this issue May 12, 2022 · 0 comments

Comments

@rsun-wish
Copy link

rsun-wish commented May 12, 2022

https://github.com/chai2010/gettext-go/blob/master/po/message.go#L134

In the case where msgstr contains square brackets, the parsed index value would always be 0.

Example:

msgctxt "NAME OF BUTTON MERCHANTS CAN CLICK TO DOWNLOAD ALL THEIR PRODUCTS AS AN CSV "
"FILE. INCLUDED IS THE NAME OF THE WAREHOUSE AND THE NUMBER OF ROWS THAT WILL "
"BE IN THE FILE."
msgid "Download CSV [{%2=warehouse name}] ({%1=number of products} row)"
msgid_plural "Download CSV [{%2=warehouse name}] ({%1=number of products} rows)"
msgstr	[0] "Baix[1]ar CSV [{%2=warehouse name}] ({%1=number of products} linha)"
msgstr		[1] "Baix[2]ar CSV [{%2=warehouse name}] ({%1=number of products} linhas)"

The expected length of Message.MsgStrPlural should be 2 but the actual result is 1 because the message contains square brackets.

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

1 participant