Skip to content

Commit

Permalink
prepare translation support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolcha committed Aug 30, 2024
1 parent e9c4055 commit 1979012
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
uses: jurplel/install-qt-action@v4
with:
version: "6.7.*"
archives: qtbase qtsvg
modules: qtimageformats qtmultimedia

- name: Build application
Expand All @@ -42,6 +41,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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
102 changes: 102 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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_<lang>.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

3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ if (APPLE)
endif()

target_win_deploy_qt(${PROJECT_NAME} ${PROJECT_NAME}.exe)
target_add_translations(${PROJECT_NAME} digital_clock)
6 changes: 6 additions & 0 deletions cmake/Modules/clock_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions plugin_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1979012

Please sign in to comment.