-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: globalize messages from artifact generator #5163
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
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 |
|---|---|---|
|
|
@@ -498,11 +498,11 @@ module.exports = class RelationGenerator extends ArtifactGenerator { | |
| { | ||
| type: 'confirm', | ||
| name: 'registerInclusionResolver', | ||
| message: `Allow ${chalk.yellow( | ||
| this.artifactInfo.sourceModel, | ||
| )} queries to include data from related ${chalk.yellow( | ||
| this.artifactInfo.destinationModel, | ||
| )} instances?`, | ||
| message: g.f( | ||
| 'Allow %s queries to include data from related %s instances? ', | ||
|
Contributor
Author
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. |
||
| chalk.yellow(this.artifactInfo.sourceModel), | ||
| chalk.yellow(this.artifactInfo.destinationModel), | ||
| ), | ||
| default: true, | ||
| }, | ||
| ]); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,17 @@ module.exports = class ArtifactGenerator extends BaseGenerator { | |
| * >> Model MyModel will be created in src/models/my-model.model.ts | ||
| **/ | ||
| promptClassFileName(type, typePlural, name) { | ||
| utils.logClassCreation(type, typePlural, name, this.log.bind(this)); | ||
| this.log( | ||
|
Contributor
Author
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. |
||
| g.f( | ||
| '%s %s will be created in src/%s/%s.%s.ts', | ||
| utils.toClassName(type), | ||
| chalk.yellow(name), | ||
| typePlural, | ||
| chalk.yellow(utils.toFileName(name)), | ||
| type, | ||
| ), | ||
| ); | ||
| this.log(); | ||
| } | ||
|
|
||
| scaffold() { | ||
|
|
@@ -118,7 +128,7 @@ module.exports = class ArtifactGenerator extends BaseGenerator { | |
| this.log( | ||
| utils.toClassName(this.artifactInfo.type), | ||
| chalk.yellow(classesOutput), | ||
| classes.length > 1 ? 'were created in' : 'was created in', | ||
| classes.length > 1 ? g.f('were created in') : g.f('was created in'), | ||
|
Contributor
Author
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. |
||
| `${this.artifactInfo.relPath}/`, | ||
| ); | ||
| this.log(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ const chalk = require('chalk'); | |
| const latestVersion = require('latest-version'); | ||
|
|
||
| const cliPkg = require('../package.json'); | ||
| const g = require('./globalize'); | ||
| const templateDeps = cliPkg.config.templateDependencies; | ||
|
|
||
| /** | ||
|
|
@@ -102,13 +103,19 @@ async function checkDependencies(generator) { | |
| const originalCliVersion = generator.config.get('update') || '<unknown>'; | ||
| generator.log( | ||
| chalk.red( | ||
| `The project was originally generated by @loopback/cli@${originalCliVersion}.`, | ||
| g.f( | ||
|
Contributor
Author
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. |
||
| 'The project was originally generated by @loopback/cli@%s.', | ||
| originalCliVersion, | ||
| ), | ||
| ), | ||
| ); | ||
|
|
||
| generator.log( | ||
| chalk.red( | ||
| `The following dependencies are incompatible with @loopback/cli@${cliPkg.version}:`, | ||
| g.f( | ||
| 'The following dependencies are incompatible with @loopback/cli@%s:', | ||
| cliPkg.version, | ||
| ), | ||
| ), | ||
| ); | ||
| for (const d in incompatibleDeps) { | ||
|
|
@@ -172,24 +179,24 @@ async function checkLoopBackProject(generator) { | |
|
|
||
| const choices = [ | ||
| { | ||
| name: 'Upgrade project dependencies', | ||
| name: g.f('Upgrade project dependencies'), | ||
| value: 'upgrade', | ||
| }, | ||
| { | ||
| name: 'Skip upgrading project dependencies', | ||
| name: g.f('Skip upgrading project dependencies'), | ||
| value: 'continue', | ||
| }, | ||
| ]; | ||
| if (generator.command !== 'update') { | ||
| choices.unshift({ | ||
| name: 'Abort now', | ||
| name: g.f('Abort now'), | ||
| value: 'abort', | ||
| }); | ||
| } | ||
| const prompts = [ | ||
| { | ||
| name: 'decision', | ||
| message: `How do you want to proceed?`, | ||
| message: g.f('How do you want to proceed?'), | ||
| type: 'list', | ||
| choices, | ||
| default: 0, | ||
|
|
||




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.
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 "By disabling Camel case" supposed to still be in English?
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.
In the PR, they are supposed to be in English. And those screenshots are showing that the globalized string in English can be translated ( but we don't do the translation ourselves).