-
Notifications
You must be signed in to change notification settings - Fork 70
Add globalization #202
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
Add globalization #202
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,3 +28,6 @@ temp/ | |
| test/sandbox | ||
| test/.pkgcache/ | ||
| .pkgcache/ | ||
| !intl/ | ||
| intl/* | ||
| !intl/en/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ | |
| // License text available at https://opensource.org/licenses/MIT | ||
|
|
||
| 'use strict'; | ||
|
|
||
| var SG = require('strong-globalize'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor comment: no need to have |
||
| var g = SG(); | ||
|
|
||
| var helpers = require('../lib/helpers'); | ||
| var path = require('path'); | ||
| var yeoman = require('yeoman-generator'); | ||
|
|
@@ -15,7 +19,7 @@ module.exports = yeoman.Base.extend({ | |
| yeoman.Base.apply(this, arguments); | ||
|
|
||
| this.argument('name', { | ||
| desc: 'Name of the boot script to create.', | ||
| desc: g.f('Name of the boot script to create.'), | ||
| required: false, | ||
| optional: true, | ||
| type: String, | ||
|
|
@@ -33,7 +37,7 @@ module.exports = yeoman.Base.extend({ | |
|
|
||
| var question = { | ||
| name: 'name', | ||
| message: 'Enter the script name (without `.js`):', | ||
| message: g.f('Enter the script name (without {{`.js`}}):'), | ||
| default: this.name, | ||
| validate: validateRequiredName, | ||
| }; | ||
|
|
@@ -47,9 +51,11 @@ module.exports = yeoman.Base.extend({ | |
| askForType: function() { | ||
| var question = { | ||
| name: 'type', | ||
| message: 'What type of boot script do you want to generate?', | ||
| message: g.f('What type of boot script do you want to generate?'), | ||
| type: 'list', | ||
| choices: ['async', 'sync'], | ||
| choices: [ | ||
| {name: g.f('async'), value: 'async'}, | ||
| {name: g.f('sync'), value: 'sync'}], | ||
| default: 'async', | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ | |
| // License text available at https://opensource.org/licenses/MIT | ||
|
|
||
| 'use strict'; | ||
|
|
||
| var SG = require('strong-globalize'); | ||
| var g = SG(); | ||
|
|
||
| var chalk = require('chalk'); | ||
| var yeoman = require('yeoman-generator'); | ||
| var extend = require('util')._extend; | ||
|
|
@@ -29,7 +33,7 @@ module.exports = yeoman.Base.extend({ | |
| yeoman.Base.apply(this, arguments); | ||
|
|
||
| this.argument('name', { | ||
| desc: 'Name of the data-source to create.', | ||
| desc: g.f('Name of the data-source to create.'), | ||
| required: false, | ||
| type: String, | ||
| }); | ||
|
|
@@ -48,8 +52,8 @@ module.exports = yeoman.Base.extend({ | |
|
|
||
| this.listOfAvailableConnectors = list.map(function(c) { | ||
| var support = c.supportedByStrongLoop ? | ||
| ' (supported by StrongLoop)' : | ||
| ' (provided by community)'; | ||
| g.f(' (supported by StrongLoop)') : | ||
| g.f(' (provided by community)'); | ||
| return { | ||
| name: c.description + support, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A minor globalization issue here is the concatenation This particular case is not a problem. String concatenation in code is one of the typical globalization bugs. |
||
| value: c.name, | ||
|
|
@@ -74,7 +78,7 @@ module.exports = yeoman.Base.extend({ | |
| var prompts = [ | ||
| { | ||
| name: 'name', | ||
| message: 'Enter the data-source name:', | ||
| message: g.f('Enter the data-source name:'), | ||
| default: this.name, | ||
| validate: validateRequiredName, | ||
| }, | ||
|
|
@@ -93,15 +97,16 @@ module.exports = yeoman.Base.extend({ | |
| var prompts = [ | ||
| { | ||
| name: 'connector', | ||
| message: 'Select the connector for ' + displayName + ':', | ||
| message: g.f('Select the connector for %s:', displayName), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, this is the case of |
||
| type: 'list', | ||
| default: 'memory', | ||
| choices: connectorChoices, | ||
| }, | ||
| { | ||
| name: 'customConnector', | ||
| message: | ||
| 'Enter the connector name without the loopback-connector- prefix:', | ||
| g.f('Enter the connector name without the ' + | ||
| '{{loopback-connector-}} prefix:'), | ||
| validate: validateRequiredName, | ||
| when: function(answers) { | ||
| return answers.connector === 'other'; | ||
|
|
@@ -166,7 +171,7 @@ module.exports = yeoman.Base.extend({ | |
| if (!prompts.length && !warnings.length) | ||
| return; | ||
|
|
||
| this.log('Connector-specific configuration:'); | ||
| this.log(g.f('Connector-specific configuration:')); | ||
| if (!prompts.length) return reportWarnings(); | ||
|
|
||
| return this.prompt(prompts).then(function(props) { | ||
|
|
@@ -210,7 +215,7 @@ module.exports = yeoman.Base.extend({ | |
| var prompts = [ | ||
| { | ||
| name: 'installConnector', | ||
| message: 'Install ' + npmModule, | ||
| message: g.f('Install %s', npmModule), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| type: 'confirm', | ||
| default: true, | ||
| }, | ||
|
|
||
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.
And maybe wrap {{API Designer}} ?