-
Notifications
You must be signed in to change notification settings - Fork 32
add translatePlural support with compiled plural functions #6
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
base: master
Are you sure you want to change the base?
Conversation
This allows for varying amounts of plural versions for different languages and uses a similar format as GNU gettext. I.e. there's a plural formula that determines the index of the plural form chosen, based on the number. |
ah :) good call. perhaps we should try and work it in to the regular translate() call, and just check for the new syntax with numeric values |
Yeah, I'm not set on the syntax, I've tried various ways and eventually just submitted this. I also plan to integrate lingo with jade so that you can compile language-specific templates and have templates automatically translated. This would be facilitated if jade and lingo would use the same syntax for string interpolation (jade uses |
yeah that would be sweet, I will try and toy around with this later. I think we should do it just through translate() but the syntax is fine IMO. maybe flip it so plural is first |
I used the order singular-plural because that seems to be the standard (e.g. gettext, Rails' i18n use that order). I'll write and rewrite some of the translation related code later today. |
…erpolation functions for regular (non-plural) strings, while short-circuiting strings without parameters for interpolation.
Now uses the absence of the |
Syntax:
"This post has #{comments:1 comment|@ comments}"