Skip to content

Commit

Permalink
Merge pull request #5 from RedisInsight/feature/add_l10n_to_cli
Browse files Browse the repository at this point in the history
#RIV-3 - added l10n translations
  • Loading branch information
tsikhan-koktysh authored Nov 17, 2023
2 parents 6fb5bf8 + dd017e4 commit e8dde1f
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 22 deletions.
79 changes: 79 additions & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,85 @@
"loading...": "loading...",
"key(s)": "key(s)",
"Something was wrong!": "Something was wrong!",
"Connected.": "Connected.",
"Ready to execute commands.": "Ready to execute commands.",
"Try /Context: Try \"Workbench\", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.": {
"message": "Try ",
"comment": [
"Context: Try \"Workbench\", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities."
]
},
", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities./Context: Try \"Workbench\", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.": {
"message": ", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.",
"comment": [
"Context: Try \"Workbench\", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities."
]
},
"Connecting...": "Connecting...",
"Pinging Redis server on ": "Pinging Redis server on ",
" is not supported by the RedisInsight CLI. The list of all unsupported commands: /Example: INFO is not supported by the RedisInsight CLI. The list of all unsupported commands: ...": {
"message": " is not supported by the RedisInsight CLI. The list of all unsupported commands: ",
"comment": [
"Example: INFO is not supported by the RedisInsight CLI. The list of all unsupported commands: ..."
]
},
" is not supported by the Workbench. The list of all unsupported commands: /Example: AUTH is not supported by the Workbench. The list of all unsupported commands: ...": {
"message": " is not supported by the Workbench. The list of all unsupported commands: ",
"comment": [
"Example: AUTH is not supported by the Workbench. The list of all unsupported commands: ..."
]
},
"Invalid repeat command option value": "Invalid repeat command option value",
"Client connection previously closed. Run the command after the connection is re-created.": "Client connection previously closed. Run the command after the connection is re-created.",
"Unable to decrypt. Check the system keychain or re-run the command.": "Unable to decrypt. Check the system keychain or re-run the command.",
"Use /Context: Use \"Pub/Sub\" to see the messages published to all channels in your database.": {
"message": "Use ",
"comment": [
"Context: Use \"Pub/Sub\" to see the messages published to all channels in your database."
]
},
" to see the messages published to all channels in your database./Context: Use \"Pub/Sub\" to see the messages published to all channels in your database.": {
"message": " to see the messages published to all channels in your database.",
"comment": [
"Context: Use \"Pub/Sub\" to see the messages published to all channels in your database."
]
},
"Use /Use \"Pub/Sub\" tool to subscribe to channels.": {
"message": "Use ",
"comment": [
"Use \"Pub/Sub\" tool to subscribe to channels."
]
},
" tool to subscribe to channels./Use \"Pub/Sub\" tool to subscribe to channels.": {
"message": " tool to subscribe to channels.",
"comment": [
"Use \"Pub/Sub\" tool to subscribe to channels."
]
},
"Use /Context: Use \"Profiler\" tool to see all the requests processed by the server.": {
"message": "Use ",
"comment": [
"Context: Use \"Profiler\" tool to see all the requests processed by the server."
]
},
" tool to see all the requests processed by the server./Context: Use \"Profiler\" tool to see all the requests processed by the server.": {
"message": " tool to see all the requests processed by the server.",
"comment": [
"Context: Use \"Profiler\" tool to see all the requests processed by the server."
]
},
"RedisInsight does not support /Context: RedisInsight does not support \"RESP3\" at the moment, but we are working on it.": {
"message": "RedisInsight does not support ",
"comment": [
"Context: RedisInsight does not support \"RESP3\" at the moment, but we are working on it."
]
},
" at the moment, but we are working on it./Context: RedisInsight does not support \"RESP3\" at the moment, but we are working on it.": {
"message": " at the moment, but we are working on it.",
"comment": [
"Context: RedisInsight does not support \"RESP3\" at the moment, but we are working on it."
]
},
"Scan more": "Scan more",
"Keys are the foundation of Redis.": "Keys are the foundation of Redis.",
"No results found.": "No results found."
Expand Down
65 changes: 45 additions & 20 deletions src/webviews/src/constants/cli/cliOutputComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Fragment } from 'react'
import { Link } from 'react-router-dom'
import * as l10n from '@vscode/l10n'
import { getRouterLinkProps } from 'uiSrc/services'
import { getDbIndex } from 'uiSrc/utils'

Expand All @@ -13,7 +14,10 @@ export const InitOutputText = (
<Fragment key={Math.random()}>
{emptyOutput && (
<span className="color-green" key={Math.random()}>
{'Try '}
{l10n.t({
message: 'Try ',
comment: 'Context: Try "Workbench", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.',
})}
<Link
onClick={onClick}
className="color-green"
Expand All @@ -23,38 +27,47 @@ export const InitOutputText = (
>
Workbench
</Link>
, our advanced CLI. Check out our Quick Guides to learn more about Redis
capabilities.
{l10n.t({
message: ', our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.',
comment: 'Context: Try "Workbench", our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.',
})}
</span>
)}
</Fragment>,
'\n',
'Connecting...',
l10n.t('Connecting...'),
'\n',
'Pinging Redis server on ',
l10n.t('Pinging Redis server on '),
<span color="default" key={Math.random()}>
{/* TODO: Remove mock after implementing DB connection: */}
redis-12871.c309.us-east-2-1.ec2.cloud.redislabs.com:12871
{`${host}:${port}${getDbIndex(dbIndex)}`}
</span>,
]

const unsupportedCommandTextCli = ' is not supported by the RedisInsight CLI. The list of all unsupported commands: '
const unsupportedCommandTextWorkbench = ' is not supported by the Workbench. The list of all unsupported commands: '
const unsupportedCommandTextCli = l10n.t({
message: ' is not supported by the RedisInsight CLI. The list of all unsupported commands: ',
comment: 'Example: INFO is not supported by the RedisInsight CLI. The list of all unsupported commands: ...',
})
const unsupportedCommandTextWorkbench = l10n.t({
message: ' is not supported by the Workbench. The list of all unsupported commands: ',
comment: 'Example: AUTH is not supported by the Workbench. The list of all unsupported commands: ...',
})
// eslint-disable-next-line react-refresh/only-export-components
export const cliTexts = {
CLI_UNSUPPORTED_COMMANDS: (commandLine: string, commands: string) =>
commandLine + unsupportedCommandTextCli + commands,
WORKBENCH_UNSUPPORTED_COMMANDS: (commandLine: string, commands: string) =>
commandLine + unsupportedCommandTextWorkbench + commands,
REPEAT_COUNT_INVALID: 'Invalid repeat command option value',
CONNECTION_CLOSED:
'Client connection previously closed. Run the command after the connection is re-created.',
UNABLE_TO_DECRYPT:
'Unable to decrypt. Check the system keychain or re-run the command.',
REPEAT_COUNT_INVALID: l10n.t('Invalid repeat command option value'),
CONNECTION_CLOSED: l10n.t('Client connection previously closed. Run the command after the connection is re-created.'),
UNABLE_TO_DECRYPT: l10n.t('Unable to decrypt. Check the system keychain or re-run the command.'),
PSUBSCRIBE_COMMAND: (path: string = '') => (
<span color="danger" key={Date.now()}>
{'Use '}
{l10n.t({
message: 'Use ',
comment: 'Context: Use "Pub/Sub" to see the messages published to all channels in your database.',
})}
<Link
{...getRouterLinkProps(path)}
color="text"
Expand All @@ -63,12 +76,15 @@ export const cliTexts = {
>
Pub/Sub
</Link>
{' to see the messages published to all channels in your database.'}
{l10n.t({
message: ' to see the messages published to all channels in your database.',
comment: 'Context: Use "Pub/Sub" to see the messages published to all channels in your database.',
})}
</span>
),
SUBSCRIBE_COMMAND: (path: string = '') => (
<span color="danger" key={Date.now()}>
{'Use '}
{l10n.t({ message: 'Use ', comment: 'Use "Pub/Sub" tool to subscribe to channels.' })}
<Link
{...getRouterLinkProps(path)}
color="text"
Expand All @@ -77,7 +93,7 @@ export const cliTexts = {
>
Pub/Sub
</Link>
{' tool to subscribe to channels.'}
{l10n.t({ message: ' tool to subscribe to channels.', comment: 'Use "Pub/Sub" tool to subscribe to channels.' })}
</span>
),
PSUBSCRIBE_COMMAND_CLI: (path: string = '') => [
Expand All @@ -90,7 +106,7 @@ export const cliTexts = {
],
MONITOR_COMMAND: (onClick: () => void) => (
<span color="danger" key={Date.now()}>
{'Use '}
{l10n.t({ message: 'Use ', comment: 'Context: Use "Profiler" tool to see all the requests processed by the server.' })}
<Link
onClick={onClick}
className="btnLikeLink"
Expand All @@ -100,7 +116,10 @@ export const cliTexts = {
>
Profiler
</Link>
{' tool to see all the requests processed by the server.'}
{l10n.t({
message: ' tool to see all the requests processed by the server.',
comment: 'Context: Use "Profiler" tool to see all the requests processed by the server.',
})}
</span>
),
MONITOR_COMMAND_CLI: (onClick: () => void) => [
Expand All @@ -109,7 +128,10 @@ export const cliTexts = {
],
HELLO3_COMMAND: () => (
<span color="danger" key={Date.now()}>
{'RedisInsight does not support '}
{l10n.t({
message: 'RedisInsight does not support ',
comment: 'Context: RedisInsight does not support "RESP3" at the moment, but we are working on it.',
})}
<Link
to="https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md"
className="btnLikeLink"
Expand All @@ -119,7 +141,10 @@ export const cliTexts = {
>
RESP3
</Link>
{' at the moment, but we are working on it.'}
{l10n.t({
message: ' at the moment, but we are working on it.',
comment: 'Context: RedisInsight does not support "RESP3" at the moment, but we are working on it.',
})}
</span>
),
HELLO3_COMMAND_CLI: () => [cliTexts.HELLO3_COMMAND(), '\n'],
Expand Down
6 changes: 4 additions & 2 deletions src/webviews/src/constants/cli/cliOutputConstants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as l10n from '@vscode/l10n'

export const ClearCommand = 'clear'
export const SelectCommand = 'select'

Expand All @@ -8,9 +10,9 @@ export enum CliOutputFormatterType {

export const ConnectionSuccessOutputText = [
'\n',
'Connected.',
l10n.t('Connected.'),
'\n',
'Ready to execute commands.',
l10n.t('Ready to execute commands.'),
'\n\n',
]
export enum CliKeys {
Expand Down

0 comments on commit e8dde1f

Please sign in to comment.