Skip to content
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

CB-4708 add localization to some data viewer tokens #2388

Merged
merged 10 commits into from
Aug 26, 2024
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default [
['ui_readonly', 'Read-only'],
['ui_test', 'Test'],
['ui_export', 'Export'],
['ui_ms', 'ms'],

['root_permission_denied', "You don't have permissions"],
['root_permission_no_permission', "You don't have permission for this action"],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default [
['ui_readonly', 'In sola lettura'],
['ui_test', 'Test'],
['ui_export', 'Export'],
['ui_ms', 'ms'],

['root_permission_denied', 'Non hai i permessi'],
['app_root_session_expire_warning_title', 'La sessione sta per scadere'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default [
['ui_readonly', 'Доступно только для чтения'],
['ui_test', 'Проверить'],
['ui_export', 'Экспорт'],
['ui_ms', 'мс'],

['root_permission_denied', 'Отказано в доступе'],
['root_permission_no_permission', 'У вас нет разрешения на это действие'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default [
['ui_readonly', '只读'],
['ui_test', 'Test'],
['ui_export', 'Export'],
['ui_ms', 'ms'],

['root_permission_denied', '您没有权限'],
['root_permission_no_permission', '您没有权限执行此操作'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class ContainerDataSource extends ResultSetDataSource<IDataContainerOptio
this.requestInfo = {
...this.requestInfo,
requestDuration: response.result.duration,
requestMessage: 'Saved successfully',
requestMessage: 'plugin_data_viewer_result_set_save_success',
source: null,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import type { IConnectionExecutionContext } from '@cloudbeaver/core-connections';
import type { IServiceInjector } from '@cloudbeaver/core-di';
import type { TLocalizationToken } from '@cloudbeaver/core-localization';
import type { ResultDataFormat } from '@cloudbeaver/core-sdk';

import type { IDatabaseDataAction, IDatabaseDataActionClass, IDatabaseDataActionInterface } from './IDatabaseDataAction';
Expand All @@ -16,7 +17,7 @@ import type { IDatabaseDataResult } from './IDatabaseDataResult';
export interface IRequestInfo {
readonly originalQuery: string;
readonly requestDuration: number;
readonly requestMessage: string;
readonly requestMessage: string | TLocalizationToken;
/** A string representation of the filters constraints applied to the data request. Also returns as it is in case of whereFilter */
readonly requestFilter: string;
readonly source: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { observer } from 'mobx-react-lite';
import { useCallback, useEffect, useRef, useState } from 'react';
import styled, { css, use } from 'reshadow';

import { Form, getComputed, ToolsPanel } from '@cloudbeaver/core-blocks';
import { Form, getComputed, ToolsPanel, useTranslate } from '@cloudbeaver/core-blocks';
import type { IDataContext } from '@cloudbeaver/core-data-context';
import { useService } from '@cloudbeaver/core-di';

Expand Down Expand Up @@ -70,6 +70,7 @@ interface Props {
}

export const TableFooter = observer<Props>(function TableFooter({ resultIndex, model, simple, context }) {
const translate = useTranslate();
const ref = useRef<HTMLInputElement>(null);
const [limit, setLimit] = useState(model.countGain + '');
const dataViewerSettingsService = useService(DataViewerSettingsService);
Expand Down Expand Up @@ -120,7 +121,8 @@ export const TableFooter = observer<Props>(function TableFooter({ resultIndex, m
<TableFooterMenu model={model} resultIndex={resultIndex} simple={simple} context={context} />
{model.source.requestInfo.requestMessage.length > 0 && (
<time>
{model.source.requestInfo.requestMessage} - {model.source.requestInfo.requestDuration}ms
{translate(model.source.requestInfo.requestMessage)} - {model.source.requestInfo.requestDuration}
{translate('ui_ms')}
</time>
)}
</ToolsPanel>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const TableStatistics = observer<Props>(function TableStatistics({ model,

return styled(styles)(
<statistics>
{translate('data_viewer_statistics_status')} {source.requestInfo.requestMessage}
{translate('data_viewer_statistics_status')} {translate(source.requestInfo.requestMessage)}
<br />
{translate('data_viewer_statistics_duration')} {source.requestInfo.requestDuration} ms
{translate('data_viewer_statistics_duration')} {source.requestInfo.requestDuration} {translate('ui_ms')}
<br />
{translate('data_viewer_statistics_updated_rows')} {result?.updateRowCount || 0}
<br />
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-viewer/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ export default [
['settings_data_editor_fetch_default_name', 'Default fetch size'],
['settings_data_editor_fetch_default_description', 'Default number of rows to fetch'],
['plugin_data_viewer_no_available_presentation', 'No available presentation'],
['plugin_data_viewer_result_set_save_success', 'Saved successfully'],
];
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-viewer/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ export default [
['settings_data_editor_fetch_default_name', 'Default fetch size'],
['settings_data_editor_fetch_default_description', 'Default number of rows to fetch'],
['plugin_data_viewer_no_available_presentation', 'No available presentation'],
['plugin_data_viewer_result_set_save_success', 'Saved successfully'],
];
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-viewer/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ export default [
['settings_data_editor_fetch_default_name', 'Размер выборки по умолчанию'],
['settings_data_editor_fetch_default_description', 'Количество строк для выборки по умолчанию'],
['plugin_data_viewer_no_available_presentation', 'Нет доступных представлений'],
['plugin_data_viewer_result_set_save_success', 'Успешно сохранено'],
];
1 change: 1 addition & 0 deletions webapp/packages/plugin-data-viewer/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ export default [
['settings_data_editor_fetch_default_name', 'Default fetch size'],
['settings_data_editor_fetch_default_description', 'Default number of rows to fetch'],
['plugin_data_viewer_no_available_presentation', 'No available presentation'],
['plugin_data_viewer_result_set_save_success', 'Saved successfully'],
];
2 changes: 1 addition & 1 deletion webapp/packages/plugin-sql-editor/src/QueryDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class QueryDataSource<TOptions extends IDataQueryOptions = IDataQueryOpti
this.requestInfo = {
...this.requestInfo,
requestDuration: response.result.duration,
requestMessage: 'Saved successfully',
requestMessage: 'plugin_data_viewer_result_set_save_success',
source: this.options.query,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const SqlScriptStatisticsPanel = observer<IProps>(function SqlScriptStati
<statistics>
{translate('sql_editor_sql_execution_executed_queries')} {statistics.executedQueries} / {statistics.queries}
<br />
{translate('data_viewer_statistics_duration')} {statistics.executeTime} ms
{translate('data_viewer_statistics_duration')} {statistics.executeTime} {translate('ui_ms')}
<br />
{translate('data_viewer_statistics_updated_rows')} {statistics.updatedRows}
<br />
Expand Down
Loading