Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Amir-61
Copy link
Contributor

@Amir-61 Amir-61 commented Jul 26, 2016

Add support for globalization

to:/ @0candy @superkhau PTAL

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!'));
Copy link
Contributor

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 !

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@Amir-61 Amir-61 self-assigned this Jul 26, 2016
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is id not %s?

@Amir-61 Amir-61 force-pushed the feature/add_globalization branch from 83fb9c8 to e4cbfd8 Compare July 26, 2016 21:25
@Amir-61
Copy link
Contributor Author

Amir-61 commented Jul 26, 2016

@0candy Thanks for the review. I applied all of your feedback.

.gitignore Outdated
.project
test/memory.json
intl/*
!intl/en
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

@Amir-61 Amir-61 Jul 27, 2016

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 :-)

@jannyHou
Copy link
Contributor

@Amir-61 I made some comments, most of them are reminders of g.f,so after you change all g.t those comments will fold. I also mentioned some words might need {{ }}, PTAL :)

@rmg
Copy link
Contributor

rmg commented Jul 27, 2016

@slnode test please

@Amir-61
Copy link
Contributor Author

Amir-61 commented Jul 27, 2016

@slnode test please

@rmg whatever you did was good 👏 Did you do a magic? 💥 Tests started passing; thanks!

@Amir-61
Copy link
Contributor Author

Amir-61 commented Jul 27, 2016

Thanks @jannyHou for taking the time to review this stuff.

@Amir-61 I made some comments, most of them are reminders of g.f

Well actually some folks told me both g.f and g.t are fine; the latter for just texts, whereas the former for texts with replacements like %s; however it seems many people prefer just g.f; sure I will change all of them to g.f.

Thanks!

@Amir-61 Amir-61 force-pushed the feature/add_globalization branch from ed05c44 to 4981836 Compare July 27, 2016 15:37
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!'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{{id}}

@Amir-61 Amir-61 force-pushed the feature/add_globalization branch 2 times, most recently from 6621262 to 4989287 Compare July 28, 2016 18:44
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var g = require('strong-globalize')();
Copy link
Contributor

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?

@superkhau
Copy link
Contributor

@Amir-61 Reviewed, minor, otherwise LGTM.

@Amir-61 Amir-61 force-pushed the feature/add_globalization branch from fc92f75 to 4ce5b5d Compare July 28, 2016 19:20
@Amir-61 Amir-61 merged commit 799d803 into master Jul 28, 2016
@Amir-61 Amir-61 deleted the feature/add_globalization branch July 28, 2016 21:00
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',
Copy link
Contributor

@Setogit Setogit Aug 2, 2016

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

@Amir-61 Amir-61 mentioned this pull request Aug 5, 2016
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

Successfully merging this pull request may close these issues.

8 participants