mirror of
https://github.com/august-alt/gpui.git
synced 2025-03-16 22:50:15 +03:00
feat: add translations
This commit is contained in:
parent
ac7c5bfeda
commit
4dd599e654
@ -9,6 +9,8 @@ set(CMAKE_MODULE_PATH ${GPUI_SOURCE_DIR}/cmake)
|
||||
|
||||
set(GPUI_DIR "${CMAKE_BINARY_DIR}")
|
||||
|
||||
include(TranslationUtils)
|
||||
|
||||
if(UNIX)
|
||||
include(GNUInstallDirs)
|
||||
else()
|
||||
|
13
cmake/TranslationUtils.cmake
Normal file
13
cmake/TranslationUtils.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
function(add_translation_resource out_file)
|
||||
set(qm_files ${ARGN})
|
||||
set(resource ${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc)
|
||||
|
||||
file(WRITE ${resource} "<!DOCTYPE RCC><RCC version=\"1.0\">\n <qresource prefix=\"/\">\n")
|
||||
foreach(LANG ${qm_files})
|
||||
get_filename_component(file_name ${LANG} NAME)
|
||||
file(APPEND ${resource} " <file>${file_name}</file>\n")
|
||||
endforeach()
|
||||
file(APPEND ${resource} " </qresource>\n</RCC>\n")
|
||||
|
||||
set(${out_file} ${resource} PARENT_SCOPE)
|
||||
endfunction()
|
@ -1,4 +1,4 @@
|
||||
find_package(Qt5 COMPONENTS Widgets Qml REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Widgets Qml LinguistTools REQUIRED)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
@ -45,6 +45,15 @@ set(MOC_HEADERS
|
||||
smbfilebrowser.h
|
||||
)
|
||||
|
||||
set(TS_FILES
|
||||
i18n/gui_en.ts
|
||||
i18n/gui_ru.ts
|
||||
)
|
||||
|
||||
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
||||
|
||||
qt5_wrap_ui(UI_SOURCES ${UI_FORMS})
|
||||
qt5_wrap_cpp(MOC_SOURCES ${MOC_HEADERS})
|
||||
|
||||
@ -52,7 +61,11 @@ add_definitions(
|
||||
-DGPUI_GUI_LIBRARY
|
||||
)
|
||||
|
||||
add_gpui_library(gpui-gui ${UI_SOURCES} ${MOC_SOURCES} ${SOURCES})
|
||||
add_translation_resource(RESOURCES_SRC ${QM_FILES})
|
||||
|
||||
qt5_add_resources(LIB_RESOURCES ${RESOURCES_SRC})
|
||||
|
||||
add_gpui_library(gpui-gui ${UI_SOURCES} ${MOC_SOURCES} ${SOURCES} ${LIB_RESOURCES})
|
||||
target_link_libraries(gpui-gui Qt5::Widgets Qt5::Qml)
|
||||
target_link_libraries(gpui-gui gpui-model gpui-io)
|
||||
|
||||
|
@ -54,8 +54,8 @@ CommandLineParser::~CommandLineParser()
|
||||
|
||||
CommandLineParser::CommandLineParseResult CommandLineParser::parseCommandLine(CommandLineOptions *options, QString *errorMessage)
|
||||
{
|
||||
const QCommandLineOption pathOption("p", "The full path of policy to edit.", "path");
|
||||
const QCommandLineOption bundleOption("b", "The full path of policy bundle to load.", "path");
|
||||
const QCommandLineOption pathOption("p", QObject::tr("The full path of policy to edit."), QObject::tr("path"));
|
||||
const QCommandLineOption bundleOption("b", QObject::tr("The full path of policy bundle to load."), QObject::tr("path"));
|
||||
|
||||
d->parser->setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
|
||||
d->parser->addOption(pathOption);
|
||||
|
@ -144,6 +144,11 @@ void ContentWidget::setPolicyWidgetState(ContentWidget::PolicyWidgetState state)
|
||||
}
|
||||
}
|
||||
|
||||
void ContentWidget::onLanguageChaged()
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
void ContentWidget::onListItemClicked(const QModelIndex &index)
|
||||
{
|
||||
d->currentIndex = index;
|
||||
@ -153,8 +158,8 @@ void ContentWidget::onListItemClicked(const QModelIndex &index)
|
||||
if (d->commandGroup.canExecute() && !d->cancelFlag)
|
||||
{
|
||||
QMessageBox::StandardButton reply;
|
||||
reply = QMessageBox::question(this, "Save settings dialog",
|
||||
"Policy settings were modified do you want to save them?",
|
||||
reply = QMessageBox::question(this, QObject::tr("Save settings dialog"),
|
||||
QObject::tr("Policy settings were modified do you want to save them?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes)
|
||||
{
|
||||
|
@ -61,6 +61,8 @@ namespace gpui {
|
||||
|
||||
void setPolicyWidgetState(PolicyWidgetState state);
|
||||
|
||||
void onLanguageChaged();
|
||||
|
||||
signals:
|
||||
void modelItemSelected(const QModelIndex& index);
|
||||
void savePolicyChanges();
|
||||
|
356
src/gui/i18n/gui_en.ts
Normal file
356
src/gui/i18n/gui_en.ts
Normal file
@ -0,0 +1,356 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>ContentWidget</name>
|
||||
<message>
|
||||
<location filename="../contentwidget.ui" line="+14"/>
|
||||
<source>Form</source>
|
||||
<translation>Form</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+15"/>
|
||||
<source>Local Policies</source>
|
||||
<translation>Local Policies</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+30"/>
|
||||
<source>Policy State</source>
|
||||
<translation>Policy State</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>Not Configured</source>
|
||||
<translation>Not Configured</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Enabled</source>
|
||||
<translation>Enabled</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Disabled</source>
|
||||
<translation>Disabled</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+45"/>
|
||||
<source>Help:</source>
|
||||
<translation>Help:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+45"/>
|
||||
<source>Supported on:</source>
|
||||
<translation>Supported on:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="+14"/>
|
||||
<source>MainWindow</source>
|
||||
<translation>MainWindow</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+59"/>
|
||||
<source>&File</source>
|
||||
<translation>&File</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+13"/>
|
||||
<source>&Action</source>
|
||||
<translation>&Action</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&View</source>
|
||||
<translation>&View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+16"/>
|
||||
<source>&Help</source>
|
||||
<translation>&Help</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+11"/>
|
||||
<source>toolBar</source>
|
||||
<translation>toolBar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+31"/>
|
||||
<source>Go &Back</source>
|
||||
<translation>Go &Back</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Go Back</source>
|
||||
<translation>Go Back</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Alt+Left</source>
|
||||
<translation>Alt+Left</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>Go &Forward</source>
|
||||
<translation>Go &Forward</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Go Forward</source>
|
||||
<translation>Go Forward</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Alt+Right</source>
|
||||
<translation>Alt+Right</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>Go &Up</source>
|
||||
<translation>Go &Up</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Go Up</source>
|
||||
<translation>Go Up</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Alt+Up</source>
|
||||
<translation>Alt+Up</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>&Reload</source>
|
||||
<translation>&Reload</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Reload</source>
|
||||
<translation>Reload</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<location line="+99"/>
|
||||
<source>Ctrl+R</source>
|
||||
<translation>Ctrl+R</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-94"/>
|
||||
<source>&Small Icon View</source>
|
||||
<translation>&Small Icon View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Small Icon View</source>
|
||||
<translation>Small Icon View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Large Icon View</source>
|
||||
<translation>&Large Icon View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Large Icon View</source>
|
||||
<translation>Large Icon View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Compact List View</source>
|
||||
<translation>&Compact List View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Compact List View</source>
|
||||
<translation>Compact List View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>&Options</source>
|
||||
<translation>&Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Options</source>
|
||||
<translation>Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>&Exit</source>
|
||||
<translation>&Exit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Exit</source>
|
||||
<translation>Exit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Add/Remove Columns</source>
|
||||
<translation>&Add/Remove Columns</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Add/Remove Columns</source>
|
||||
<translation>Add/Remove Columns</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Ctrl+A</source>
|
||||
<translation>Ctrl+A</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Detailed List View</source>
|
||||
<translation>&Detailed List View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Detailed List View</source>
|
||||
<translation>Detailed List View</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Select DC</source>
|
||||
<translation>&Select DC</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Select Domain Controller</source>
|
||||
<translation>Select Domain Controller</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Customize</source>
|
||||
<translation>&Customize</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Customize</source>
|
||||
<translation>Customize</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Open &Policy Directory</source>
|
||||
<translation>Open &Policy Directory</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Ctrl+O</source>
|
||||
<translation>Ctrl+O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Open &User Registry Source</source>
|
||||
<translation>Open &User Registry Source</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+8"/>
|
||||
<source>&Save Registry Source</source>
|
||||
<translation>&Save Registry Source</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Ctrl+S</source>
|
||||
<translation>Ctrl+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Open &Machine Registry Source</source>
|
||||
<translation>Open &Machine Registry Source</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Language</source>
|
||||
<translation>&Language</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../commandlineparser.cpp" line="+57"/>
|
||||
<source>The full path of policy to edit.</source>
|
||||
<translation>The full path of policy to edit.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<location line="+1"/>
|
||||
<source>path</source>
|
||||
<translation>path</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<source>The full path of policy bundle to load.</source>
|
||||
<translation>The full path of policy bundle to load.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../contentwidget.cpp" line="+161"/>
|
||||
<source>Save settings dialog</source>
|
||||
<translation>Save settings dialog</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+1"/>
|
||||
<source>Policy settings were modified do you want to save them?</source>
|
||||
<translation>Policy settings were modified do you want to save them?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../presentationbuilder.cpp" line="+90"/>
|
||||
<source>Description:</source>
|
||||
<translation>Description:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+1"/>
|
||||
<source>Options:</source>
|
||||
<translation>Options:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../model/bundle/policybundle.cpp" line="+91"/>
|
||||
<source>Machine</source>
|
||||
<translation>Machine</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<source>Machine level policies</source>
|
||||
<translation>Machine level policies</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+1"/>
|
||||
<source>User</source>
|
||||
<translation>User</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<source>User level policies</source>
|
||||
<translation>User level policies</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SmbFileBrowser</name>
|
||||
<message>
|
||||
<location filename="../smbfilebrowser.ui" line="+14"/>
|
||||
<source>Dialog</source>
|
||||
<translation>Dialog</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+14"/>
|
||||
<source>back</source>
|
||||
<translation>back</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+11"/>
|
||||
<source>Up</source>
|
||||
<translation>Up</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>gpui::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="+235"/>
|
||||
<source>Open Directory</source>
|
||||
<translation>Open Directory</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
356
src/gui/i18n/gui_ru.ts
Normal file
356
src/gui/i18n/gui_ru.ts
Normal file
@ -0,0 +1,356 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="ru_RU">
|
||||
<context>
|
||||
<name>ContentWidget</name>
|
||||
<message>
|
||||
<location filename="../contentwidget.ui" line="+14"/>
|
||||
<source>Form</source>
|
||||
<translation>Форма</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+15"/>
|
||||
<source>Local Policies</source>
|
||||
<translation>Локальные политики</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+30"/>
|
||||
<source>Policy State</source>
|
||||
<translation>Состояние политики</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>Not Configured</source>
|
||||
<translation>Не настроено</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Enabled</source>
|
||||
<translation>Включено</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+7"/>
|
||||
<source>Disabled</source>
|
||||
<translation>Выключено</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+45"/>
|
||||
<source>Help:</source>
|
||||
<translation>Помощь:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+45"/>
|
||||
<source>Supported on:</source>
|
||||
<translation>Поддерживается на:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="+14"/>
|
||||
<source>MainWindow</source>
|
||||
<translation>Главное окно</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+59"/>
|
||||
<source>&File</source>
|
||||
<translation>&Файл</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+13"/>
|
||||
<source>&Action</source>
|
||||
<translation>&Действие</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&View</source>
|
||||
<translation>&Вид</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+16"/>
|
||||
<source>&Help</source>
|
||||
<translation>&Помощь</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+11"/>
|
||||
<source>toolBar</source>
|
||||
<translation>панель инструментов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+31"/>
|
||||
<source>Go &Back</source>
|
||||
<translation>&Назад</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Go Back</source>
|
||||
<translation>Назад</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Alt+Left</source>
|
||||
<translation>Alt+Left</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>Go &Forward</source>
|
||||
<translation>&Вперёд</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Go Forward</source>
|
||||
<translation>Вперёд</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Alt+Right</source>
|
||||
<translation>Alt+Right</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>Go &Up</source>
|
||||
<translation>&Вверх</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Go Up</source>
|
||||
<translation>Вверх</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Alt+Up</source>
|
||||
<translation>Alt+Up</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>&Reload</source>
|
||||
<translation>&Обновить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Reload</source>
|
||||
<translation>Обновить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<location line="+99"/>
|
||||
<source>Ctrl+R</source>
|
||||
<translation>Ctrl+R</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-94"/>
|
||||
<source>&Small Icon View</source>
|
||||
<translation>&Маленькие иконки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Small Icon View</source>
|
||||
<translation>Маленькие иконки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Large Icon View</source>
|
||||
<translation>&Большие иконки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Large Icon View</source>
|
||||
<translation>Большие иконки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Compact List View</source>
|
||||
<translation>&Компактный список</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Compact List View</source>
|
||||
<translation>Компактный список</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>&Options</source>
|
||||
<translation>&Настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Options</source>
|
||||
<translation>Настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+9"/>
|
||||
<source>&Exit</source>
|
||||
<translation>&Выход</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Exit</source>
|
||||
<translation>Выход</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Add/Remove Columns</source>
|
||||
<translation>&Добавить/Удалить колонки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Add/Remove Columns</source>
|
||||
<translation>Добавить/Удалить колонки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Ctrl+A</source>
|
||||
<translation>Ctrl+A</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Detailed List View</source>
|
||||
<translation>&Детальный список</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Detailed List View</source>
|
||||
<translation>Детальный список</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Select DC</source>
|
||||
<translation>&Выберите контролер домена</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Select Domain Controller</source>
|
||||
<translation>Выберите контролер домена</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Customize</source>
|
||||
<translation>&Настроить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Customize</source>
|
||||
<translation>Настроить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Open &Policy Directory</source>
|
||||
<translation>&Открыть папку с ADMX файлами</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Ctrl+O</source>
|
||||
<translation>Ctrl+O</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Open &User Registry Source</source>
|
||||
<translation>&Открыть пользовательский POL файл</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+8"/>
|
||||
<source>&Save Registry Source</source>
|
||||
<translation>&Сохранить настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Ctrl+S</source>
|
||||
<translation>Ctrl+S</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Open &Machine Registry Source</source>
|
||||
<translation>&Открыть машинный POL файл</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Language</source>
|
||||
<translation>&Язык</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../commandlineparser.cpp" line="+57"/>
|
||||
<source>The full path of policy to edit.</source>
|
||||
<translation>Полный путь для редактируемой политики.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<location line="+1"/>
|
||||
<source>path</source>
|
||||
<translation>путь</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<source>The full path of policy bundle to load.</source>
|
||||
<translation>Полный путь к набору ADMX файлов.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../contentwidget.cpp" line="+161"/>
|
||||
<source>Save settings dialog</source>
|
||||
<translation>Состояние настроек</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+1"/>
|
||||
<source>Policy settings were modified do you want to save them?</source>
|
||||
<translation>Настройки политки были изменены, хотите сохранить их?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../presentationbuilder.cpp" line="+90"/>
|
||||
<source>Description:</source>
|
||||
<translation>Описание:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+1"/>
|
||||
<source>Options:</source>
|
||||
<translation>Опции:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../model/bundle/policybundle.cpp" line="+91"/>
|
||||
<source>Machine</source>
|
||||
<translation>Компьютер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<source>Machine level policies</source>
|
||||
<translation>Политики настройки компьютера</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+1"/>
|
||||
<source>User</source>
|
||||
<translation>Пользователь</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+0"/>
|
||||
<source>User level policies</source>
|
||||
<translation>Политики настройки пользователей</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SmbFileBrowser</name>
|
||||
<message>
|
||||
<location filename="../smbfilebrowser.ui" line="+14"/>
|
||||
<source>Dialog</source>
|
||||
<translation>Диалог</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+14"/>
|
||||
<source>back</source>
|
||||
<translation>Назад</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+11"/>
|
||||
<source>Up</source>
|
||||
<translation>Вверх</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>gpui::MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="+235"/>
|
||||
<source>Open Directory</source>
|
||||
<translation>Открыть папку</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
@ -41,6 +41,11 @@
|
||||
|
||||
#include <libnemofolderlistmodel/qsambaclient/smblocationitemfile.h>
|
||||
|
||||
void registerResources()
|
||||
{
|
||||
Q_INIT_RESOURCE(translations);
|
||||
}
|
||||
|
||||
namespace gpui {
|
||||
|
||||
class MainWindowPrivate {
|
||||
@ -59,6 +64,11 @@ public:
|
||||
|
||||
std::unique_ptr<QSortFilterProxyModel> sortModel = nullptr;
|
||||
|
||||
std::vector<std::unique_ptr<QTranslator>> translators;
|
||||
QString localeName;
|
||||
|
||||
CommandLineOptions options;
|
||||
|
||||
MainWindowPrivate()
|
||||
: userRegistry(new model::registry::Registry())
|
||||
, userRegistrySource(new model::registry::PolRegistrySource(userRegistry))
|
||||
@ -129,8 +139,21 @@ MainWindow::MainWindow(CommandLineOptions &options, QWidget *parent)
|
||||
, d(new MainWindowPrivate())
|
||||
, ui(new Ui::MainWindow())
|
||||
{
|
||||
registerResources();
|
||||
|
||||
QLocale locale;
|
||||
std::unique_ptr<QTranslator> qtTranslator = std::make_unique<QTranslator>();
|
||||
qtTranslator->load(locale, "gui", "_", ":/");
|
||||
QCoreApplication::installTranslator(qtTranslator.get());
|
||||
d->translators.push_back(std::move(qtTranslator));
|
||||
d->localeName = locale.name().replace("_", "-");
|
||||
|
||||
d->options = options;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
createLanguageMenu();
|
||||
|
||||
d->contentWidget = new ContentWidget(this);
|
||||
d->contentWidget->setMachineRegistrySource(d->machineRegistrySource.get());
|
||||
d->contentWidget->setUserRegistrySource(d->userRegistrySource.get());
|
||||
@ -146,15 +169,17 @@ MainWindow::MainWindow(CommandLineOptions &options, QWidget *parent)
|
||||
connect(ui->actionSaveRegistrySource, &QAction::triggered, this, &MainWindow::onRegistrySourceSave);
|
||||
connect(ui->treeView, &QTreeView::clicked, d->contentWidget, &ContentWidget::modelItemSelected);
|
||||
|
||||
if (!options.policyBundle.isEmpty())
|
||||
if (d->options.policyBundle.isEmpty())
|
||||
{
|
||||
loadPolicyBundleFolder(options.policyBundle);
|
||||
d->options.policyBundle = "/usr/share/PolicyDefinitions";
|
||||
}
|
||||
|
||||
if (!options.path.isEmpty())
|
||||
loadPolicyBundleFolder(d->options.policyBundle, d->localeName);
|
||||
|
||||
if (!d->options.path.isEmpty())
|
||||
{
|
||||
d->userRegistryPath = options.path + "/User/Registry.pol";
|
||||
d->machineRegistryPath = options.path + "/Machine/Registry.pol";
|
||||
d->userRegistryPath = d->options.path + "/User/Registry.pol";
|
||||
d->machineRegistryPath = d->options.path + "/Machine/Registry.pol";
|
||||
|
||||
onPolFileOpen(d->userRegistryPath, d->userRegistry, d->userRegistrySource,
|
||||
[&](model::registry::AbstractRegistrySource* source)
|
||||
@ -186,10 +211,10 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void gpui::MainWindow::loadPolicyBundleFolder(const QString& path)
|
||||
void gpui::MainWindow::loadPolicyBundleFolder(const QString& path, const QString &locale)
|
||||
{
|
||||
auto bundle = std::make_unique<model::bundle::PolicyBundle>();
|
||||
d->model = bundle->loadFolder(path.toStdString(), "ru-ru");
|
||||
d->model = bundle->loadFolder(path.toStdString(), locale.toStdString());
|
||||
|
||||
d->sortModel = std::make_unique<QSortFilterProxyModel>();
|
||||
d->sortModel->setSourceModel(d->model.get());
|
||||
@ -205,13 +230,13 @@ void gpui::MainWindow::loadPolicyBundleFolder(const QString& path)
|
||||
|
||||
void MainWindow::onDirectoryOpen()
|
||||
{
|
||||
QString directory = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
tr("Open Directory"),
|
||||
QDir::homePath(),
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
d->options.policyBundle = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
tr("Open Directory"),
|
||||
QDir::homePath(),
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
loadPolicyBundleFolder(directory);
|
||||
loadPolicyBundleFolder(d->options.policyBundle, d->localeName);
|
||||
}
|
||||
|
||||
void MainWindow::onUserRegistrySourceOpen()
|
||||
@ -260,6 +285,34 @@ void MainWindow::on_actionExit_triggered()
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
void MainWindow::onLanguageChanged(QAction *action)
|
||||
{
|
||||
for (const auto& translator : d->translators)
|
||||
{
|
||||
qApp->removeTranslator(translator.get());
|
||||
}
|
||||
d->translators.clear();
|
||||
|
||||
QString language = action->data().toString();
|
||||
|
||||
std::unique_ptr<QTranslator> qtTranslator = std::make_unique<QTranslator>();
|
||||
bool loadResult = qtTranslator->load("gui_" + language + ".qm", ":/");
|
||||
QCoreApplication::installTranslator(qtTranslator.get());
|
||||
d->translators.push_back(std::move(qtTranslator));
|
||||
qWarning() << "Load language " << language << loadResult;
|
||||
|
||||
QLocale locale(language);
|
||||
|
||||
d->localeName = locale.name().replace("_", "-");
|
||||
|
||||
loadPolicyBundleFolder(d->options.policyBundle, d->localeName);
|
||||
|
||||
d->contentWidget->onLanguageChaged();
|
||||
ui->retranslateUi(this);
|
||||
|
||||
ui->treeView->selectionModel()->clearSelection();
|
||||
}
|
||||
|
||||
void MainWindow::onRegistrySourceOpen(std::shared_ptr<model::registry::Registry>& registry,
|
||||
std::unique_ptr<model::registry::AbstractRegistrySource>& source,
|
||||
std::function<void(model::registry::AbstractRegistrySource* source)> callback)
|
||||
@ -325,4 +378,39 @@ void MainWindow::onPolFileOpen(const QString &path,
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::createLanguageMenu()
|
||||
{
|
||||
QActionGroup* langGroup = new QActionGroup(this);
|
||||
langGroup->setExclusive(true);
|
||||
|
||||
connect(langGroup, &QActionGroup::triggered, this, &MainWindow::onLanguageChanged);
|
||||
|
||||
QString defaultLocale = QLocale::system().name().left(QLocale::system().name().lastIndexOf('_'));
|
||||
QDir dir(":/");
|
||||
QStringList fileNames = dir.entryList(QStringList("gui_*.qm"));
|
||||
|
||||
QMenu* menu = new QMenu(this);
|
||||
ui->actionLanguage->setMenu(menu);
|
||||
|
||||
for (QString locale : fileNames)
|
||||
{
|
||||
locale.truncate(locale.lastIndexOf('.'));
|
||||
locale.remove(0, locale.lastIndexOf('_') + 1);
|
||||
|
||||
QString language = QLocale::languageToString(QLocale(locale).language());
|
||||
|
||||
QAction *action = new QAction(language, this);
|
||||
action->setCheckable(true);
|
||||
action->setData(locale);
|
||||
|
||||
menu->addAction(action);
|
||||
langGroup->addAction(action);
|
||||
|
||||
if (defaultLocale == locale)
|
||||
{
|
||||
action->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ namespace gpui {
|
||||
|
||||
void on_actionExit_triggered();
|
||||
|
||||
void onLanguageChanged(QAction *action);
|
||||
|
||||
private:
|
||||
void onRegistrySourceOpen(std::shared_ptr<model::registry::Registry>& registry,
|
||||
std::unique_ptr<model::registry::AbstractRegistrySource>& source,
|
||||
@ -76,7 +78,9 @@ namespace gpui {
|
||||
std::unique_ptr<model::registry::AbstractRegistrySource>& source,
|
||||
std::function<void(model::registry::AbstractRegistrySource* source)> callback);
|
||||
|
||||
void loadPolicyBundleFolder(const QString& path);
|
||||
void loadPolicyBundleFolder(const QString& path, const QString& locale);
|
||||
|
||||
void createLanguageMenu();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@
|
||||
<addaction name="actionSelectDC"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCustomize"/>
|
||||
<addaction name="actionLanguage"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Help">
|
||||
<property name="title">
|
||||
@ -311,6 +312,11 @@
|
||||
<string>Open &Machine Registry Source</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLanguage">
|
||||
<property name="text">
|
||||
<string>&Language</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -87,8 +87,8 @@ namespace gui
|
||||
QHBoxLayout* createCaptions()
|
||||
{
|
||||
QHBoxLayout* horizontalLayout = new QHBoxLayout();
|
||||
QLabel* descriptionLabel = new QLabel("Description:");
|
||||
QLabel* optionLabel = new QLabel("Options:");
|
||||
QLabel* descriptionLabel = new QLabel(QObject::tr("Description:"));
|
||||
QLabel* optionLabel = new QLabel(QObject::tr("Options:"));
|
||||
horizontalLayout->addWidget(descriptionLabel);
|
||||
horizontalLayout->addWidget(optionLabel);
|
||||
return horizontalLayout;
|
||||
@ -200,9 +200,26 @@ namespace gui
|
||||
|
||||
virtual void visit(ListBox &widget) const override
|
||||
{
|
||||
QListWidget* listWidget = new QListWidget();
|
||||
QListWidget* listBox = new QListWidget();
|
||||
|
||||
QLayoutItem* container = createAndAttachLabel<QHBoxLayout>(listWidget, QString::fromStdString(widget.label));
|
||||
QLayoutItem* container = createAndAttachLabel<QHBoxLayout>(listBox, QString::fromStdString(widget.label));
|
||||
|
||||
if (m_policy && m_source)
|
||||
{
|
||||
std::pair<std::string, std::string> keyValuePair = findKeyAndValueName();
|
||||
|
||||
if (m_source->isValuePresent(keyValuePair.first, keyValuePair.second))
|
||||
{
|
||||
QString items = m_source->getValue(keyValuePair.first, keyValuePair.second).value<QString>();
|
||||
listBox->addItems(items.split('\0', QString::SplitBehavior::SkipEmptyParts));
|
||||
}
|
||||
|
||||
listBox->connect(listBox, &QListWidget::itemChanged, [=](QListWidgetItem *item) {
|
||||
createCommand([=](){
|
||||
QString items = m_source->getValue(keyValuePair.first, keyValuePair.second).value<QString>();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
addToLayout(container);
|
||||
}
|
||||
|
6
src/gui/translations.qrc
Normal file
6
src/gui/translations.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/">
|
||||
<file>gui_en.qm</file>
|
||||
<file>gui_ru.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -88,8 +88,8 @@ std::unique_ptr<QStandardItemModel> PolicyBundle::loadFolder(const std::string&
|
||||
|
||||
QStandardItem* rootItem = d->treeModel->invisibleRootItem();
|
||||
|
||||
d->rootMachineItem = createItem("Machine", "folder", "Machine level policies");
|
||||
d->rootUserItem = createItem("User", "folder", "User level policies");
|
||||
d->rootMachineItem = createItem(QObject::tr("Machine"), "folder", QObject::tr("Machine level policies"));
|
||||
d->rootUserItem = createItem(QObject::tr("User"), "folder", QObject::tr("User level policies"));
|
||||
|
||||
rootItem->appendRow(d->rootMachineItem);
|
||||
rootItem->appendRow(d->rootUserItem);
|
||||
|
Loading…
x
Reference in New Issue
Block a user