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

Support for ngettext #51

Closed
justinvdm opened this issue Feb 20, 2014 · 7 comments
Closed

Support for ngettext #51

justinvdm opened this issue Feb 20, 2014 · 7 comments

Comments

@justinvdm
Copy link
Contributor

@BYK Was wondering if you have plans to support ngettext (and possibly dgettext and its other friends)?

@BYK
Copy link
Collaborator

BYK commented Feb 20, 2014

We definitely should, I just don't have enough resources right now though :(

@justinvdm
Copy link
Contributor Author

Ah, cool. We could try help out on this if you like? We just need to know how you would like things to look from the user's perspective.

For example, there is currently a keyword option to look for a different symbol than 'gettext', but that'd need to change once we add ngettext and friends. We could either add a keyword option for each (which sounds a little weird I think), or instead change keyword to look up the object that the gettext methods were called on. So, for example, if keyword was _, we would look for _.gettext, ..., _.ngettext.

Let me know me what you think :)

@BYK
Copy link
Collaborator

BYK commented Feb 20, 2014

I'd say we should look for 'n' + keyword and 'd' + keyword when we add those. Also it looks like they'll need somewhat different parsing logic than the current gettext implementation so I think they should be in their respective functions.

@TeaSeaLancs
Copy link

Hi, i'm not sure how much further you've got with adding this functionality, however i've implemented rudimentary support for ngettext this afternoon on my local project.

The solution I went with with regards to the keywords debate above was to follow the keyword spec syntax that xgettext itself uses. For example, this would specify a standard translation keyword of "tr" and a plural translation keyword of "trn":

['tr','trn:1,2']

Obviously this hasn't proceeded any further than the rudimentary support that I need but hopefully i've done it in such a way that makes the logic easy to extend for adding context support, etc.

I've pushed the changes into my fork at https://github.com/TeaSeaLancs/jsxgettext if you care to take a look :)

@ArmorDarks
Copy link

So, gettext plurals doesn't work currently in jsxgettext?

@BYK
Copy link
Collaborator

BYK commented Feb 21, 2015

Yup, unfortunately :(

On Fri, Feb 20, 2015, 11:39 Serj Lavrin notifications@github.com wrote:

So, gettext plurals doesn't work currently in jsxgettext?


Reply to this email directly or view it on GitHub
#51 (comment).

@ArmorDarks
Copy link

that's nice, thanks!

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

4 participants