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

Multiple Plural Forms #66

Open
grebenyuksv-preply opened this issue Jan 8, 2018 · 2 comments
Open

Multiple Plural Forms #66

grebenyuksv-preply opened this issue Jan 8, 2018 · 2 comments

Comments

@grebenyuksv-preply
Copy link

Dear maintainers, your libraries looks extensive, but I can't get it to work for languages which have more than one plural form. Here's my gulp task, just stolen from the example:

gulp.task('i18next', function() {
    return gulp.src(['frontend/js-webpack/react/**/*.{js,html}'])
        .pipe(scanner({
            lngs: ['en', 'de', 'ua', 'uk', 'ru'], // supported languages
            resource: {
                // the source path is relative to current working directory
                loadPath: 'assets/i18n/{{lng}}/{{ns}}.json',

                // the destination path is relative to your `gulp.dest()` path
                savePath: 'i18n/{{lng}}/{{ns}}.json'
            }
        }))
        .pipe(gulp.dest('assets'));
});

That results in the same file for all the locales, e.g. ru/translation.json:

{
  "Connected to": "",
  "Connected to_plural": ""
}

There should be keys like "Connected to_1", "Connected to_2", "Connected to_5", as described in the i18next docs. Am I missing something?

Thanks for you kind attention!

@cheton
Copy link
Member

cheton commented Jan 16, 2018

This feature is currently not implemented in i18next-scanner. Plural forms support is not hard to implement, you can refer to the code of i18next's pluralResolver:
https://github.com/i18next/i18next/blob/master/src/PluralResolver.js

I would appreciate it if someone can help improve plural forms support. PR is welcome.

@daliusd
Copy link
Contributor

daliusd commented Nov 30, 2018

@grebenyuksv-preply check newest version (2.9.0) 😏

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

3 participants