Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Fix language generation and loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggbecker committed Oct 27, 2021
1 parent 959b2d7 commit e923576
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Install Deps
uses: mstksg/get-package@master
with:
apt-get: build-essential openssh-client libopenscap-dev libqt5xmlpatterns5-dev ssh-askpass asciidoc libpolkit-agent-1-0
apt-get: build-essential openssh-client libopenscap-dev libqt5xmlpatterns5-dev ssh-askpass asciidoc libpolkit-agent-1-0 qttools5-dev-tools
- name: Checkout
uses: actions/checkout@v2
- name: Build
Expand All @@ -30,7 +30,7 @@ jobs:
image: fedora:33
steps:
- name: Install Deps
run: dnf install -y cmake gcc-c++ openssh-clients util-linux openscap-devel qt5-qtbase-devel qt5-qtxmlpatterns-devel openssh-askpass asciidoc polkit-libs
run: dnf install -y cmake gcc-c++ openssh-clients util-linux openscap-devel qt5-qtbase-devel qt5-qtxmlpatterns-devel openssh-askpass asciidoc polkit-libs qt5-linguist
- name: Checkout
uses: actions/checkout@v2
- name: Build
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include(GNUInstallDirs)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5XmlPatterns REQUIRED)
find_package(Qt5LinguistTools REQUIRED)

add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)

Expand Down Expand Up @@ -159,7 +160,7 @@ set(scap_workbench_LANGUAGES)
set(scap_workbench_LANGUAGE_TS_FILES)

foreach(LANGUAGE ${scap_workbench_LANGUAGES})
set(TS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/i18n/${LANGUAGE}.ts")
set(TS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/i18n/scap-workbench.${LANGUAGE}.ts")
set(scap_workbench_LANGUAGE_TS_FILES ${scap_workbench_LANGUAGE_TS_FILES} ${TS_FILE})
set_source_files_properties(${TS_FILE} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/i18n")
endforeach()
Expand All @@ -183,7 +184,7 @@ add_executable("scap-workbench" MACOSX_BUNDLE

${scap_workbench_HEADERS_MOC}
${scap_workbench_UIS_HEADERS}
${scap_workbench_LANGUAGE_TS_FILES}
${qm_files}
)

set_target_properties("scap-workbench" PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.in)
Expand Down Expand Up @@ -300,6 +301,9 @@ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/COPYING"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/README.md"
DESTINATION ${CMAKE_INSTALL_DOCDIR})

install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/i18n"
DESTINATION "${CMAKE_INSTALL_DATADIR}/scap-workbench")

if (CPPCHECK_EXECUTABLE)
set(CPPCHECK_INCL_PARAMS -I /usr/include)
foreach(DIR ${SCAP_WORKBENCH_INCLUDE_DIRS})
Expand Down
7 changes: 4 additions & 3 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ Application::Application(int& argc, char** argv):
setApplicationDisplayName("SCAP Workbench");
setApplicationVersion(SCAP_WORKBENCH_VERSION);

mMainWindow = new MainWindow();

#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
mTranslator.load(QLocale(), "scap-workbench", "", getShareTranslationDirectory().absolutePath());
mTranslator.load(QLocale(), "scap-workbench", ".", getShareTranslationDirectory().absolutePath());
installTranslator(&mTranslator);
#endif

// create the main window after loading any translations so it loads properly
mMainWindow = new MainWindow();

const QIcon& icon = getApplicationIcon();
setWindowIcon(icon);
mMainWindow->setWindowIcon(icon);
Expand Down

0 comments on commit e923576

Please sign in to comment.