Skip to content

Commit 78d0cb4

Browse files
committed
Merge branch 'develop' into fix/PIWOO-348
2 parents 2cd2b2a + 44735ce commit 78d0cb4

File tree

66 files changed

+16410
-6694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+16410
-6694
lines changed

.distignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,14 @@ patchwork.json
1616
*.config.*
1717
*.md
1818
gulpfile.js
19+
webpack.config.js
20+
readme.md
1921
changelog.txt
2022
psalm.xml
23+
node_modules/
24+
.babelrc
25+
.composer_compiled_assets
26+
.editorconfig
27+
.env.example
28+
.idea/
29+
.psalm/

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
php-versions: ['7.2', '7.3', '7.4', '8.0']
11+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
1212

1313
name: PHP ${{ matrix.php-versions }}
1414
steps:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Languages-diff
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
PACKAGE_VERSION:
7+
description: 'Package Version'
8+
required: true
9+
jobs:
10+
languages-diff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
- name: "Create CSV of diff translations"
16+
run: |
17+
chmod +x ./convert_csv.sh
18+
./convert_csv.sh
19+
- name: Set artifact name
20+
id: set-artifact-name
21+
run: echo "artifact=mollie-payments-for-woocommerce-languages-${{ inputs.PACKAGE_VERSION }}" >> $GITHUB_OUTPUT
22+
23+
- name: Upload artifact
24+
uses: actions/upload-artifact@v3
25+
with:
26+
name: ${{ steps.set-artifact-name.outputs.artifact }}
27+
path: languages/*

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
required: true
88
jobs:
99
create_archive:
10-
uses: inpsyde/reusable-workflows/.github/workflows/build-plugin-archive.yml@main
10+
uses: inpsyde/reusable-workflows/.github/workflows/build-plugin-archive.yml@task/build-plugin-archive-without-dep-dependencies
1111
with:
1212
PLUGIN_VERSION: ${{ inputs.PACKAGE_VERSION }}
1313
PHP_VERSION: 7.2
1414
PLUGIN_MAIN_FILE: mollie-payments-for-woocommerce.php
1515
ARCHIVE_NAME: mollie-payments-for-woocommerce
16-
PRE_SCRIPT: |
17-
echo 'hello world!';
16+
POST_SCRIPT: |
17+
mv dist/WooCommerce dist/mollie-payments-for-woocommerce

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/tools/
1818
/build/
1919
/tests/e2e/Shared/default.json
20-
20+
package-lock.json
2121
.env
2222
cypress.json
2323
test-results/

.idea/php.xml

Lines changed: 34 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

convert_csv.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
cd languages || exit
4+
5+
POT_FILE="en_GB.pot"
6+
CSV_DIR="untranslated_csv"
7+
8+
LANG_EXT=("-de_DE" "-de_DE_formal" "-es_ES" "-fr_FR" "-it_IT" "-nl_NL" "-nl_NL_formal" "-nl_BE" "-nl_BE_formal")
9+
10+
if [[ ! -e $POT_FILE ]]; then
11+
echo "File $POT_FILE not found."
12+
exit 1
13+
fi
14+
15+
mkdir -p $CSV_DIR # Create the directory if it does not exist
16+
17+
# Loop through each language extension
18+
for lang in "${LANG_EXT[@]}"; do
19+
PO_FILE="mollie-payments-for-woocommerce${lang}.po"
20+
CSV_FILE="$CSV_DIR/mollie-payments-for-woocommerce${lang}.csv"
21+
UNTRANSLATED_FILE="$CSV_DIR/mollie-payments-for-woocommerce${lang}_untranslated.csv"
22+
23+
if [[ -e $PO_FILE ]]; then
24+
msgmerge --update --no-wrap --backup=none "$PO_FILE" "$POT_FILE" # Update PO file with POT file
25+
echo "Updated $PO_FILE with new strings from $POT_FILE"
26+
else
27+
echo "File $PO_FILE not found. Skipping..."
28+
continue
29+
fi
30+
31+
echo 'location,msgid,msgstr,msgctxt' > "$CSV_FILE"
32+
echo 'line,msgid' > "$UNTRANSLATED_FILE"
33+
34+
# Initialize variables
35+
location=""
36+
msgid=""
37+
msgstr=""
38+
msgctxt=""
39+
line_no=0
40+
41+
# Function to write to CSV
42+
write_to_csv() {
43+
echo "\"$location\",\"$msgid\",\"$msgstr\",\"$msgctxt\"" >> "$CSV_FILE"
44+
if [[ -z "$msgstr" && -n "$msgid" ]]; then
45+
echo "$line_no,\"$msgid\"" >> "$UNTRANSLATED_FILE"
46+
fi
47+
# Reset variables
48+
location=""
49+
msgid=""
50+
msgstr=""
51+
msgctxt=""
52+
}
53+
54+
while IFS= read -r line || [[ -n "$line" ]]; do # also handle the last line
55+
((line_no++))
56+
57+
if [[ "$line" =~ ^\#:\ (.+)$ ]]; then
58+
location="${BASH_REMATCH[1]}"
59+
elif [[ "$line" =~ ^msgid\ \"(.*)\"$ ]]; then
60+
if [[ -n "$msgid" || -n "$msgstr" ]]; then
61+
write_to_csv
62+
fi
63+
msgid="${BASH_REMATCH[1]}"
64+
elif [[ "$line" =~ ^msgstr\ \"(.*)\"$ ]]; then
65+
msgstr="${BASH_REMATCH[1]}"
66+
elif [[ "$line" =~ ^msgctxt\ \"(.+)\"$ ]]; then
67+
msgctxt="${BASH_REMATCH[1]}"
68+
fi
69+
done < "$PO_FILE"
70+
71+
# For the last msgid in the file
72+
if [[ -n "$msgid" || -n "$msgstr" ]]; then
73+
write_to_csv
74+
fi
75+
76+
echo "Created CSV $CSV_FILE and $UNTRANSLATED_FILE for $PO_FILE"
77+
done

csv-to-po.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
CSV_DIR="languages/translated_csv"
4+
PO_DIR="languages"
5+
MO_DIR="languages"
6+
7+
for csv_file in "$CSV_DIR"/*.csv; do
8+
[ -e "$csv_file" ] || continue
9+
10+
base_name=$(basename -- "$csv_file" .csv)
11+
po_file="$PO_DIR/$base_name.po"
12+
mo_file="$MO_DIR/$base_name.mo"
13+
14+
awk -F'"' '
15+
BEGIN { OFS=""; print "msgid \"\""; print "msgstr \"\""; print "\"Content-Type: text/plain; charset=UTF-8\\n\""; }
16+
NR > 1 {
17+
gsub(/\\/, "\\\\", $2);
18+
gsub(/\"/, "\\\"", $2);
19+
gsub(/\\/, "\\\\", $4);
20+
gsub(/\"/, "\\\"", $4);
21+
print "\n#: " $2;
22+
print "msgid \"" $4 "\"";
23+
print "msgstr \"" $6 "\"";
24+
}' "$csv_file" > "$po_file"
25+
26+
echo "Created PO file: $po_file"
27+
28+
msgfmt "$po_file" -o "$mo_file"
29+
echo "Created MO file: $mo_file"
30+
done

inc/settings/mollie_advanced_settings.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'{customer.company}' => _x('Customer\'s company name', 'Label {customer.company} description for payment description options', 'mollie-payments-for-woocommerce'),
1818
];
1919

20-
return [
20+
$mollieAdvancedSettings = [
2121
[
2222
'id' => $pluginName . '_title',
2323
'title' => __('Mollie advanced settings', 'mollie-payments-for-woocommerce'),
@@ -83,7 +83,7 @@
8383
/* translators: Placeholder 1: enabled or disabled */
8484
'desc' => sprintf(
8585
__(
86-
'Should Mollie store customers name and email address for Single Click Payments? Default <code>%1$s</code>. Required if WooCommerce Subscriptions is being used! Read more about <a href="https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-">%2$s</a> and how it improves your conversion.',
86+
'Should Mollie store customers name and email address for Single Click Payments? Default <code>%1$s</code>. Required if WooCommerce Subscriptions is being used! Read more about <a href=\'https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-\'>%2$s</a> and how it improves your conversion.',
8787
'mollie-payments-for-woocommerce'
8888
),
8989
strtolower(__('Enabled', 'mollie-payments-for-woocommerce')),
@@ -204,3 +204,5 @@ class="mollie-settings-advanced-payment-desc-label button button-secondary butto
204204
'type' => 'sectionend',
205205
],
206206
];
207+
208+
return apply_filters('inpsyde.mollie-advanced-settings', $mollieAdvancedSettings, $pluginName);

0 commit comments

Comments
 (0)