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

i18n does not support the objectNotation config option #1878

Closed
davesag opened this issue Jun 21, 2014 · 3 comments
Closed

i18n does not support the objectNotation config option #1878

davesag opened this issue Jun 21, 2014 · 3 comments

Comments

@davesag
Copy link
Contributor

davesag commented Jun 21, 2014

As discussed in this Stackoverflow question, I can't work out how to get Sails' i18n to support anything other than the most trivial of i18n examples.

I've had a look through the code, and, looking at lines 54 to 59 of sails/lib/hooks/i18n/index.js the configuration I set in my projects own config/i18n.js file, namely:

module.exports.i18n = {
  locales: ['en', 'es', 'fr', 'de'],
  objectNotation: true
};

are indeed passed through to the i18n.configure() method, but still I can't actually use the objectNotation options. I just get my keys returned back to me.

I've generated a new Sails project that demonstrates this error. See https://github.com/davesag/sails-i18n-example

In view homepage.jade

In config/i18n.js

https://github.com/davesag/sails-i18n-example/blob/master/config/i18n.js#L17 shows that the objectNotation: true flag is set.

In config/locales/en.json

https://github.com/davesag/sails-i18n-example/blob/master/config/locales/en.json#L4 shows the expected translation.

@mdunisch
Copy link
Contributor

+1
We have the same Problem

@davesag
Copy link
Contributor Author

davesag commented Jun 23, 2014

It might actually make more sense to include i18next rather than the old i18n-node package. Just a thought.

@davesag
Copy link
Contributor Author

davesag commented Jun 23, 2014

Okay I have worked out what's wrong. The objectNotation feature was added to i18n-node in version 0.5.0 about a week ago, and the version in Sails.js's package.js is 0.4.1

sgress454 added a commit that referenced this issue Jun 26, 2014
updated i18n to 0.5.0 to fix #1878
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants