Support pluralization #1
Comments
I will try to combine current loader with external solution http://i18next.com/pages/doc_features.html |
That might be a great solution. |
@ronkorving It will be available on this weekends. Only small improvements left. |
Are you saying you almost have a radically new version of i18-webpack-plugin ready? One that depends on i18next-node? |
@ronkorving Yes. Webpack generate bundle for each language using i18next-node. Static text already replaced completely as in current plugin but with additional i18next options. Plurals we must left as expression and replace dynamically on client side, Now I working on including language files and i18next module to the bundles. Unfortunately webpack doesn't has documentation for that. |
Yeah, Webpack documentation on authoring plugins is very limited. I really appreciate your work on this, and can't wait to see the result! Thanks a lot, really. |
Is this being worked on anymore? |
@martyphee simple language bundles generation done, plurals must work only dynamic with i18next module. At this point I stop development of this feature. I can create gist with example |
Sure that would be great. On Friday, January 22, 2016, Max Mykhailenko notifications@github.com
|
@max-mykhailenko I'd also like to see a gist of this |
Sorry for delay https://gist.github.com/max-mykhailenko/64ce006f9febe4f0dbe6 |
Thank you for the Gist. It's very helpful On Wed, Feb 17, 2016 at 8:53 PM, Max Mykhailenko notifications@github.com
|
Thanks for the gist. Are you planning on opening a pull request to add this to the plugin? Or do you have your own version of the plugin that you'll release? |
@karlhorky Actually I don't understand how I can combine |
I'm not sure you need to generate the json yourself - that can be part of a different plugin, loader, etc. For instance, take a look at the i18n example. This plugin just reads in an existing json file. I took a quick look at the plugin code, and it seems to me the correct way to go about it would be this:
The question would be if |
Alternately, the |
@karlhorky I think, the i18n plugin should support Jed style functions. Personally, I'd expect it to handle proper pluralization and contexts. Contexts are an important feature, because translations might be totally different based on the context they occur. That's probably something that native speaker tend to underestimate. So, basically we should provide these functions: gettext = function ( key )
dgettext = function ( domain, key )
ngettext = function ( singular_key, plural_key, value )
dngettext = function ( domain, singular_ley, plural_key, value )
pgettext = function ( context, key )
dpgettext = function ( domain, context, key )
npgettext = function ( context, singular_key, plural_key, value )
dnpgettext = function ( domain, context, singular_key, plural_key, value ) I know, the function names are kind of weird, but they are already well-known across different languages. I think that should be doable with the current implementation. To simplify the implementation, that should probably be a breaking change. |
So as to my proposal above, we would:
Would you leverage a library such as |
I would suggest On Fri, Feb 19, 2016 at 11:15 AM, Karl Horky notifications@github.com
|
What's the status of this issue? Any progress since last year? |
Hi, I made a small attempt to implement the dynamic keys: #42 I would like to have someone to look at it. |
https://developer.mozilla.org/en-US/docs/Localization_and_Plurals
The text was updated successfully, but these errors were encountered: