diff --git a/.github/workflows/ci_macos.yaml b/.github/workflows/ci_macos.yaml index 1b965e3..8b4cd25 100644 --- a/.github/workflows/ci_macos.yaml +++ b/.github/workflows/ci_macos.yaml @@ -31,7 +31,7 @@ jobs: uses: jurplel/install-qt-action@v4 with: version: "6.7.*" - archives: qtbase qtsvg + archives: qtbase qtsvg qttools qttranslations modules: qtimageformats qtmultimedia - name: Build application @@ -42,6 +42,7 @@ jobs: -D CMAKE_OSX_DEPLOYMENT_TARGET=12.0 \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_OSX_ARCHITECTURES="x86_64;arm64" + cmake --build build --target update_translations cmake --build build - name: Prepare build artifacts diff --git a/.github/workflows/ci_windows.yaml b/.github/workflows/ci_windows.yaml index 7e4adc4..af5b4ab 100644 --- a/.github/workflows/ci_windows.yaml +++ b/.github/workflows/ci_windows.yaml @@ -32,7 +32,7 @@ jobs: uses: jurplel/install-qt-action@v4 with: version: "6.7.*" - archives: qtbase qtsvg + archives: qtbase qtsvg qttools qttranslations modules: qtimageformats qtmultimedia - name: Build application @@ -41,6 +41,7 @@ jobs: -B build ` -G Ninja ` -D CMAKE_BUILD_TYPE=Release + cmake --build build --target update_translations cmake --build build - name: Prepare build artifacts diff --git a/.tx/config b/.tx/config new file mode 100755 index 0000000..4c7f611 --- /dev/null +++ b/.tx/config @@ -0,0 +1,102 @@ +[main] +host = https://app.transifex.com + +[o:nick-korotysh:p:digital-clock-5:r:app] +file_filter = app/i18n/digital_clock_.ts +source_file = app/i18n/digital_clock_en.ts +type = QT +minimum_perc = 0 +resource_name = digital_clock +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-any-zoom] +file_filter = plugins/any_zoom/i18n/any_zoom_.ts +source_file = plugins/any_zoom/i18n/any_zoom_en.ts +type = QT +minimum_perc = 0 +resource_name = any_zoom +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-chime] +file_filter = plugins/chime/i18n/chime_.ts +source_file = plugins/chime/i18n/chime_en.ts +type = QT +minimum_perc = 0 +resource_name = chime +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-core] +file_filter = plugin_core/i18n/plugin_core_.ts +source_file = plugin_core/i18n/plugin_core_en.ts +type = QT +minimum_perc = 0 +resource_name = plugin_core +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-countdown-timer] +file_filter = plugins/countdown_timer/i18n/countdown_timer_.ts +source_file = plugins/countdown_timer/i18n/countdown_timer_en.ts +type = QT +minimum_perc = 0 +resource_name = countdown_timer +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-date] +file_filter = plugins/date/i18n/date_.ts +source_file = plugins/date/i18n/date_en.ts +type = QT +minimum_perc = 0 +resource_name = date +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-quick-note] +file_filter = plugins/quick_note/i18n/quick_note_.ts +source_file = plugins/quick_note/i18n/quick_note_en.ts +type = QT +minimum_perc = 0 +resource_name = quick_note +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-random-position] +file_filter = plugins/random_position/i18n/random_position_.ts +source_file = plugins/random_position/i18n/random_position_en.ts +type = QT +minimum_perc = 0 +resource_name = random_position +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-spectrum-clock] +file_filter = plugins/spectrum_clock/i18n/spectrum_clock_.ts +source_file = plugins/spectrum_clock/i18n/spectrum_clock_en.ts +type = QT +minimum_perc = 0 +resource_name = spectrum_clock +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-stopwatch] +file_filter = plugins/stopwatch/i18n/stopwatch_.ts +source_file = plugins/stopwatch/i18n/stopwatch_en.ts +type = QT +minimum_perc = 0 +resource_name = stopwatch +replace_edited_strings = false +keep_translations = false + +[o:nick-korotysh:p:digital-clock-5:r:plugin-var-translucency] +file_filter = plugins/var_translucency/i18n/var_translucency_.ts +source_file = plugins/var_translucency/i18n/var_translucency_en.ts +type = QT +minimum_perc = 0 +resource_name = var_translucency +replace_edited_strings = false +keep_translations = false + diff --git a/CMakeLists.txt b/CMakeLists.txt index 51df1d4..2de3951 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Network Svg OPTIONAL_COMPONENTS Multimedia) +find_package(Qt6 6.7 REQUIRED COMPONENTS LinguistTools) -qt_standard_project_setup() +qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES en ru zh_CN) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) include(clock_utils) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 8f1b33d..d7dcdce 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -84,3 +84,4 @@ if (APPLE) endif() target_win_deploy_qt(${PROJECT_NAME} ${PROJECT_NAME}.exe) +target_add_translations(${PROJECT_NAME} digital_clock) diff --git a/cmake/Modules/clock_utils.cmake b/cmake/Modules/clock_utils.cmake index 89b63ba..2c209d6 100644 --- a/cmake/Modules/clock_utils.cmake +++ b/cmake/Modules/clock_utils.cmake @@ -17,3 +17,9 @@ if (NOT WIN32) # Win32 implementation is in MSI build code endfunction() endif() + +function(target_add_translations _target _base) + qt_add_translations(TARGETS ${_target} TS_FILE_DIR i18n TS_FILE_BASE ${_base}) + file(GLOB ts_files i18n/*.ts) + set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION i18n) +endfunction() diff --git a/plugin_core/CMakeLists.txt b/plugin_core/CMakeLists.txt index 48b5ec3..0b233d5 100644 --- a/plugin_core/CMakeLists.txt +++ b/plugin_core/CMakeLists.txt @@ -32,3 +32,4 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${PROJECT_NAME} PUBLIC SkinEngine ClockCommon) target_win_deploy_qt(${PROJECT_NAME} ${PROJECT_NAME}.dll) +target_add_translations(${PROJECT_NAME} plugin_core) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index ddb0763..6d5ff18 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -17,6 +17,7 @@ function(set_clock_plugin_common_properties target) ) endif() set_target_properties(${target} PROPERTIES PREFIX "") + target_add_translations(${target} ${target}) endfunction() add_subdirectory(any_zoom)