Skip to content

Commit 9a9793c

Browse files
authored
Merge pull request #4807 from owncloud/feature/add_action_check_source_strings
[FEATURE REQUEST] Add action to check source strings
2 parents 12ba9e8 + 09a88f4 commit 9a9793c

7 files changed

Lines changed: 84 additions & 10 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Validate Android source strings
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
validate-strings:
11+
name: Validate strings
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v5
17+
18+
- name: Install xmlstarlet
19+
run: sudo apt-get update && sudo apt-get install -y xmlstarlet
20+
21+
- name: Validate source strings
22+
shell: bash
23+
run: |
24+
xml_file="owncloudApp/src/main/res/values/strings.xml"
25+
has_errors=0
26+
27+
# ANSI-C quoting to read characters correctly
28+
forbidden_values=($'\'' $'"' $'@' $'\n' $'\t')
29+
escaped_values=($'\\\'' $'\\"' $'\\@' $'\\n' $'\\t')
30+
31+
# Read one line every iteration
32+
while IFS= read -r line; do
33+
34+
# Takes everything on the left of ^^
35+
string_name="${line%%^^*}"
36+
# Takes everything on the right of ^^
37+
string_value="${line#*^^}"
38+
39+
# Check if the string contains any of the escaped_values and remove it
40+
for escaped in "${escaped_values[@]}"; do
41+
string_value="${string_value//"$escaped"/}"
42+
done
43+
44+
# Check if the string contains any of the forbidden_values
45+
for forbidden in "${forbidden_values[@]}"; do
46+
if [[ "$string_value" == *"$forbidden"* ]]; then
47+
echo "Source string \"$string_name\" contains forbidden characters"
48+
has_errors=1
49+
break
50+
fi
51+
done
52+
# Read the input file line by line
53+
done < <(
54+
xmlstarlet sel \
55+
-t \
56+
-m '/resources/string' \
57+
-v '@name' \
58+
-o '^^' \
59+
-v '.' \
60+
-n \
61+
"$xml_file"
62+
)
63+
64+
exit $has_errors

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ ownCloud admins and users.
5959
* Enhancement - Copy permanent link of a space: [#4758](https://github.com/owncloud/android/issues/4758)
6060
* Enhancement - Workflow to check Conventional Commits: [#4759](https://github.com/owncloud/android/pull/4759)
6161
* Enhancement - QA Content Provider: [#4776](https://github.com/owncloud/android/pull/4776)
62+
* Enhancement - Workflow to validate source strings: [#4807](https://github.com/owncloud/android/pull/4807)
6263

6364
## Details
6465

@@ -221,6 +222,13 @@ ownCloud admins and users.
221222

222223
https://github.com/owncloud/android/pull/4776
223224

225+
* Enhancement - Workflow to validate source strings: [#4807](https://github.com/owncloud/android/pull/4807)
226+
227+
A new workflow has been added to validate the source strings and prevent errors
228+
in translation CI system from the first step
229+
230+
https://github.com/owncloud/android/pull/4807
231+
224232
# Changelog for ownCloud Android Client [4.7.0] (2025-11-17)
225233

226234
The following sections list the changes in ownCloud Android Client 4.7.0 relevant to

changelog/unreleased/4807

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Enhancement: Workflow to validate source strings
2+
3+
A new workflow has been added to validate the source strings and prevent errors in translation CI system from the first step
4+
5+
https://github.com/owncloud/android/pull/4807

owncloudApp/src/main/res/values-de-rDE/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@
856856
<string name="create_space_dialog_gb_unit">GB</string>
857857
<string name="create_space_dialog_empty_error">Der Space Name darf nicht leer sein</string>
858858
<string name="create_space_dialog_length_error">Der Space Name darf nicht länger als 255 Zeichen lang sein</string>
859-
<string name="create_space_dialog_characters_error">Unzulässige Zeichen: / \\ . : \? * &amp;quot; \' &gt; &lt; |</string>
859+
<string name="create_space_dialog_characters_error">Unzulässige Zeichen: / \\ . : \? * \" \' &gt; &lt; |</string>
860860
<string name="create_space_dialog_quota_empty_error">Das Space Kontingent darf nicht leer sein</string>
861861
<string name="create_space_dialog_quota_zero_error">Das Space Kontingent muss größer als null sein</string>
862862
<string name="create_space_dialog_quota_too_large_error">Das Space Kontingent darf nicht größer als 1 PB sein</string>

owncloudApp/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@
859859
<string name="create_space_dialog_gb_unit">GB</string>
860860
<string name="create_space_dialog_empty_error">Der Space Name darf nicht leer sein</string>
861861
<string name="create_space_dialog_length_error">Der Space Name darf nicht länger als 255 Zeichen lang sein</string>
862-
<string name="create_space_dialog_characters_error">Unzulässige Zeichen: / \\ . : \? * &quot; \' &gt; &lt; |</string>
862+
<string name="create_space_dialog_characters_error">Unzulässige Zeichen: / \\ . : \? * \" \' &gt; &lt; |</string>
863863
<string name="create_space_dialog_quota_empty_error">Das Space Kontingent darf nicht leer sein</string>
864864
<string name="create_space_dialog_quota_zero_error">Das Space Kontingent muss größer als null sein</string>
865865
<string name="create_space_dialog_quota_too_large_error">Das Space Kontingent darf nicht größer als 1 PB sein</string>

owncloudApp/src/main/res/values-es/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@
857857
<string name="create_space_dialog_gb_unit">GB</string>
858858
<string name="create_space_dialog_empty_error">El nombre del space no puede estar vacío</string>
859859
<string name="create_space_dialog_length_error">El nombre del space no puede exceder 255 caracteres</string>
860-
<string name="create_space_dialog_characters_error">Caracteres prohibidos: / \\ . : \? * &amp;quot; \' &gt; &lt; |</string>
860+
<string name="create_space_dialog_characters_error">Caracteres prohibidos: / \\ . : \? * \" \' &gt; &lt; |</string>
861861
<string name="create_space_dialog_quota_empty_error">La cuota del space no puede estar vacía</string>
862862
<string name="create_space_dialog_quota_zero_error">La cuota del space tiene que ser mayor que cero</string>
863863
<string name="create_space_dialog_quota_too_large_error">La cuota del space no puede exceder 1PB</string>

owncloudApp/src/main/res/values/strings.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@
372372
<string name="auth_expired_basic_auth_toast">Please enter the current password</string>
373373
<string name="auth_connecting_auth_server">Connecting to authentication server …</string>
374374
<string name="auth_unsupported_auth_method">The server does not support this authentication method</string>
375-
<string name="auth_fail_get_user_name">Your server is not returning a correct user ID. Please contact an administrator.
376-
</string>
375+
<string name="auth_fail_get_user_name">Your server is not returning a correct user ID. Please contact an administrator.</string>
377376
<string name="auth_can_not_auth_against_server">Cannot authenticate to this server</string>
378377
<string name="auth_account_does_not_exist">Account does not exist in the device yet</string>
379378

@@ -481,8 +480,7 @@
481480
<string name="get_shares_error">It was not possible to retrieve the shares from the server</string>
482481
<string name="get_sharees_error">It was not possible to retrieve users and groups from the server</string>
483482
<string name="get_capabilities_error">It was not possible to retrieve the capabilities from the server</string>
484-
<string name="share_link_no_support_share_api">Sorry, sharing is not enabled on your server. Please contact your
485-
administrator.</string>
483+
<string name="share_link_no_support_share_api">Sorry, sharing is not enabled on your server. Please contact your administrator.</string>
486484
<string name="share_link_file_error">It was not possible to share this file or folder</string>
487485
<string name="unshare_link_file_error">It was not possible to unshare this file or folder</string>
488486
<string name="update_link_file_error">It was not possible to update this file or folder</string>
@@ -622,8 +620,7 @@
622620
<string name="share_remote_clarification">%1$s (remote)</string>
623621
<string name="share_known_remote_clarification">%1$s ( at %2$s )</string>
624622

625-
<string name="share_sharee_unavailable">Sorry, your server version does not allow sharing with users within clients.
626-
\nPlease contact your administrator</string>
623+
<string name="share_sharee_unavailable">Sorry, your server version does not allow sharing with users within clients.\nPlease contact your administrator</string>
627624
<string name="share_privilege_can_share">can share</string>
628625
<string name="share_privilege_can_edit">can edit</string>
629626
<string name="share_privilege_can_edit_create">create</string>
@@ -859,7 +856,7 @@
859856
<string name="create_space_dialog_gb_unit">GB</string>
860857
<string name="create_space_dialog_empty_error">Space name must not be empty</string>
861858
<string name="create_space_dialog_length_error">Space name must not be longer than 255 characters</string>
862-
<string name="create_space_dialog_characters_error">Forbidden characters: / \\ . : \? * &quot; \' &gt; &lt; |</string>
859+
<string name="create_space_dialog_characters_error">Forbidden characters: / \\ . : \? * \" \' &gt; &lt; |</string>
863860
<string name="create_space_dialog_quota_empty_error">Space quota must not be empty</string>
864861
<string name="create_space_dialog_quota_zero_error">Space quota must be greater than zero</string>
865862
<string name="create_space_dialog_quota_too_large_error">Space quota cannot exceed 1 PB</string>

0 commit comments

Comments
 (0)