Skip to content

Commit

Permalink
Improve translation build
Browse files Browse the repository at this point in the history
  • Loading branch information
jakejackson1 committed Oct 15, 2024
1 parent 84001ef commit 2bc4244
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions bin/build-wp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ FILES=(
"${PACKAGE_DIR}/.nvmrc"
"${PACKAGE_DIR}/.wp-env.json"
"${PACKAGE_DIR}/.testcaferc.js"
"${PACKAGE_DIR}/gravity-pdf-updater.php"
)

for i in "${FILES[@]}"
Expand All @@ -57,7 +56,13 @@ rm -f -R "${PACKAGE_DIR}/bin"
rm -f -R "${PACKAGE_DIR}/.php-scoper"
rm -f -R "${PACKAGE_DIR}/webpack-configs"

# Generate language files
cd "${PACKAGE_DIR}"
npm install --global wp-pot-cli
wp-pot --domain gravity-pdf --src 'src/**/*.php' --src 'pdf.php' --src 'api.php' --src 'gravity-pdf-updater.php' --package 'Gravity PDF' --dest-file src/assets/languages/gravity-pdf.pot > /dev/null

# Replace text domain
cd "${WORKING_DIR}"
if [[ "$OSTYPE" == "darwin"* ]]; then
# OSX support
find "${PACKAGE_DIR}" -type f -name '*.php' -print0 | LC_ALL=C xargs -0 sed -i '' -e "s/'gravity-pdf'/'gravity-forms-pdf-extended'/g"
Expand All @@ -76,13 +81,11 @@ else
sed -i -e "s|Update URI: https://gravitypdf.com||g" "${PACKAGE_DIR}/pdf.php"
fi;

# Generate language files
cd ${PACKAGE_DIR}
npm install --global wp-pot-cli
wp-pot --domain gravity-forms-pdf-extended --src 'src/**/*.php' --src 'pdf.php' --src 'api.php' --package 'Gravity PDF' --dest-file src/assets/languages/gravity-forms-pdf-extended.pot > /dev/null
# Remove updater
rm -f "${PACKAGE_DIR}/gravity-pdf-updater.php"

# Create zip package
cd ../
cd "${PACKAGE_DIR}/../"

rm -r -f "${PACKAGE_NAME}"
mv ${VERSION} "${PACKAGE_NAME}"
Expand Down
4 changes: 2 additions & 2 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ rm -f -R "${PACKAGE_DIR}/.php-scoper"
rm -f -R "${PACKAGE_DIR}/webpack-configs"

# Generate language files
cd ${PACKAGE_DIR}
cd "${PACKAGE_DIR}"
npm install --global wp-pot-cli
wp-pot --domain gravity-pdf --src 'src/**/*.php' --src 'pdf.php' --src 'api.php' --src 'gravity-pdf-updater.php' --package 'Gravity PDF' --dest-file src/assets/languages/gravity-pdf.pot > /dev/null

# Create zip package
cd ../
cd "${PACKAGE_DIR}/../"

rm -r -f "${PACKAGE_NAME}"
mv ${VERSION} "${PACKAGE_NAME}"
Expand Down

0 comments on commit 2bc4244

Please sign in to comment.