Skip to content

Commit

Permalink
use i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
brandenrodgers committed Aug 21, 2024
1 parent ad680eb commit 7bda1dd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
30 changes: 13 additions & 17 deletions packages/cli/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { getIsInProject } = require('../lib/projects');
const pkg = require('../package.json');
const { i18n } = require('../lib/lang');
const { EXIT_CODES } = require('../lib/enums/exitCodes');
const { uiCommandReference } = require('../lib/ui');
const { UI_COLORS, uiCommandReference } = require('../lib/ui');

const removeCommand = require('../commands/remove');
const initCommand = require('../commands/init');
Expand Down Expand Up @@ -54,31 +54,27 @@ const i18nKey = 'commands.generalErrors';

const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';

const CMS_CLI_UPGRADE_MESSAGE =
chalk.bold('The CMS CLI is now the HubSpot CLI') +
`\n\nTo upgrade, uninstall ${chalk.bold(
CMS_CLI_PACKAGE_NAME
)} \nand then run ${uiCommandReference('{updateCommand}')}`;

const CLI_UPGRADE_MESSAGE = `HubSpot CLI version ${chalk.cyan(
chalk.bold('{currentVersion}')
)} is outdated. \nRun ${uiCommandReference(
'{updateCommand}'
)} to upgrade to version ${chalk.cyan(chalk.bold('{latestVersion}'))}`;

notifier.notify({
message:
pkg.name === CMS_CLI_PACKAGE_NAME
? CMS_CLI_UPGRADE_MESSAGE
: CLI_UPGRADE_MESSAGE,
? i18n(`${i18nKey}.updateNotify.cmsUpdateNotification`, {
packageName: CMS_CLI_PACKAGE_NAME,
updateCommand: uiCommandReference('{updateCommand}'),
})
: i18n(`${i18nKey}.updateNotify.cliUpdateNotification`, {
updateCommand: uiCommandReference('{updateCommand}'),
}),
defer: false,
boxenOptions: {
borderColor: '#FC9900',
borderColor: UI_COLORS.MARIGOLD_DARK,
margin: 1,
padding: 1,
textAlignment: 'center',
borderStyle: 'round',
title: pkg.name === CMS_CLI_PACKAGE_NAME ? null : 'Update available',
title:
pkg.name === CMS_CLI_PACKAGE_NAME
? null
: chalk.bold(i18n(`${i18nKey}.updateNotify.notifyTitle`)),
},
});

Expand Down
4 changes: 4 additions & 0 deletions packages/cli/lang/en.lyaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
en:
commands:
generalErrors:
updateNotify:
notifyTitle: "Update available"
cmsUpdateNotification: "{{#bold}}The CMS CLI is now the HubSpot CLI{{/bold}}\n\nTo upgrade, uninstall {{#bold}}{{ packageName }}{{/bold}}\nand then run {{ updateCommand }}"
cliUpdateNotification: "HubSpot CLI version {{#cyan}}{{#bold}}{currentVersion}{{/bold}}{{/cyan}} is outdated.\nRun {{ updateCommand }} to upgrade to version {{#cyan}}{{#bold}}{latestVersion}{{/bold}}{{/cyan}}"
srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
setDefaultAccountMoved: "This command has moved. Try `hs accounts use` instead"
accounts:
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hubspot/cli",
"version": "5.3.1",
"version": "5.3.0",
"description": "CLI for working with HubSpot",
"license": "Apache-2.0",
"repository": {
Expand Down

0 comments on commit 7bda1dd

Please sign in to comment.