-
Notifications
You must be signed in to change notification settings - Fork 367
Support for globalization #1022
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
Conversation
lib/connectors/memory.js
Outdated
| Memory.prototype.updateAttributes = function updateAttributes(model, id, data, options, cb) { | ||
| if (!id) { | ||
| var err = new Error('You must provide an id when updating attributes!'); | ||
| var err = new Error(g.t('You must provide an id when updating attributes!')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we don't use g.t anymore !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both are fine based on our today morning conversation with @0candy
CC: @superkhau
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@loay @Amir-61 Please refer to https://github.com/strongloop-internal/loopback-knowledge-base/blob/master/globalization.md for specifics. It's already been updated to reflect the fact we do not use g.t anymore -- that file is your source of truth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll change them to g.f then.
lib/dao.js
Outdated
| var modelName = ctx.method.sharedClass.name; | ||
| var id = ctx.getArgByName('id'); | ||
| var msg = 'Unknown "' + modelName + '" id "' + id + '".'; | ||
| var msg = g.f('Unknown "%s" id "%i".', modelName, id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is id not %s?
83fb9c8 to
e4cbfd8
Compare
|
@0candy Thanks for the review. I applied all of your feedback. |
.gitignore
Outdated
| .project | ||
| test/memory.json | ||
| intl/* | ||
| !intl/en |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one empty line at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not bikeshed on changes like this. It'll work as long as it's listed in the file somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I added an empty line at the end of file; not sure why it does not show it here.
It shows it now :-)
|
@Amir-61 I made some comments, most of them are reminders of |
|
@slnode test please |
|
Thanks @jannyHou for taking the time to review this stuff.
Well actually some folks told me both Thanks! |
ed05c44 to
4981836
Compare
lib/connectors/transient.js
Outdated
| Transient.prototype.updateAttributes = function updateAttributes(model, id, data, cb) { | ||
| if (!id) { | ||
| var err = new Error('You must provide an id when updating attributes!'); | ||
| var err = new Error(g.f('You must provide an id when updating attributes!')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{id}}
6621262 to
4989287
Compare
| // This file is licensed under the MIT License. | ||
| // License text available at https://opensource.org/licenses/MIT | ||
|
|
||
| var g = require('strong-globalize')(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this is probably better in the long run since its a one liner versus two. @0candy Thoughts?
|
@Amir-61 Reviewed, minor, otherwise LGTM. |
fc92f75 to
4ce5b5d
Compare
| if (isNaN(offset) || offset < 0 || Math.ceil(offset) !== offset) { | ||
| err = new Error(util.format('The offset/skip parameter %j is not valid', | ||
| filter.skip || filter.offset)); | ||
| err = new Error(g.f(util.format('The {{offset/skip}} parameter %j is not valid', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string won't be translated.
solution is simply: util.format ---> g.f
Add support for globalization
to:/ @0candy @superkhau PTAL