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

Remove .pot Files from the Repository and Always Generate Them #1764

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .github/actions/weblate-pull-translations/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Retrieve *.po and *.pot files from weblate repository
name: Retrieve *.po files from weblate repository

runs:
using: "composite"
Expand All @@ -9,15 +9,15 @@ runs:
repository: ${{ github.repository }}-l10n
path: .l10n

- name: Copy *.po and *.pot files from weblate repository
- 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 file in "${component}"/*.{po,pot}; do
for file in "${component}"/*.po; do
if [ -f "$file" ]; then
cp "${file}" "../${source_path}/"
fi
Expand All @@ -32,7 +32,7 @@ runs:
run: |
rm -rf .l10n

- name: Commit *.po and *.pot files
- name: Commit *.po files
shell: bash
run: |
# only commit if there is any change in translations
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/weblate-sync-pot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ jobs:
run: |
git config --global user.name "GitHub Workflow"
git config --global user.email "[email protected]"
pushd src
pushd src/build
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
mkdir -p ../../l10n/${component}
cp ${f} ../../l10n/${component}/${potfile}
echo ${f%/*} > ../../l10n/${component}/PATH
done
popd
git -C l10n add "*"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ __pycache__
*.log
*.tar.gz
libdnf5/conf/config.h
*.pot
10 changes: 6 additions & 4 deletions cmake/Translations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ find_package(Gettext)
set(COMPONENT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/..)
file(GLOB_RECURSE POT_SOURCES RELATIVE ${COMPONENT_PATH} ${COMPONENT_PATH}/*.cpp ${COMPONENT_PATH}/*.hpp)

# target to refresh pot file from current sources
add_custom_target(${GETTEXT_DOMAIN}-pot
# target to generate .pot file
set(POT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${GETTEXT_DOMAIN}.pot)
add_custom_command(OUTPUT ${POT_PATH}
COMMENT "Generating fresh ${GETTEXT_DOMAIN}.pot file from sources"
COMMAND ${XGETTEXT_COMMAND} --output=po/${GETTEXT_DOMAIN}.pot ${POT_SOURCES}
COMMAND ${XGETTEXT_COMMAND} --output=${POT_PATH} ${POT_SOURCES}
WORKING_DIRECTORY ${COMPONENT_PATH}
)
add_custom_target(${GETTEXT_DOMAIN}-pot DEPENDS ${POT_PATH})
add_dependencies(gettext-potfiles ${GETTEXT_DOMAIN}-pot)


Expand All @@ -21,5 +23,5 @@ if (GETTEXT_FOUND)
file(GLOB POS ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
file(COPY ${POS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(GLOB POS_BIN ${CMAKE_CURRENT_BINARY_DIR}/*.po)
GETTEXT_CREATE_TRANSLATIONS(${GETTEXT_DOMAIN}.pot ALL ${POS_BIN})
GETTEXT_CREATE_TRANSLATIONS(${POT_PATH} ALL ${POS_BIN})
endif()
112 changes: 0 additions & 112 deletions dnf5-plugins/automatic_plugin/po/dnf5-plugin-automatic.pot

This file was deleted.

28 changes: 0 additions & 28 deletions dnf5-plugins/builddep_plugin/po/dnf5-plugin-builddep.pot

This file was deleted.

23 changes: 0 additions & 23 deletions dnf5-plugins/changelog_plugin/po/dnf5-plugin-changelog.pot

This file was deleted.

Loading
Loading