Merge pull request #98 from dbeaver/fix-localization

fix: localization
This commit is contained in:
Serge Rider
2020-06-21 09:08:34 -07:00
committed by GitHub
42 changed files with 477 additions and 272 deletions
-68
View File
@@ -1,68 +0,0 @@
{
"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",
"ui_processing_canceling": "Canceling...",
"ui_processing_retry": "Retry",
"ui_processing_ok": "Ok",
"ui_error_message": "Error:",
"ui_errors_details": "Details",
"ui_search": "Search...",
"ui_data_saving_error": "Error when saving changes",
"block_properties_table_name": "Name",
"block_properties_table_value": "Value",
"block_properties_table_add": "Add",
"root_permission_denied": "You has no permission",
"app_root_session_expired_title": "Session expired",
"app_root_session_expired_message": "Session has been expired. Do you want to reload?",
"app_root_session_expired_reload": "Reload",
"app_shared_connectionMenu_newConnection": "New connection",
"app_shared_connectionMenu_connection": "Connection",
"app_shared_connectionMenu_custom": "Custom",
"app_shared_connectionMenu_disconnect": "Disconnect",
"app_shared_toolsMenu_tools": "Tools",
"app_shared_toolsMenu_logViewer": "Log viewer",
"app_shared_settingsMenu_config": "Configuration",
"app_shared_settingsMenu_theme": "Theme",
"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",
"app_log_view_clear_log": "Clear logs",
"app_log_view_entry_type": "Type",
"app_log_view_entry_timestamp": "Timestamp",
"app_log_view_entry_message": "Message",
"app_log_view_entry_details": "Details"
}
-68
View File
@@ -1,68 +0,0 @@
{
"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": "Отменить",
"ui_processing_canceling": "Отмена...",
"ui_processing_retry": "Повторить",
"ui_processing_ok": "Принять",
"ui_error_message": "Ошибка:",
"ui_errors_details": "Информация",
"ui_search": "Поиск...",
"ui_data_saving_error": "Ошибка при сохранении изменений",
"block_properties_name": "Название",
"block_properties_value": "Значение",
"block_properties_add": "Добавить",
"root_permission_denied": "Отказано в доступе",
"app_root_session_expired_title": "Сесстия истекла",
"app_root_session_expired_message": "Сессия истекла. Хотите перезагрузить страницу?",
"app_root_session_expired_reload": "Перезагрузить",
"app_shared_connectionMenu_newConnection": "Новое подключение",
"app_shared_connectionMenu_connection": "Подключение",
"app_shared_connectionMenu_custom": "Custom",
"app_shared_connectionMenu_disconnect": "Отключить",
"app_shared_toolsMenu_tools": "Инструменты",
"app_shared_toolsMenu_logViewer": "Просмотр лога",
"app_shared_settingsMenu_config": "Настройки",
"app_shared_settingsMenu_theme": "Тема",
"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": "Отменить",
"app_log_view_clear_log": "Очистить лог",
"app_log_view_entry_type": "Тип",
"app_log_view_entry_timestamp": "Время",
"app_log_view_entry_message": "Сообщение",
"app_log_view_entry_details": "Детали"
}
@@ -6,25 +6,35 @@
* you may not use this file except in compliance with the License.
*/
import { injectable } from '@cloudbeaver/core-di';
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { IComputedMenuItemOptions, StaticMenu } from '@cloudbeaver/core-dialogs';
import { LocalizationService } from '@cloudbeaver/core-localization';
import { ServerService } from '@cloudbeaver/core-root';
import { ThemeService } from '@cloudbeaver/core-theming';
@injectable()
export class SettingsMenuService {
export class SettingsMenuService extends Bootstrap {
static settingsMenuToken = 'settingsMenu';
private menu = new StaticMenu();
private langMenuToken = 'langMenu';
private themeMenuToken = 'themeMenu';
constructor(private localizationService: LocalizationService,
private themeService: ThemeService) {
constructor(
private localizationService: LocalizationService,
private themeService: ThemeService,
private serverService: ServerService
) {
super();
}
register(): void | Promise<void> {
this.menu.addRootPanel(SettingsMenuService.settingsMenuToken);
}
async load(): Promise<void> {
this.addThemes();
this.addLocales();
await this.addLocales();
}
getMenu() {
@@ -59,7 +69,13 @@ export class SettingsMenuService {
});
}
private addLocales() {
private async addLocales() {
const config = await this.serverService.config.load();
if (!config) {
return;
}
this.addMenuItem(
SettingsMenuService.settingsMenuToken,
{
@@ -70,7 +86,7 @@ export class SettingsMenuService {
}
);
this.localizationService.getSupportedLanguages().forEach((lang) => {
config.supportedLanguages.forEach((lang) => {
this.addMenuItem(
this.langMenuToken,
{
@@ -29,10 +29,8 @@ import { ThemeService } from '@cloudbeaver/core-theming';
*/
@injectable()
export class AppBootstrap {
constructor(
private exceptionsCatcherService: ExceptionsCatcherService,
private localizationService: LocalizationService,
private themeService: ThemeService,
private routerService: RouterService,
private appScreenService: AppScreenService,
@@ -44,20 +42,22 @@ export class AppBootstrap {
private connectionSchemaManagerService: ConnectionSchemaManagerService,
) { }
async init() {
register(): void | Promise<void> {
this.exceptionsCatcherService.subscribe();
this.sessionExpireService.subscribe();
this.appScreenService.register();
await this.localizationService.init();
await this.themeService.init();
this.connectionSchemaManagerService.registerCallbacks();
this.navigationTreeContextMenuService.registerMenuItems();
this.connectionDialogService.registerMenuItems();
this.logViewerMenuService.registerMenuItems();
}
async load() {
await this.themeService.init();
}
async doAfterPluginsInit() {
// todo this should be moved to the NavigationTabs component creation phase but now it leads to bugs
await this.navigationTabsService.restoreTabs();
@@ -12,9 +12,12 @@ export async function bootstrap(plugins: PluginManifest[]) {
const appBootstrap = app.getServiceInjector().resolveServiceByClass(AppBootstrap);
try {
await appBootstrap.init();
await app.initializeServices();
await appBootstrap.register();
await app.loadServices();
await app.load();
await app.initializePlugins();
await appBootstrap.load();
await appBootstrap.doAfterPluginsInit();
await app.load();
+17 -1
View File
@@ -62,7 +62,23 @@ export class App {
if (service.prototype instanceof Bootstrap) {
const serviceInstance = this.diWrapper.injector.getServiceByClass<Bootstrap>(service);
await serviceInstance.bootstrap();
if ('register' in serviceInstance) {
await serviceInstance.register();
}
}
}
}
}
async loadServices() {
for (const plugin of this.plugins) {
for (const service of plugin.providers) {
if (service.prototype instanceof Bootstrap) {
const serviceInstance = this.diWrapper.injector.getServiceByClass<Bootstrap>(service);
if ('load' in serviceInstance) {
await serviceInstance.load();
}
}
}
}
+2 -1
View File
@@ -10,5 +10,6 @@ import { injectable } from './injectable';
@injectable()
export abstract class Bootstrap {
abstract bootstrap(): void | Promise<void>;
abstract register(): void | Promise<void>;
abstract load(): void | Promise<void>;
}
@@ -0,0 +1,11 @@
/*
* 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.
*/
export interface ILocaleProvider {
(locale: string): Promise<string[][]> | string[][];
}
@@ -8,13 +8,15 @@
import { action, observable } from 'mobx';
import { injectable } from '@cloudbeaver/core-di';
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { NotificationService } from '@cloudbeaver/core-events';
import { SessionService, ServerService } from '@cloudbeaver/core-root';
import { GraphQLService, ServerLanguage } from '@cloudbeaver/core-sdk';
import { SettingsService } from '@cloudbeaver/core-settings';
import { Locale } from './Locale';
import { ILocaleProvider } from './IlocaleProvider';
import { defaultENLocale } from './locales/en';
import { defaultRULocale } from './locales/ru';
import { TLocalizationToken } from './TLocalizationToken';
export type ServerLanguageShort = Pick<ServerLanguage, 'isoCode' | 'nativeName'>;
@@ -23,77 +25,68 @@ const DEFAULT_LOCALE_NAME = 'en';
const LANG_SETTINGS_KEY = 'langSettings';
@injectable()
export class LocalizationService {
export class LocalizationService extends Bootstrap {
@observable settings = {
language: DEFAULT_LOCALE_NAME,
};
@observable.shallow
private supportedLanguages: ServerLanguageShort[] = [];
// observable.shallow - don't treat locales as observables
@observable.shallow
private localeMap: Map<string, Locale> = new Map();
private localeMap: Map<string, Map<string, string>> = new Map();
constructor(private notificationService: NotificationService,
private sessionService: SessionService,
private serverService: ServerService,
private graphQLService: GraphQLService,
private settingsService: SettingsService) {
private localeProviders: ILocaleProvider[] = []
constructor(
private notificationService: NotificationService,
private sessionService: SessionService,
private serverService: ServerService,
private graphQLService: GraphQLService,
private settingsService: SettingsService
) {
super();
}
addProvider(provider: ILocaleProvider) {
this.localeProviders.push(provider);
}
readonly translate = (token: TLocalizationToken): string => {
const translation = this.getTranslation(token, this.getCurrentLocale());
let locale = this.localeMap.get(this.getCurrentLanguage());
if (!locale) {
locale = this.localeMap.get(DEFAULT_LOCALE_NAME);
}
const translation = locale && locale.get(token);
if (typeof translation === 'string') {
return translation;
}
const fallbackTranslation = this.getTranslation(token, this.getDefaultLocale());
if (typeof fallbackTranslation === 'string') {
return fallbackTranslation;
}
// error - no translation
return token;
}
getSupportedLanguages() {
return this.supportedLanguages;
register(): void | Promise<void> {
this.addProvider(this.coreProvider.bind(this));
}
getCurrentLocale(): Locale | undefined {
return this.localeMap.get(this.settings.language);
}
getDefaultLocale(): Locale | undefined {
return this.localeMap.get(DEFAULT_LOCALE_NAME);
}
getCurrentLanguage(): string {
return this.settings.language;
}
getTranslation(token: string, locale?: Locale): string | undefined {
return locale && locale[token];
}
async init() {
async load(): Promise<void> {
const session = await this.sessionService.session.load();
const config = await this.serverService.config.load();
await this.loadLocaleAsync(DEFAULT_LOCALE_NAME);
if (!session || !config) {
if (!session) {
return;
}
this.supportedLanguages = config.supportedLanguages;
this.settingsService.registerSettings(this.settings, LANG_SETTINGS_KEY); // overwrite default value with settings
this.setCurrentLocale(session.locale); // session language wins
await this.setLocale(this.getCurrentLanguage());
}
getCurrentLanguage(): string {
return this.settings.language;
}
async changeLocaleAsync(key: string) {
if (key === this.settings.language) {
return;
@@ -105,27 +98,47 @@ export class LocalizationService {
}
}
private coreProvider(locale: string) {
switch (locale) {
case 'ru':
return defaultRULocale;
default:
return defaultENLocale;
}
}
@action
private setCurrentLocale(lang: string) {
this.settings.language = lang;
}
private async setLocale(key: string) {
if (!this.supportedLanguages.some(lang => lang.isoCode === key)) {
this.setCurrentLocale(this.supportedLanguages[0]!.isoCode);
const config = await this.serverService.config.load();
if (!config) {
throw new Error('Cant\'t get server settings');
}
if (!config.supportedLanguages.some(lang => lang.isoCode === key)) {
this.setCurrentLocale(config!.supportedLanguages[0]!.isoCode);
throw new Error(`Language '${key}' is not supported`);
}
await this.loadLocaleAsync(key);
}
private async loadLocaleAsync(key: string): Promise<void> {
if (this.localeMap.has(key)) {
private async loadLocaleAsync(localeKey: string): Promise<void> {
if (this.localeMap.has(localeKey)) {
return;
}
try {
const response = await fetch(`locales/${key}.json`);
const locale = await response.json() as Locale;
this.localeMap.set(key, locale);
const locale = new Map<string, string>();
for (const provider of this.localeProviders) {
for (const [key, value] of await provider(localeKey)) {
locale.set(key, value);
}
}
this.localeMap.set(localeKey, locale);
} catch (error) {
this.notificationService.logException(error, 'Locale is not found', true);
}
@@ -0,0 +1,68 @@
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'],
['ui_processing_canceling', 'Canceling...'],
['ui_processing_retry', 'Retry'],
['ui_processing_ok', 'Ok'],
['ui_error_message', 'Error:'],
['ui_errors_details', 'Details'],
['ui_search', 'Search...'],
['ui_data_saving_error', 'Error when saving changes'],
['block_properties_table_name', 'Name'],
['block_properties_table_value', 'Value'],
['block_properties_table_add', 'Add'],
['root_permission_denied', 'You has no permission'],
['app_root_session_expired_title', 'Session expired'],
['app_root_session_expired_message', 'Session has been expired. Do you want to reload?'],
['app_root_session_expired_reload', 'Reload'],
['app_shared_connectionMenu_newConnection', 'New connection'],
['app_shared_connectionMenu_connection', 'Connection'],
['app_shared_connectionMenu_custom', 'Custom'],
['app_shared_connectionMenu_disconnect', 'Disconnect'],
['app_shared_toolsMenu_tools', 'Tools'],
['app_shared_toolsMenu_logViewer', 'Log viewer'],
['app_shared_settingsMenu_config', 'Configuration'],
['app_shared_settingsMenu_theme', 'Theme'],
['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'],
['app_log_view_clear_log', 'Clear logs'],
['app_log_view_entry_type', 'Type'],
['app_log_view_entry_timestamp', 'Timestamp'],
['app_log_view_entry_message', 'Message'],
['app_log_view_entry_details', 'Details'],
];
@@ -0,0 +1,68 @@
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', 'Отменить'],
['ui_processing_canceling', 'Отмена...'],
['ui_processing_retry', 'Повторить'],
['ui_processing_ok', 'Принять'],
['ui_error_message', 'Ошибка:'],
['ui_errors_details', 'Информация'],
['ui_search', 'Поиск...'],
['ui_data_saving_error', 'Ошибка при сохранении изменений'],
['block_properties_name', 'Название'],
['block_properties_value', 'Значение'],
['block_properties_add', 'Добавить'],
['root_permission_denied', 'Отказано в доступе'],
['app_root_session_expired_title', 'Сесстия истекла'],
['app_root_session_expired_message', 'Сессия истекла. Хотите перезагрузить страницу?'],
['app_root_session_expired_reload', 'Перезагрузить'],
['app_shared_connectionMenu_newConnection', 'Новое подключение'],
['app_shared_connectionMenu_connection', 'Подключение'],
['app_shared_connectionMenu_custom', 'Custom'],
['app_shared_connectionMenu_disconnect', 'Отключить'],
['app_shared_toolsMenu_tools', 'Инструменты'],
['app_shared_toolsMenu_logViewer', 'Просмотр лога'],
['app_shared_settingsMenu_config', 'Настройки'],
['app_shared_settingsMenu_theme', 'Тема'],
['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', 'Отменить'],
['app_log_view_clear_log', 'Очистить лог'],
['app_log_view_entry_type', 'Тип'],
['app_log_view_entry_timestamp', 'Время'],
['app_log_view_entry_message', 'Сообщение'],
['app_log_view_entry_details', 'Детали'],
];
@@ -1,4 +0,0 @@
{
"administration_menu_enter": "Administration",
"administration_menu_back": "Back to app"
}
@@ -1,4 +0,0 @@
{
"administration_menu_enter": "Администрирование",
"administration_menu_back": "Вернуться в приложение"
}
@@ -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 AdministrationLocaleService 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;
}
}
}
@@ -25,7 +25,7 @@ export class AdministrationMenuService extends Bootstrap {
super();
}
bootstrap() {
register() {
this.settingsMenuService.addMenuItem(
SettingsMenuService.settingsMenuToken,
{
@@ -48,4 +48,6 @@ export class AdministrationMenuService extends Bootstrap {
}
);
}
load(): void | Promise<void> { }
}
@@ -72,7 +72,7 @@ export class AdministrationScreenService extends Bootstrap {
this.routerService.router.navigate(AdministrationScreenService.itemSubParamRouteName, { item, sub, param });
}
bootstrap() {
register() {
this.screenService.create({
name: AdministrationScreenService.screenName,
routes: [
@@ -98,6 +98,8 @@ export class AdministrationScreenService extends Bootstrap {
});
}
load(): void | Promise<void> { }
private async handleActivate() {
if (!this.permissionsService.has(EAdminPermission.admin)) {
this.appScreenService.navigateToRoot();
@@ -0,0 +1,4 @@
export default [
['administration_menu_enter', 'Administration'],
['administration_menu_back', 'Back to app'],
];
@@ -0,0 +1,4 @@
export default [
['administration_menu_enter', 'Администрирование'],
['administration_menu_back', 'Вернуться в приложение'],
];
@@ -9,6 +9,7 @@
import { IServiceInjector, PluginManifest } from '@cloudbeaver/core-di';
import { AdministrationItemService } from './AdministrationItem/AdministrationItemService';
import { AdministrationLocaleService } from './AdministrationLocaleService';
import { AdministrationMenuService } from './AdministrationMenuService';
import { AdministrationScreenService } from './AdministrationScreen/AdministrationScreenService';
import { AdministrationTopAppBarService } from './AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService';
@@ -23,6 +24,7 @@ export const manifest: PluginManifest = {
AdministrationScreenService,
AdministrationTopAppBarService,
AdministrationItemService,
AdministrationLocaleService,
],
async initialize(services: IServiceInjector) {
@@ -1,12 +0,0 @@
{
"authentication_administration_item": "Users",
"authentication_administration_confirm_user_deletion": "Confirm user deletion",
"authentication_create_user_dialog_title": "Create new user",
"authentication_create_user_dialog_create": "Create",
"authentication_user_name": "User name",
"authentication_user_password": "User password",
"authentication_user_password_repeat": "Repeat password",
"authentication_user_role": "User role",
"authentication_user_passwords_not_match": "Passwords don't match",
"authentication_user_user_created": "User was created successfully"
}
@@ -1,11 +0,0 @@
{
"authentication_administration_item": "Пользователи",
"authentication_create_user_dialog_title": "Создание нового пользователя",
"authentication_create_user_dialog_create": "Создать",
"authentication_user_name": "Имя",
"authentication_user_password": "Пароль",
"authentication_user_password_repeat": "Повторите пароль",
"authentication_user_role": "Роль",
"authentication_user_passwords_not_match": "Пароли не совпадают",
"authentication_user_user_created": "Пользователь создан успешно"
}
@@ -17,6 +17,8 @@ export class AuthAdministrationService extends Bootstrap {
super();
}
bootstrap() {
register() {
}
load(): void | Promise<void> {
}
}
@@ -26,7 +26,7 @@ export class UsersAdministrationService extends Bootstrap {
super();
}
bootstrap() {
register() {
this.administrationItemService.create({
name: 'users',
sub: [
@@ -45,6 +45,8 @@ export class UsersAdministrationService extends Bootstrap {
});
}
load(): void | Promise<void> { }
navToRoot() {
this.administrationScreenService.navigateToItem('users');
}
@@ -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 AuthenticationLocaleService 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,12 @@
export default [
['authentication_administration_item', 'Users'],
['authentication_administration_confirm_user_deletion', 'Confirm user deletion'],
['authentication_create_user_dialog_title', 'Create new user'],
['authentication_create_user_dialog_create', 'Create'],
['authentication_user_name', 'User name'],
['authentication_user_password', 'User password'],
['authentication_user_password_repeat', 'Repeat password'],
['authentication_user_role', 'User role'],
['authentication_user_passwords_not_match', "Passwords don't match"],
['authentication_user_user_created', 'User was created successfully'],
];
@@ -0,0 +1,11 @@
export default [
['authentication_administration_item', 'Пользователи'],
['authentication_create_user_dialog_title', 'Создание нового пользователя'],
['authentication_create_user_dialog_create', 'Создать'],
['authentication_user_name', 'Имя'],
['authentication_user_password', 'Пароль'],
['authentication_user_password_repeat', 'Повторите пароль'],
['authentication_user_role', 'Роль'],
['authentication_user_passwords_not_match', 'Пароли не совпадают'],
['authentication_user_user_created', 'Пользователь создан успешно'],
];
@@ -11,6 +11,7 @@ import { IServiceInjector, PluginManifest } from '@cloudbeaver/core-di';
import { RolesManagerService } from './Administration/RolesManagerService';
import { UsersAdministrationService } from './Administration/Users/UsersAdministrationService';
import { UsersManagerService } from './Administration/UsersManagerService';
import { AuthenticationLocaleService } from './AuthenticationLocaleService';
import { AuthenticationService } from './AuthenticationService';
import { AuthInfoService } from './AuthInfoService';
import { AuthMenuService } from './AuthMenuService';
@@ -32,6 +33,7 @@ export const manifest: PluginManifest = {
UsersAdministrationService,
UsersManagerService,
RolesManagerService,
AuthenticationLocaleService,
],
async initialize(services: IServiceInjector) {
@@ -1,13 +0,0 @@
{
"basicConnection_connectionDialog_newConnection" : "New connection",
"basicConnection_connectionDialog_title" : "Connect to Database",
"basicConnection_connectionDialog_listTitle" : "Database:",
"basicConnection_connectionDialog_username" : "Database Username:",
"basicConnection_connectionDialog_usernamePlaceholder" : "user",
"basicConnection_connectionDialog_password" : "Database User Password:",
"basicConnection_connectionDialog_passwordPlaceholder" : "password",
"basicConnection_connectionDialog_connecting" : "Connecting...",
"basicConnection_connectionDialog_connect" : "Connect",
"basicConnection_connectionDialog_connecting_message" : "Connecting to database...",
"basicConnection_main_menu_item" : "Preconfigured"
}
@@ -1,13 +0,0 @@
{
"basicConnection_connectionDialog_newConnection" : "Новое подключение",
"basicConnection_connectionDialog_title" : "Подключение к базе данных",
"basicConnection_connectionDialog_listTitle" : "Базы данных:",
"basicConnection_connectionDialog_username" : "Имя пользователя:",
"basicConnection_connectionDialog_usernamePlaceholder" : "user",
"basicConnection_connectionDialog_password" : "Пароль пользователя:",
"basicConnection_connectionDialog_passwordPlaceholder" : "password",
"basicConnection_connectionDialog_connecting" : "Подключение...",
"basicConnection_connectionDialog_connect" : "Подключиться",
"basicConnection_connectionDialog_connecting_message" : "Подключение к базе...",
"basicConnection_main_menu_item" : "Подключиться"
}
@@ -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 [
['basicConnection_connectionDialog_newConnection', 'New connection'],
['basicConnection_connectionDialog_title', 'Connect to Database'],
['basicConnection_connectionDialog_listTitle', 'Database:'],
['basicConnection_connectionDialog_username', 'Database Username:'],
['basicConnection_connectionDialog_usernamePlaceholder', 'user'],
['basicConnection_connectionDialog_password', 'Database User Password:'],
['basicConnection_connectionDialog_passwordPlaceholder', 'password'],
['basicConnection_connectionDialog_connecting', 'Connecting...'],
['basicConnection_connectionDialog_connect', 'Connect'],
['basicConnection_connectionDialog_connecting_message', 'Connecting to database...'],
['basicConnection_main_menu_item', 'Preconfigured'],
];
@@ -0,0 +1,13 @@
export default [
['basicConnection_connectionDialog_newConnection', 'Новое подключение'],
['basicConnection_connectionDialog_title', 'Подключение к базе данных'],
['basicConnection_connectionDialog_listTitle', 'Базы данных:'],
['basicConnection_connectionDialog_username', 'Имя пользователя:'],
['basicConnection_connectionDialog_usernamePlaceholder', 'user'],
['basicConnection_connectionDialog_password', 'Пароль пользователя:'],
['basicConnection_connectionDialog_passwordPlaceholder', 'password'],
['basicConnection_connectionDialog_connecting', 'Подключение...'],
['basicConnection_connectionDialog_connect', 'Подключиться'],
['basicConnection_connectionDialog_connecting_message', 'Подключение к базе...'],
['basicConnection_main_menu_item', 'Подключиться'],
];
@@ -10,6 +10,7 @@ import { PluginManifest } from '@cloudbeaver/core-di';
import { BasicConnectionPluginBootstrap } from './BasicConnectionPluginBootstrap';
import { BasicConnectionService } from './BasicConnectionService';
import { LocaleService } from './LocaleService';
export const basicConnectionPluginManifest: PluginManifest = {
info: {
@@ -18,6 +19,7 @@ export const basicConnectionPluginManifest: PluginManifest = {
providers: [
BasicConnectionService,
LocaleService,
],
initialize(services): void {
@@ -1,3 +0,0 @@
{
"table_header_sql_expression": "Enter a SQL expression to filter results"
}
@@ -1,3 +0,0 @@
{
"table_header_sql_expression": "Введите SQL выражение чтобы отфильтровать результаты"
}
@@ -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;
}
}
}
@@ -16,7 +16,8 @@ import { TableWhereFilter } from './TableWhereFilter';
export class TableHeaderService extends Bootstrap {
readonly tableHeaderPlaceholder = new PlaceholderContainer<TableViewerModel>()
bootstrap() {
register() {
this.tableHeaderPlaceholder.add(TableWhereFilter, 1);
}
load(): void | Promise<void> { }
}
@@ -0,0 +1,3 @@
export default [
['table_header_sql_expression', 'Enter a SQL expression to filter results'],
];
@@ -0,0 +1,3 @@
export default [
['table_header_sql_expression', 'Введите SQL выражение чтобы отфильтровать результаты'],
];
@@ -11,6 +11,7 @@ import { IServiceInjector, PluginManifest } from '@cloudbeaver/core-di';
import { DataViewerBootstrap } from './DataViewerBootstrap';
import { DataViewerTableService } from './DataViewerTableService';
import { DataViewerTabService } from './DataViewerTabService';
import { LocaleService } from './LocaleService';
import { TableFooterMenuService } from './TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService';
import { TableHeaderService } from './TableViewer/TableHeader/TableHeaderService';
import { TableViewerStorageService } from './TableViewer/TableViewerStorageService';
@@ -26,6 +27,7 @@ export const manifest: PluginManifest = {
TableViewerStorageService,
TableFooterMenuService,
TableHeaderService,
LocaleService,
],
async initialize(services: IServiceInjector) {

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

@@ -18,9 +18,9 @@
type="image/svg+xml"
/>
<title>DBeaver web</title>
<title>Cloudbeaver</title>
</head>
<body>
<body class="theme-typography">
<div id="root">Loading...</div>
<!-- Dependencies -->