Skip to content

Commit

Permalink
Moved translations on qtilities-i18n GitHub organization
Browse files Browse the repository at this point in the history
  • Loading branch information
redtide committed Dec 30, 2023
1 parent 727df35 commit 9b50475
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 331 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build*/
resources/translations/
*.pyc
ui_*.py
CMakeLists.txt.user
Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

option(PROJECT_TRANSLATIONS_UPDATE "Update source translations [default: OFF]" OFF)
option(PROJECT_USE_APPSTREAM_ID "Whether to use AppStream naming [default: ON]" OFF)
option(QTILITIES_USE_DOWNLOAD_TRANSLATIONS "Download translations if missing [default: ON]" ON)
option(PROJECT_TRANSLATIONS_UPDATE "Update source translations [default: OFF]" OFF)
option(PROJECT_USE_APPSTREAM_ID "Whether to use AppStream naming [default: OFF]" OFF)
set(PROJECT_TRANSLATION_TEST_ENABLED 0 CACHE STRING "Whether to enable translation testing [default: 0]")
set(PROJECT_TRANSLATION_TEST "it" CACHE STRING "Country code of language to test in IDE [default: it]")

Expand Down Expand Up @@ -57,6 +58,12 @@ source_group("Misc" FILES ${PROJECT_OTHER_FILES})
include(Config.cmake)
include(QtAppResources)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(QTILITIES_USE_DOWNLOAD_TRANSLATIONS)
include(GitDownloadTranslations)
git_download_translations("${PROJECT_REPOSITORY_I18N_URL}" "${CMAKE_CURRENT_SOURCE_DIR}/resources")
endif()

set(PROJECT_ALL_FILES
${PROJECT_DESKTOP_FILES}
${PROJECT_RESOURCES}
Expand Down
31 changes: 16 additions & 15 deletions Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

# Essential, non translatable application information (except DESCRIPTION).
# Translatable strings are passed via code.
string(TOLOWER ${PROJECT_NAME} PROJECT_ID)
list(APPEND PROJECT_CATEGORIES "Qt;KDE;Graphics;Utility") # Freedesktop menu categories
list(APPEND PROJECT_KEYWORDS "colorpicker;color-picker;contrast-ratio")
set(PROJECT_AUTHOR_NAME "Aurélien Gâteau, Andrea Zanellato")
set(PROJECT_AUTHOR_EMAIL "[email protected]") # Used also for organization email
set(PROJECT_COPYRIGHT_YEAR "2023") # TODO: from git
set(PROJECT_DESCRIPTION "A color picker with a builtin loop and a contrast checker.")
set(PROJECT_ORGANIZATION_NAME "qtilities") # Might be equal to PROJECT_AUTHOR_NAME
set(PROJECT_ORGANIZATION_URL "${PROJECT_ORGANIZATION_NAME}.github.io")
set(PROJECT_HOMEPAGE_URL "https://${PROJECT_ORGANIZATION_URL}/${PROJECT_ID}")
set(PROJECT_REPOSITORY_URL "https://github.com/${PROJECT_ORGANIZATION_NAME}/${PROJECT_ID}")
set(PROJECT_REPOSITORY_BRANCH "master")
set(PROJECT_SPDX_ID "BSD-3-Clause-Clear")
set(PROJECT_TRANSLATIONS_DIR "resources/translations")
set(PROJECT_ICON_FORMAT "svg")
string(TOLOWER ${PROJECT_NAME} PROJECT_ID)
list(APPEND PROJECT_CATEGORIES "Qt;KDE;Graphics;Utility") # Freedesktop menu categories
list(APPEND PROJECT_KEYWORDS "colorpicker;color-picker;contrast-ratio")
set(PROJECT_AUTHOR_NAME "Aurélien Gâteau, Andrea Zanellato")
set(PROJECT_AUTHOR_EMAIL "[email protected]") # Used also for organization email
set(PROJECT_COPYRIGHT_YEAR "2023") # TODO: from git
set(PROJECT_DESCRIPTION "A color picker with a builtin loop and a contrast checker.")
set(PROJECT_ORGANIZATION_NAME "qtilities") # Might be equal to PROJECT_AUTHOR_NAME
set(PROJECT_ORGANIZATION_URL "${PROJECT_ORGANIZATION_NAME}.github.io")
set(PROJECT_HOMEPAGE_URL "https://${PROJECT_ORGANIZATION_URL}/${PROJECT_ID}")
set(PROJECT_REPOSITORY_URL "https://github.com/${PROJECT_ORGANIZATION_NAME}/${PROJECT_ID}")
set(PROJECT_REPOSITORY_I18N_URL "https://github.com/${PROJECT_ORGANIZATION_NAME}-i18n/${PROJECT_ID}")
set(PROJECT_REPOSITORY_BRANCH "master")
set(PROJECT_SPDX_ID "BSD-3-Clause-Clear")
set(PROJECT_TRANSLATIONS_DIR "resources/translations")
set(PROJECT_ICON_FORMAT "svg")

# Appstream
if(PROJECT_USE_APPSTREAM)
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ Using `sudo make install` is discouraged, instead use the system package manager

## Translations

Translations was moved to [qtilities-i18n] organization for convenience.

To contribute language translations, you can use Qt Linguist and/or manually:

- Copy `resource/translations/colorpick.ts` language template to
`resource/translations/colorpick_<country-code>.ts`, e.g.: `colorpick_de.ts`
- Copy `translations/colorpick.ts` language template to
`translations/colorpick_<country-code>.ts`, e.g.: `colorpick_de.ts`
- Set the language in the file:
from `<TS version="2.1">` to `<TS version="2.1" language="de">`
- Copy `resource/translations/colorpick.desktop.yaml` language template to
`resource/translations/colorpick_<country-code>.desktop.yaml`, e.g.: `colorpick_de.desktop.yaml`
- Translate them (see the existing translations as reference)
- Copy `translations/colorpick.desktop.yaml` language template to
`translations/colorpick_<your_country_code>.desktop.yaml`, e.g.: `colorpick_de.desktop.yaml`
- Translate them (see existing translations for reference).
- Create a Pull Request with your changes.

## Authors
Expand All @@ -79,4 +81,5 @@ See the [AUTHORS] file.
[BSD-3-Clause-Clear]: https://spdx.org/licenses/BSD-3-Clause-Clear.html
[CI]: https://github.com/qtilities/colorpick/actions/workflows/build.yml/badge.svg
[Packaging status]: https://repology.org/badge/vertical-allrepos/colorpick.svg
[qtilities-i18n]: https://github.com/qtilities-i18n/colorpick/
[Qtilitools]: https://github.com/qtilities/qtilitools/
12 changes: 12 additions & 0 deletions cmake/GitDownloadTranslations.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_package(Git REQUIRED)
function(git_download_translations repo destdir)
if(NOT EXISTS "${destdir}/translations")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/i18n")
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${repo}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/i18n"
COMMAND_ERROR_IS_FATAL ANY
)
file(COPY "${CMAKE_CURRENT_BINARY_DIR}/i18n/${PROJECT_ID}/translations" DESTINATION ${destdir})
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/i18n")
endif()
endfunction()
3 changes: 0 additions & 3 deletions resources/translations/colorpick.desktop.yaml

This file was deleted.

101 changes: 0 additions & 101 deletions resources/translations/colorpick.ts

This file was deleted.

3 changes: 0 additions & 3 deletions resources/translations/colorpick_it.desktop.yaml

This file was deleted.

101 changes: 0 additions & 101 deletions resources/translations/colorpick_it.ts

This file was deleted.

Loading

0 comments on commit 9b50475

Please sign in to comment.