Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow for *.pot synchronization to weblate #1009

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/actions/weblate-pull-translations/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Retrieve *.po files from weblate repository

runs:
using: "composite"
steps:
- name: Clone weblate repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}-l10n
path: .l10n

- name: Copy *.po files from weblate repository
shell: bash
run: |
pushd .l10n
for component in $(find . -mindepth 1 -maxdepth 1 -type d -not -path './.*'); do
source_path=""
if [ -f "${component}/PATH" ]; then
read -r source_path < "${component}/PATH"
for po in "${component}"/*.po; do
if [ -f "$po" ]; then
cp "${po}" "../${source_path}/"
fi
done
git -C .. add "${source_path}"
fi
done
popd

- name: Cleanup the weblate repository
shell: bash
run: |
rm -rf .l10n

- name: Commit *.po files
shell: bash
run: |
git -c user.name='GitHub Workflow' -c user.email='[email protected]' commit -m "Update translations from weblate"
5 changes: 5 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Update translations from weblate
uses: ./.github/actions/weblate-pull-translations

- name: Prepare release content
uses: inknos/[email protected]
with:
version: ${{ inputs.version }}
specfiles: dnf5.spec

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/weblate-sync-pot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Weblate - *.pot synchronization
on:
schedule:
# Run this every morning
- cron: '45 2 * * *'
workflow_dispatch:

jobs:
pot-upload:
name: Upload *.pot files to dnf5-l10n repository
runs-on: ubuntu-latest
container:
image: ghcr.io/rpm-software-management/dnf-ci-host
options: --user root
timeout-minutes: 10
steps:
- name: Clone source repository
uses: actions/checkout@v4
with:
path: src
fetch-depth: 1

- name: Generate fresh *.pot files
run: |
cd src
cmake -S . -B build
cmake --build build --target gettext-potfiles

- name: Clone weblate repository
uses: actions/checkout@v4
with:
path: l10n
repository: ${{ github.repository }}-l10n
ssh-key: ${{ secrets.L10N_SSH_KEY }}

- name: Commit .pot to weblate repo
run: |
git config --global user.name "GitHub Workflow"
git config --global user.email "[email protected]"
pushd src
for f in $(find * -type f -name "*.pot"); do
potfile=$(basename $f)
component=${potfile%.*}
mkdir -p ../l10n/${component}
cp ${f} ../l10n/${component}/${potfile}
echo ${f%/*} > ../l10n/${component}/PATH
done
popd
git -C l10n add "*"
git -C l10n commit -m "Update source files"
git -C l10n push
5 changes: 4 additions & 1 deletion dnf5-plugins/builddep_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# set gettext domain for translations
add_definitions(-DGETTEXT_DOMAIN=\"dnf5_cmd_builddep\")
set(GETTEXT_DOMAIN dnf5-plugin-builddep)
add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\")

add_library(builddep_cmd_plugin MODULE builddep.cpp builddep_cmd_plugin.cpp)

Expand All @@ -16,3 +17,5 @@ target_link_libraries(builddep_cmd_plugin PRIVATE libdnf5 libdnf5-cli)
target_link_libraries(builddep_cmd_plugin PRIVATE dnf5)

install(TARGETS builddep_cmd_plugin LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/dnf5/plugins/)

add_subdirectory(po)
5 changes: 5 additions & 0 deletions dnf5-plugins/builddep_plugin/po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(NOT WITH_TRANSLATIONS)
return()
endif()

include(Translations)
28 changes: 28 additions & 0 deletions dnf5-plugins/builddep_plugin/po/dnf5-plugin-builddep.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-02 10:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: builddep.cpp:79
msgid ""
"Invalid value for macro definition \"{}\". \"macro expr\" format expected."
msgstr ""

#. failed to parse some of inputs (invalid spec, no package matched...)
#: builddep.cpp:249
msgid "Failed to parse some inputs."
msgstr ""
5 changes: 4 additions & 1 deletion dnf5-plugins/changelog_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# set gettext domain for translations
add_definitions(-DGETTEXT_DOMAIN=\"dnf5_cmd_changelog\")
set(GETTEXT_DOMAIN dnf5-plugin-changelog)
add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\")

add_library(changelog_cmd_plugin MODULE changelog.cpp changelog_cmd_plugin.cpp)

Expand All @@ -10,3 +11,5 @@ target_link_libraries(changelog_cmd_plugin PRIVATE libdnf5 libdnf5-cli)
target_link_libraries(changelog_cmd_plugin PRIVATE dnf5)

install(TARGETS changelog_cmd_plugin LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/dnf5/plugins/)

add_subdirectory(po)
5 changes: 5 additions & 0 deletions dnf5-plugins/changelog_plugin/po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(NOT WITH_TRANSLATIONS)
return()
endif()

include(Translations)
23 changes: 23 additions & 0 deletions dnf5-plugins/changelog_plugin/po/dnf5-plugin-changelog.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-02 10:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: changelog.cpp:60
msgid ""
"Invalid date passed: \"{}\". Dates in \"YYYY-MM-DD\" format are expected"
msgstr ""
5 changes: 4 additions & 1 deletion dnf5-plugins/config-manager_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# set gettext domain for translations
add_definitions(-DGETTEXT_DOMAIN=\"dnf5_cmd_config-manager\")
set(GETTEXT_DOMAIN dnf5-plugin-config-manager)
add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\")

file(GLOB CONFIG_MANAGER_SOURCES *.cpp)
add_library(config-manager_cmd_plugin MODULE ${CONFIG_MANAGER_SOURCES})
Expand All @@ -17,3 +18,5 @@ target_link_libraries(config-manager_cmd_plugin PRIVATE libdnf5 libdnf5-cli)
target_link_libraries(config-manager_cmd_plugin PRIVATE dnf5)

install(TARGETS config-manager_cmd_plugin LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/dnf5/plugins/)

add_subdirectory(po)
5 changes: 5 additions & 0 deletions dnf5-plugins/config-manager_plugin/po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(NOT WITH_TRANSLATIONS)
return()
endif()

include(Translations)
171 changes: 171 additions & 0 deletions dnf5-plugins/config-manager_plugin/po/dnf5-plugin-config-manager.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-21 08:12+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: addrepo.cpp:152
msgid "from-repofile: \"{}\" file does not exist"
msgstr ""

#: addrepo.cpp:155
msgid "from-repofile: {}"
msgstr ""

#: addrepo.cpp:184
msgid "set: Badly formatted argument value \"{}\""
msgstr ""

#: addrepo.cpp:194
msgid "Cannot set repository option \"{}={}\": {}"
msgstr ""

#: addrepo.cpp:202 setopt.cpp:136
msgid "Sets the \"{}\" option again with a different value: \"{}\" != \"{}\""
msgstr ""

#: addrepo.cpp:268
msgid "Missing path to repository configuration directory"
msgstr ""

#: addrepo.cpp:318
msgid "Failed to copy repository configuration file \"{}\": {}"
msgstr ""

#: addrepo.cpp:329
msgid "Failed to download repository configuration file \"{}\": {}"
msgstr ""

#: addrepo.cpp:351
msgid ""
"Error in added repository configuration file. Cannot set repository option "
"\"{}={}\": {}"
msgstr ""

#: addrepo.cpp:385
msgid "Bad baseurl: {}={}"
msgstr ""

#: addrepo.cpp:393
msgid ""
"One of --from-repofile=<URL>, --set=baseurl=<URL>, --set=mirrorlist=<URL>, --"
"set=metalink=<URL> must be set to a non-empty URL"
msgstr ""

#: addrepo.cpp:438
msgid "Failed to save repository configuration file \"{}\": {}"
msgstr ""

#: addrepo.cpp:460
msgid ""
"File \"{}\" already exists and configures repositories with IDs \"{}\". Add "
"\"--add-or-replace\" or \"--overwrite\"."
msgstr ""

#: addrepo.cpp:463
msgid ""
"File \"{}\" already exists and configures repositories with IDs \"{}\". Add "
"\"--overwrite\" to overwrite."
msgstr ""

#: addrepo.cpp:483 addrepo.cpp:508
msgid "A repository with id \"{}\" already configured in file: {}"
msgstr ""

#: setopt.cpp:82
msgid "optval: Badly formatted argument value \"{}\""
msgstr ""

#: setopt.cpp:90
msgid ""
"optval: Badly formatted argument value: Last key character cannot be '.': {}"
msgstr ""

#: setopt.cpp:98
msgid "optval: Empty repository id is not allowed: {}"
msgstr ""

#: setopt.cpp:107
msgid "Cannot set repository option \"{}\": {}"
msgstr ""

#: setopt.cpp:114 setopt.cpp:177
msgid ""
"Sets the \"{}\" option of the repository \"{}\" again with a different "
"value: \"{}\" != \"{}\""
msgstr ""

#: setopt.cpp:128
msgid "Cannot set option: \"{}\": {}"
msgstr ""

#: setopt.cpp:168
msgid "No matching repository to modify: {}"
msgstr ""

#: setvar.cpp:49
msgid "varval: Badly formatted argument value \"{}\""
msgstr ""

#: setvar.cpp:60
msgid "Cannot set \"{}\": Variable \"{}\" is read-only"
msgstr ""

#: setvar.cpp:68
msgid "Sets the \"{}\" variable again with a different value: \"{}\" != \"{}\""
msgstr ""

#: setvar.cpp:97 unsetvar.cpp:63
msgid "Missing path to vars directory"
msgstr ""

#: setvar.cpp:110
msgid "Cannot write variable to file \"{}\": {}"
msgstr ""

#: shared.hpp:49
msgid ""
"The path \"{}\" exists, but it is not a directory or a symlink to a "
"directory."
msgstr ""

#: shared.hpp:54
msgid "The path \"{}\" exists, but it is a symlink to a non-existent object."
msgstr ""

#: shared.hpp:60
msgid ""
"Directory \"{}\" does not exist. Add \"--create-missing-dir\" to create "
"missing directories."
msgstr ""

#: shared.hpp:71
msgid "Variable name can contain only ASCII letters, numbers and '_': {}"
msgstr ""

#: unsetopt.cpp:65
msgid ""
"remove-opt: Badly formatted argument value: Last key character cannot be "
"'.': {}"
msgstr ""

#: unsetopt.cpp:73
msgid "remove-opt: Empty repository id is not allowed: {}"
msgstr ""

#: unsetvar.cpp:76
msgid "Cannot remove variable file \"{}\": {}"
msgstr ""
Loading
Loading