chore: extract localization from core

CB-35
This commit is contained in:
Wroud
2020-07-23 13:43:01 +03:00
parent 102df02492
commit 0a68385c33
12 changed files with 134 additions and 58 deletions
@@ -1,33 +1,5 @@
export const defaultENLocale = [
['name', 'en'],
['customConnection_connectionType_custom', 'Parameters'],
['customConnection_connectionType_url', 'URL'],
['customConnection_options', 'Options'],
['customConnection_properties', 'Driver Properties'],
['customConnection_custom_host', 'Host'],
['customConnection_custom_obligatory', '(obligatory)'],
['customConnection_custom_port', 'Port'],
['customConnection_custom_database', 'Database'],
['customConnection_custom_server', 'Server'],
['customConnection_url_JDBC', 'JDBC URL'],
['customConnection_userName', 'User name'],
['customConnection_Password', 'Password'],
['customConnection_test', 'Test Connection'],
['customConnection_create', 'Create'],
['data_transfer_dialog_title', 'Export data'],
['data_transfer_dialog_export', 'Export'],
['data_transfer_dialog_configuration_title', 'Export configuration'],
['data_transfer_dialog_preparation', 'We prepare your file for export. Please wait...'],
['data_transfer_notification_preparation', 'We prepare your file for download. Please wait...'],
['data_transfer_notification_ready', 'File ready to download'],
['data_transfer_notification_error', 'Preparation failed or canceled'],
['data_transfer_notification_download', 'Download'],
['data_transfer_notification_delete', 'Delete'],
['data_transfer_exporting_table', 'Table:'],
['data_transfer_exporting_sql', 'SQL:'],
['authentication_login_dialog_title', 'Authentication'],
['authentication_login', 'Login'],
['authentication_logout', 'Logout'],
['ui_stepper_back', 'Back'],
['ui_processing_loading', 'Loading...'],
['ui_processing_cancel', 'Cancel'],
@@ -56,7 +28,6 @@ export const defaultENLocale = [
['app_shared_settingsMenu_lang', 'Language'],
['app_navigationTree_openNodeTab', 'Open'],
['app_navigationTree_refreshNode', 'Refresh'],
['core_eventsLog_dbeaverErrorDetails', 'Error details'],
['app_shared_inlineEditor_dialog_title', 'Edit mode'],
['app_shared_inlineEditor_dialog_apply', 'Apply'],
['app_shared_inlineEditor_dialog_cancel', 'Cancel'],
@@ -65,4 +36,5 @@ export const defaultENLocale = [
['app_log_view_entry_timestamp', 'Timestamp'],
['app_log_view_entry_message', 'Message'],
['app_log_view_entry_details', 'Details'],
['core_eventsLog_dbeaverErrorDetails', 'Error details'],
];
@@ -1,33 +1,5 @@
export const defaultRULocale = [
['name', 'ru'],
['customConnection_connectionType_custom', 'Параметры'],
['customConnection_connectionType_url', 'URL'],
['customConnection_options', 'Подключение'],
['customConnection_properties', 'Параметры драйвера'],
['customConnection_custom_host', 'Хост'],
['customConnection_custom_obligatory', '(обязательное)'],
['customConnection_custom_port', 'Порт'],
['customConnection_custom_database', 'База'],
['customConnection_custom_server', 'Сервер'],
['customConnection_url_JDBC', 'JDBC URL'],
['customConnection_userName', 'Пользователь'],
['customConnection_Password', 'Пароль'],
['customConnection_test', 'Проверить'],
['customConnection_create', 'Создать'],
['data_transfer_dialog_title', 'Экспорт данных'],
['data_transfer_dialog_export', 'Экспортировать'],
['data_transfer_dialog_configuration_title', 'Настройка экспорта'],
['data_transfer_dialog_preparation', 'Подготавливаем файл к экспорту. Пожалуйста подождите...'],
['data_transfer_notification_preparation', 'Подготавливаем файл к загрузке. Пожалуйста подождите...'],
['data_transfer_notification_ready', 'Файл готов к загрузке'],
['data_transfer_notification_error', 'Подготовка файла к загрузке не удалась или была отменена'],
['data_transfer_notification_download', 'Загрузить'],
['data_transfer_notification_delete', 'Удалить'],
['data_transfer_exporting_table', 'Таблица:'],
['data_transfer_exporting_sql', 'SQL:'],
['authentication_login_dialog_title', 'Авторизация'],
['authentication_login', 'Войти'],
['authentication_logout', 'Выйти'],
['ui_stepper_back', 'Назад'],
['ui_processing_loading', 'Загрузка...'],
['ui_processing_cancel', 'Отменить'],
@@ -56,7 +28,6 @@ export const defaultRULocale = [
['app_shared_settingsMenu_lang', 'Язык'],
['app_navigationTree_openNodeTab', 'Открыть'],
['app_navigationTree_refreshNode', 'Обновить'],
['core_eventsLog_dbeaverErrorDetails', 'Детали ошибки'],
['app_shared_inlineEditor_dialog_title', 'Редактирование'],
['app_shared_inlineEditor_dialog_apply', 'Применить'],
['app_shared_inlineEditor_dialog_cancel', 'Отменить'],
@@ -65,4 +36,5 @@ export const defaultRULocale = [
['app_log_view_entry_timestamp', 'Время'],
['app_log_view_entry_message', 'Сообщение'],
['app_log_view_entry_details', 'Детали'],
['core_eventsLog_dbeaverErrorDetails', 'Детали ошибки'],
];
@@ -1,4 +1,7 @@
export default [
['authentication_login_dialog_title', 'Authentication'],
['authentication_login', 'Login'],
['authentication_logout', 'Logout'],
['authentication_administration_item', 'Users'],
['authentication_administration_confirm_user_deletion', 'Confirm user deletion'],
['authentication_create_user_dialog_title', 'Create new user'],
@@ -1,4 +1,7 @@
export default [
['authentication_login_dialog_title', 'Авторизация'],
['authentication_login', 'Войти'],
['authentication_logout', 'Выйти'],
['authentication_administration_item', 'Пользователи'],
['authentication_create_user_dialog_title', 'Создание нового пользователя'],
['authentication_create_user_dialog_create', 'Создать'],
@@ -0,0 +1,32 @@
/*
* cloudbeaver - Cloud Database Manager
* Copyright (C) 2020 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
export class LocaleService extends Bootstrap {
constructor(private localizationService: LocalizationService) {
super();
}
register(): void | Promise<void> {
this.localizationService.addProvider(this.provider.bind(this));
}
load(): void | Promise<void> { }
private async provider(locale: string) {
switch (locale) {
case 'ru':
return (await import('./locales/ru')).default;
default:
return (await import('./locales/en')).default;
}
}
}
@@ -0,0 +1,16 @@
export default [
['customConnection_connectionType_custom', 'Parameters'],
['customConnection_connectionType_url', 'URL'],
['customConnection_options', 'Options'],
['customConnection_properties', 'Driver Properties'],
['customConnection_custom_host', 'Host'],
['customConnection_custom_obligatory', '(obligatory)'],
['customConnection_custom_port', 'Port'],
['customConnection_custom_database', 'Database'],
['customConnection_custom_server', 'Server'],
['customConnection_url_JDBC', 'JDBC URL'],
['customConnection_userName', 'User name'],
['customConnection_Password', 'Password'],
['customConnection_test', 'Test Connection'],
['customConnection_create', 'Create'],
];
@@ -0,0 +1,16 @@
export default [
['customConnection_connectionType_custom', 'Параметры'],
['customConnection_connectionType_url', 'URL'],
['customConnection_options', 'Подключение'],
['customConnection_properties', 'Параметры драйвера'],
['customConnection_custom_host', 'Хост'],
['customConnection_custom_obligatory', '(обязательное)'],
['customConnection_custom_port', 'Порт'],
['customConnection_custom_database', 'База'],
['customConnection_custom_server', 'Сервер'],
['customConnection_url_JDBC', 'JDBC URL'],
['customConnection_userName', 'Пользователь'],
['customConnection_Password', 'Пароль'],
['customConnection_test', 'Проверить'],
['customConnection_create', 'Создать'],
];
@@ -10,6 +10,7 @@ import { PluginManifest } from '@cloudbeaver/core-di';
import { CustomConnectionPluginBootstrap } from './CustomConnectionPluginBootstrap';
import { CustomConnectionService } from './CustomConnectionService';
import { LocaleService } from './LocaleService';
export const customConnectionPluginManifest: PluginManifest = {
info: {
@@ -18,6 +19,7 @@ export const customConnectionPluginManifest: PluginManifest = {
providers: [
CustomConnectionService,
LocaleService,
],
initialize(services): void {
@@ -0,0 +1,32 @@
/*
* cloudbeaver - Cloud Database Manager
* Copyright (C) 2020 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { LocalizationService } from '@cloudbeaver/core-localization';
@injectable()
export class LocaleService extends Bootstrap {
constructor(private localizationService: LocalizationService) {
super();
}
register(): void | Promise<void> {
this.localizationService.addProvider(this.provider.bind(this));
}
load(): void | Promise<void> { }
private async provider(locale: string) {
switch (locale) {
case 'ru':
return (await import('./locales/ru')).default;
default:
return (await import('./locales/en')).default;
}
}
}
@@ -0,0 +1,13 @@
export default [
['data_transfer_dialog_title', 'Export data'],
['data_transfer_dialog_export', 'Export'],
['data_transfer_dialog_configuration_title', 'Export configuration'],
['data_transfer_dialog_preparation', 'We prepare your file for export. Please wait...'],
['data_transfer_notification_preparation', 'We prepare your file for download. Please wait...'],
['data_transfer_notification_ready', 'File ready to download'],
['data_transfer_notification_error', 'Preparation failed or canceled'],
['data_transfer_notification_download', 'Download'],
['data_transfer_notification_delete', 'Delete'],
['data_transfer_exporting_table', 'Table:'],
['data_transfer_exporting_sql', 'SQL:'],
];
@@ -0,0 +1,13 @@
export default [
['data_transfer_dialog_title', 'Экспорт данных'],
['data_transfer_dialog_export', 'Экспортировать'],
['data_transfer_dialog_configuration_title', 'Настройка экспорта'],
['data_transfer_dialog_preparation', 'Подготавливаем файл к экспорту. Пожалуйста подождите...'],
['data_transfer_notification_preparation', 'Подготавливаем файл к загрузке. Пожалуйста подождите...'],
['data_transfer_notification_ready', 'Файл готов к загрузке'],
['data_transfer_notification_error', 'Подготовка файла к загрузке не удалась или была отменена'],
['data_transfer_notification_download', 'Загрузить'],
['data_transfer_notification_delete', 'Удалить'],
['data_transfer_exporting_table', 'Таблица:'],
['data_transfer_exporting_sql', 'SQL:'],
];
@@ -13,6 +13,7 @@ import { DataExportMenuService } from './DataExportMenuService';
import { DataExportProcessService } from './DataExportProcessService';
import { DataExportService } from './DataExportService';
import { DataTransferProcessorsResource } from './DataTransferProcessorsResource';
import { LocaleService } from './LocaleService';
export const manifest: PluginManifest = {
info: {
@@ -24,6 +25,7 @@ export const manifest: PluginManifest = {
DataExportService,
DataExportProcessService,
DataTransferProcessorsResource,
LocaleService,
],
async initialize(services: IServiceInjector) {