-
Notifications
You must be signed in to change notification settings - Fork 25
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
Write proper plural msgstr[0] #24
Conversation
Other code was already depending on Object.keys() and Array.prototype.filter(), which are also ES5 along with Array.isArray().
Love it! I normally hate it as well when people tack on extra changes, but let's admit it: some maintenance was probably overdue (sucks that we have to do it though!). See no reason not to merge it. |
Thanks for the quick merge! |
Published to NPM as |
Poedit dev here. My understanding of the file format is that this is still incorrect, the number of
by it. Poedit tries not to choke on bad inputs, so that alone is not proof of correctness ;)
GNU gettext manual is indeed not very good as a PO format reference. It's best to consult "official" GNU gettext tools' output as examples or consult Pology's unofficial, but great PO format reference. |
@vslavik Thanks for weighing in! |
Thanks @vslavik! After testing, I think you are correct about the number of messages.po file (i.e., POT), generated by
zh-CN.po file (
pl-PL.po file (
So the reason my PR worked for me was that zh-CN was the only problem language in my project. Whoops. 😊 I'll work on getting another PR soon to output the proper number based on |
Fixes the same problem as #21 (with tests!).
Before this PR, untranslated plurals were written as follows:
POEdit is unable to open a file containing such plural entries. And gettext utility
msgcat
throws the following error when trying to read the file:My change will generate this result:
The gettext docs aren't totally clear on this point, but that does appear to be the correct syntax. And neither
msgcat
nor POEdit throw any errors when reading that kind of plural entry.This PR has a couple other mostly-unrelated changes. (Sorry! I normally hate that.)
devDependencies
because I couldn't evennpm install
with the previous onesgrunt-jscs-checker
was renamed togrunt-jscs
(jscs-dev/grunt-jscs@033b836)alias
option ingrunt-browserify
doesn't seem necessary anymore? Browserify v3 was 3+ years ago now!lodash.isarray
in favor of the nativeArray.isArray
. There was already code depending onObject.keys
andArray.prototype.filter
(https://github.com/rubenv/pofile/blob/v1.0.2/lib/po.js#L309), which are also ES5-only, so I didn't see any reason to not useArray.isArray
.I would be happy to remove any of those changes if you want a cleaner PR. Just let me know!