CB-2324 refactor: localization aliases

This commit is contained in:
Wroud
2022-09-13 20:52:04 +03:00
parent 37f1ecfcc8
commit 7f1ded6ea2
17 changed files with 58 additions and 55 deletions
@@ -109,10 +109,13 @@ export class LocalizationService extends Bootstrap {
}
if (typeof translation === 'string') {
return Object.entries(args).reduce<string>(
(translation, [key, value]) => translation.replace(`{args.${key}}`, value),
translation = Object.entries(args).reduce<string>(
(translation, [key, value]) => translation.replace(`{arg:${key}}`, value),
translation
) as T;
) as string;
translation = translation.replace(/({alias:(\w*?)})/g, (substr, group1, group2) => this.translate(group2));
return translation as T;
}
if (fallback !== undefined) {
@@ -16,12 +16,12 @@ export const defaultENLocale = [
['ui_processing_save', 'Save'],
['ui_processing_saved', 'Saved'],
['ui_processing_stop', 'Stop'],
['ui_second_first_form', '{args.interval} second'],
['ui_second_second_form', '{args.interval} seconds'],
['ui_second_third_form', '{args.interval} seconds'],
['ui_minute_first_form', '{args.interval} minute'],
['ui_minute_second_form', '{args.interval} minutes'],
['ui_minute_third_form', '{args.interval} minutes'],
['ui_second_first_form', '{arg:interval} second'],
['ui_second_second_form', '{arg:interval} seconds'],
['ui_second_third_form', '{arg:interval} seconds'],
['ui_minute_first_form', '{arg:interval} minute'],
['ui_minute_second_form', '{arg:interval} minutes'],
['ui_minute_third_form', '{arg:interval} minutes'],
['ui_custom', 'Custom'],
['ui_configure', 'Configure'],
['ui_apply', 'Apply'],
@@ -16,12 +16,12 @@ export const defaultITLocale = [
['ui_processing_save', 'Salva'],
['ui_processing_saved', 'Saved'],
['ui_processing_stop', 'Stop'],
['ui_second_first_form', '{args.interval} second'],
['ui_second_second_form', '{args.interval} seconds'],
['ui_second_third_form', '{args.interval} seconds'],
['ui_minute_first_form', '{args.interval} minute'],
['ui_minute_second_form', '{args.interval} minutes'],
['ui_minute_third_form', '{args.interval} minutes'],
['ui_second_first_form', '{arg:interval} second'],
['ui_second_second_form', '{arg:interval} seconds'],
['ui_second_third_form', '{arg:interval} seconds'],
['ui_minute_first_form', '{arg:interval} minute'],
['ui_minute_second_form', '{arg:interval} minutes'],
['ui_minute_third_form', '{arg:interval} minutes'],
['ui_custom', 'Custom'],
['ui_configure', 'Configure'],
['ui_apply', 'Applica'],
@@ -14,12 +14,12 @@ export const defaultRULocale = [
['ui_processing_save', 'Сохранить'],
['ui_processing_saved', 'Сохранено'],
['ui_processing_stop', 'Остановить'],
['ui_second_first_form', '{args.interval} секунда'],
['ui_second_second_form', '{args.interval} секунды'],
['ui_second_third_form', '{args.interval} секунд'],
['ui_minute_first_form', '{args.interval} минута'],
['ui_minute_second_form', '{args.interval} минуты'],
['ui_minute_third_form', '{args.interval} минут'],
['ui_second_first_form', '{arg:interval} секунда'],
['ui_second_second_form', '{arg:interval} секунды'],
['ui_second_third_form', '{arg:interval} секунд'],
['ui_minute_first_form', '{arg:interval} минута'],
['ui_minute_second_form', '{arg:interval} минуты'],
['ui_minute_third_form', '{arg:interval} минут'],
['ui_custom', 'Настроить'],
['ui_configure', 'Настроить'],
['ui_apply', 'Применить'],
@@ -16,12 +16,12 @@ export const defaultZHLocale = [
['ui_processing_save', '保存'],
['ui_processing_saved', 'Saved'],
['ui_processing_stop', 'Stop'],
['ui_second_first_form', '{args.interval} second'],
['ui_second_second_form', '{args.interval} seconds'],
['ui_second_third_form', '{args.interval} seconds'],
['ui_minute_first_form', '{args.interval} minute'],
['ui_minute_second_form', '{args.interval} minutes'],
['ui_minute_third_form', '{args.interval} minutes'],
['ui_second_first_form', '{arg:interval} second'],
['ui_second_second_form', '{arg:interval} seconds'],
['ui_second_third_form', '{arg:interval} seconds'],
['ui_minute_first_form', '{arg:interval} minute'],
['ui_minute_second_form', '{arg:interval} minutes'],
['ui_minute_third_form', '{arg:interval} minutes'],
['ui_custom', 'Custom'],
['ui_configure', '配置'],
['ui_apply', '应用'],
@@ -6,9 +6,9 @@ export default [
['connections_public_connection_edit_reconnect_message', 'Connection has been updated. Do you want to reconnect?'],
['connections_public_connection_edit_reconnect_failed', 'Failed to reconnect'],
['connections_public_connection_folder_move_failed', 'Failed to move to folder'],
['connections_public_connection_folder_move_duplication', 'Target folder or selected folders contains folder with the same name ({args.name})'],
['connections_public_connection_folder_move_duplication', 'Target folder or selected folders contains folder with the same name ({arg:name})'],
['plugin_connections_connection_form_project_invalid', 'You have no access to create connections in selected project'],
['plugin_connections_connection_form_host_configuration_invalid', 'Host configuration is not supported'],
['plugin_connections_connection_form_name_invalid', 'Field \'name\' can\'t be empty'],
['connections_public_connection_folder_delete_confirmation', 'You\'re going to delete "{args.name}". Connections won\'t be deleted. Are you sure?'],
['connections_public_connection_folder_delete_confirmation', 'You\'re going to delete "{arg:name}". Connections won\'t be deleted. Are you sure?'],
];
@@ -6,9 +6,9 @@ export default [
['connections_public_connection_edit_reconnect_message', 'Connection has been updated. Do you want to reconnect?'],
['connections_public_connection_edit_reconnect_failed', 'Failed to reconnect'],
['connections_public_connection_folder_move_failed', 'Failed to move to folder'],
['connections_public_connection_folder_move_duplication', 'Target folder or selected folders contains folder with the same name ({args.name})'],
['connections_public_connection_folder_move_duplication', 'Target folder or selected folders contains folder with the same name ({arg:name})'],
['plugin_connections_connection_form_project_invalid', 'You have no access to create connections in selected project'],
['plugin_connections_connection_form_host_configuration_invalid', 'Host configuration is not supported'],
['plugin_connections_connection_form_name_invalid', 'Field \'name\' can\'t be empty'],
['connections_public_connection_folder_delete_confirmation', 'You\'re going to delete "{args.name}". Connections won\'t be deleted. Are you sure?'],
['connections_public_connection_folder_delete_confirmation', 'You\'re going to delete "{arg:name}". Connections won\'t be deleted. Are you sure?'],
];
@@ -6,9 +6,9 @@ export default [
['connections_public_connection_edit_reconnect_message', 'Подключение было обновлено. Вы хотите переподключиться?'],
['connections_public_connection_edit_reconnect_failed', 'Не удалось переподключиться'],
['connections_public_connection_folder_move_failed', 'Ошибка перемещения в папку'],
['connections_public_connection_folder_move_duplication', 'Выбранные папки или папка назначения содержит папки с таким же названием ({args.name})'],
['connections_public_connection_folder_move_duplication', 'Выбранные папки или папка назначения содержит папки с таким же названием ({arg:name})'],
['plugin_connections_connection_form_project_invalid', 'У вас нет разрешения создавать коннекшены в выбранном проекте'],
['plugin_connections_connection_form_host_configuration_invalid', 'Конфигурация хоста не поддерживается'],
['plugin_connections_connection_form_name_invalid', 'Поле \'Название\' не может быть пустым'],
['connections_public_connection_folder_delete_confirmation', 'Вы удаляете "{args.name}". Подключения не будут удалены. Вы уверены?'],
['connections_public_connection_folder_delete_confirmation', 'Вы удаляете "{arg:name}". Подключения не будут удалены. Вы уверены?'],
];
@@ -6,9 +6,9 @@ export default [
['connections_public_connection_edit_reconnect_message', '连接已更新。您想重新连接吗?'],
['connections_public_connection_edit_reconnect_failed', '重新连接失败'],
['connections_public_connection_folder_move_failed', 'Failed to move to folder'],
['connections_public_connection_folder_move_duplication', 'Target folder or selected folders contains folder with the same name ({args.name})'],
['connections_public_connection_folder_move_duplication', 'Target folder or selected folders contains folder with the same name ({arg:name})'],
['plugin_connections_connection_form_project_invalid', 'You have no access to create connections in selected project'],
['plugin_connections_connection_form_host_configuration_invalid', 'Host configuration is not supported'],
['plugin_connections_connection_form_name_invalid', 'Field \'name\' can\'t be empty'],
['connections_public_connection_folder_delete_confirmation', 'You\'re going to delete "{args.name}". Connections won\'t be deleted. Are you sure?'],
['connections_public_connection_folder_delete_confirmation', 'You\'re going to delete "{arg:name}". Connections won\'t be deleted. Are you sure?'],
];
@@ -1,7 +1,7 @@
export default [
['app_navigationTree_openNodeTab', 'Open'],
['app_navigationTree_search', 'Search elements...'],
['app_navigationTree_limited', 'Elements are limited to {args.limit} items'],
['app_navigationTree_limited', 'Elements are limited to {arg:limit} items'],
['app_navigationTree_action_link_with_editor', 'Link with editor'],
['app_navigationTree_action_collapse_all', 'Collapse all'],
['app_navigationTree_settings_filter_title', 'Filter'],
@@ -12,11 +12,11 @@ export default [
['app_navigationTree_settings_state_description', 'Reopen expanded nodes after page refresh'],
['app_navigationTree_settings_folders_title', 'Folders'],
['app_navigationTree_settings_folders_description', 'Open any node as tree root node'],
['app_navigationTree_node_delete_confirmation', 'You\'re going to delete "{args.name}". Are you sure?'],
['app_navigationTree_node_delete_error', 'Failed to delete "{args.name}'],
['app_navigationTree_node_delete_confirmation', 'You\'re going to delete "{arg:name}". Are you sure?'],
['app_navigationTree_node_delete_error', 'Failed to delete "{arg:name}'],
['app_navigationTree_node_rename_error', 'Error occurred while renaming'],
['app_navigationTree_node_empty', 'Empty'],
['app_navigationTree_node_no_results', "We're sorry. There no matching results for '{args.filter}'"],
['app_navigationTree_node_no_results', "We're sorry. There no matching results for '{arg:filter}'"],
['app_navigationTree_node_not_found', 'Node not found'],
['app_navigationTree_connection_view', 'Connection view'],
['app_navigationTree_connection_view_option_simple', 'Simple'],
@@ -1,22 +1,22 @@
export default [
['app_navigationTree_openNodeTab', 'Apri'],
['app_navigationTree_search', 'Search elements...'],
['app_navigationTree_limited', 'Elements are limited to {args.limit} items'],
['app_navigationTree_limited', 'Elements are limited to {arg:limit} items'],
['app_navigationTree_action_link_with_editor', 'Link with editor'],
['app_navigationTree_action_collapse_all', 'Collapse all'],
['app_navigationTree_settings_filter_title', 'Filter'],
['app_navigationTree_settings_filter_description', 'Show filtering field'],
['app_navigationTree_settings_filter_all_title', 'Show collapsed'],
['app_navigationTree_settings_filter_all_description', 'Shows filtered elements in collapsed folders'],
['app_navigationTree_node_delete_confirmation', 'You\'re going to delete "{args.name}". Are you sure?'],
['app_navigationTree_node_delete_error', 'Failed to delete "{args.name}'],
['app_navigationTree_node_delete_confirmation', 'You\'re going to delete "{arg:name}". Are you sure?'],
['app_navigationTree_node_delete_error', 'Failed to delete "{arg:name}'],
['app_navigationTree_node_rename_error', 'Error occurred while renaming'],
['app_navigationTree_settings_state_title', 'Save tree state'],
['app_navigationTree_settings_state_description', 'Reopen expanded nodes after page refresh'],
['app_navigationTree_settings_folders_title', 'Folders'],
['app_navigationTree_settings_folders_description', 'Open any node as tree root node'],
['app_navigationTree_node_empty', 'Empty'],
['app_navigationTree_node_no_results', "We're sorry. There no matching results for '{args.filter}'"],
['app_navigationTree_node_no_results', "We're sorry. There no matching results for '{arg:filter}'"],
['app_navigationTree_node_not_found', 'Node not found'],
['app_navigationTree_connection_view', 'Vista di connessione'],
['app_navigationTree_connection_view_option_simple', 'Semplice'],
@@ -1,7 +1,7 @@
export default [
['app_navigationTree_openNodeTab', 'Открыть'],
['app_navigationTree_search', 'Искать элементы...'],
['app_navigationTree_limited', 'Отображено {args.limit} элементов'],
['app_navigationTree_limited', 'Отображено {arg:limit} элементов'],
['app_navigationTree_action_link_with_editor', 'Синхронизовать с редактором'],
['app_navigationTree_action_collapse_all', 'Свернуть все элементы'],
@@ -14,12 +14,12 @@ export default [
['app_navigationTree_settings_state_description', 'Восстанавливает открытые узлы после обновления страницы'],
['app_navigationTree_settings_folders_title', 'Папки'],
['app_navigationTree_settings_folders_description', 'Позволяет открыть любой узел как начальный'],
['app_navigationTree_node_delete_confirmation', 'Вы собираетесь удалить "{args.name}". Вы уверены?'],
['app_navigationTree_node_delete_error', 'Ошибка удаления "{args.name}'],
['app_navigationTree_node_delete_confirmation', 'Вы собираетесь удалить "{arg:name}". Вы уверены?'],
['app_navigationTree_node_delete_error', 'Ошибка удаления "{arg:name}'],
['app_navigationTree_node_rename_error', 'Ошибка переименования ноды'],
['app_navigationTree_node_empty', 'Пусто'],
['app_navigationTree_node_no_results', "Извините, не удалось найти элементы содержащие '{args.filter}'"],
['app_navigationTree_node_no_results', "Извините, не удалось найти элементы содержащие '{arg:filter}'"],
['app_navigationTree_node_not_found', 'Элемент не найден'],
['app_navigationTree_connection_view', 'Отображение'],
['app_navigationTree_connection_view_option_simple', 'Упрощенное'],
@@ -1,6 +1,6 @@
export default [
['app_navigationTree_search', 'Search elements...'],
['app_navigationTree_limited', 'Elements are limited to {args.limit} items'],
['app_navigationTree_limited', 'Elements are limited to {arg:limit} items'],
['app_navigationTree_action_link_with_editor', 'Link with editor'],
['app_navigationTree_action_collapse_all', 'Collapse all'],
['app_navigationTree_settings_filter_title', 'Filter'],
@@ -11,11 +11,11 @@ export default [
['app_navigationTree_settings_state_description', 'Reopen expanded nodes after page refresh'],
['app_navigationTree_settings_folders_title', 'Folders'],
['app_navigationTree_settings_folders_description', 'Open any node as tree root node'],
['app_navigationTree_node_delete_confirmation', 'You\'re going to delete "{args.name}". Are you sure?'],
['app_navigationTree_node_delete_error', 'Failed to delete "{args.name}'],
['app_navigationTree_node_delete_confirmation', 'You\'re going to delete "{arg:name}". Are you sure?'],
['app_navigationTree_node_delete_error', 'Failed to delete "{arg:name}'],
['app_navigationTree_node_rename_error', 'Error occurred while renaming'],
['app_navigationTree_node_empty', 'Empty'],
['app_navigationTree_node_no_results', "We're sorry. There no matching results for '{args.filter}'"],
['app_navigationTree_node_no_results', "We're sorry. There no matching results for '{arg:filter}'"],
['app_navigationTree_openNodeTab', '打开'],
['app_navigationTree_connection_view', '连接视图'],
['app_navigationTree_node_not_found', 'Node not found'],
@@ -15,7 +15,7 @@ export default [
['plugin_resource_manager_sync_script_error', "Failed to sync editor's query"],
['plugin_resource_manager_delete_script_error', 'Error occurred while trying to delete the script'],
['plugin_resource_manager_script_not_found_title', 'Failed to find the associated script'],
['plugin_resource_manager_script_delete_confirmation', 'You are going to delete "{args.name}". Are you sure?'],
['plugin_resource_manager_script_delete_confirmation', 'You are going to delete "{arg:name}". Are you sure?'],
['plugin_resource_manager_script_not_found_message', 'The script was probably removed or renamed. The last known value will be used'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()@" and can\'t start with a dot'],
];
@@ -15,7 +15,7 @@ export default [
['plugin_resource_manager_sync_script_error', "Failed to sync editor's query"],
['plugin_resource_manager_delete_script_error', 'Error occurred while trying to delete the script'],
['plugin_resource_manager_script_not_found_title', 'Failed to find the associated script'],
['plugin_resource_manager_script_delete_confirmation', 'You are going to delete "{args.name}". Are you sure?'],
['plugin_resource_manager_script_delete_confirmation', 'You are going to delete "{arg:name}". Are you sure?'],
['plugin_resource_manager_script_not_found_message', 'The script was probably removed or renamed. The last known value will be used'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()@" and can\'t start with a dot'],
];
@@ -15,7 +15,7 @@ export default [
['plugin_resource_manager_sync_script_error', 'Не удалось синхронизировать данные редактора'],
['plugin_resource_manager_delete_script_error', 'Возникла ошибка при удалении скрипта'],
['plugin_resource_manager_script_not_found_title', 'Не удалось найти привязанный скрипт'],
['plugin_resource_manager_script_delete_confirmation', 'Вы удаляете "{args.name}". Удалить?'],
['plugin_resource_manager_script_delete_confirmation', 'Вы удаляете "{arg:name}". Удалить?'],
['plugin_resource_manager_script_not_found_message', 'Возможно скрипт был удален или переименован. Будет использовано последнее известное значение'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Имя скрипта может содержать следующие символы "_-$.()@" и не может начинаться с точки'],
];
@@ -15,7 +15,7 @@ export default [
['plugin_resource_manager_sync_script_error', '同步查询失败'],
['plugin_resource_manager_delete_script_error', '删除脚本时发生错误'],
['plugin_resource_manager_script_not_found_title', '找不到关联的脚本'],
['plugin_resource_manager_script_delete_confirmation', '你确定要删除"{args.name}"吗?'],
['plugin_resource_manager_script_delete_confirmation', '你确定要删除"{arg:name}"吗?'],
['plugin_resource_manager_script_not_found_message', '脚本可能被删除或重命名,将使用最后的有效值'],
['plugin_resource_manager_script_name_invalid_characters_message', '脚本名称中可以使用字符"_-$.()@" 但不能以"."开头'],
];