Skip to content

Commit 68a17d3

Browse files
authored
Merge pull request #27834 from brave/pr27831_bugfix/43759_1.77.x
fix(iOS): Upload one source strings file to Crowdin per release version (uplift to 1.77.x)
2 parents 0e7e05c + 55a9ba8 commit 68a17d3

File tree

2 files changed

+13
-40
lines changed

2 files changed

+13
-40
lines changed

ios/brave-ios/App/l10n/tools/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ Once your english strings are all up to date. These changes can be pushed to Cro
3030

3131
```
3232
cd l10n/
33-
TOKEN=<token> ./push-strings-to-crowdin.sh
33+
TOKEN=<token> VERSION=<release_version> ./push-strings-to-crowdin.sh
3434
```
3535

3636
If there any issues pushing strings to Crowdin then these issues are logged to ```output.log```
37+
The `VERSION` is in the format of `version_number`. For example: `1_75_0`.
3738

3839
### Importing the latest translations from Crowdin
3940

ios/brave-ios/App/l10n/tools/push-strings-to-crowdin.sh

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
55
# You can obtain one at https://mozilla.org/MPL/2.0/.
66

7-
# Push string changes to Transifex
7+
# Push string changes to Crowdin
88
#
99
# Error Codes:
1010
# 0 = Success
@@ -24,12 +24,6 @@ report_error()
2424

2525
cleanup()
2626
{
27-
if [ -e transifex.log ] ; then
28-
cat transifex.log >> output.log
29-
echo >> output.log
30-
rm transifex.log
31-
fi
32-
3327
if [ -e ../../Client/en.xcloc ]; then
3428
rm -R ../../Client/en.xcloc
3529
fi
@@ -43,6 +37,10 @@ if [ "${TOKEN}" = "" ] ; then
4337
report_error 1 "TOKEN environment variable must be set to \"api\""
4438
fi
4539

40+
if [ "${VERSION}" = "" ] ; then
41+
report_error 1 "VERSION environment variable must be set"
42+
fi
43+
4644
cd $(dirname "$0")
4745

4846
echo "Exporting strings from Xcode project..."
@@ -104,7 +102,7 @@ add_file()
104102
--data @- << EOF
105103
{
106104
"storageId": $crowdin_storage_id,
107-
"name": "en.xliff",
105+
"name": "${VERSION}.xliff",
108106
"type": "xliff"
109107
}
110108
EOF
@@ -131,39 +129,13 @@ else
131129
echo "Crowdin Storage ID: $crowdin_storage_id"
132130
fi
133131

134-
echo "Checking if there is already a file id for our project in Crowdin..."
135-
file_result=$(curl --silent \
136-
-X "GET" "https://brave-software.crowdin.com/api/v2/projects/$crowdin_project_id/files" \
137-
-H "Authorization: Bearer ${TOKEN}" \
138-
-H "Content-Type: application/json"
139-
)
140-
file_id=$(echo "$file_result" | jq '.data.[0].data.id')
141-
if [ "$file_id" == "null" ]
132+
echo "Adding a new source file..."
133+
add_file_http_code=$(add_file)
134+
if [ $add_file_http_code != 201 ]
142135
then
143-
echo "No, there is no file. Adding a new file..."
144-
add_file_http_code=$(add_file)
145-
if [ $add_file_http_code != 201 ]
146-
then
147-
report_error 5 "ERROR: Failed to add a file to the project in Crowdin"
148-
else
149-
echo "The new source file has been added to the project in Crowdin"
150-
fi
136+
report_error 5 "ERROR: Failed to add a file to the project in Crowdin"
151137
else
152-
echo "Yes, there is a file id: $file_id. Deleting this file ..."
153-
delete_file_http_code=$(delete_file $file_id)
154-
if [ $delete_file_http_code != 204 ]
155-
then
156-
report_error 5 "ERROR: Failed to delete the existed file in Crowdin"
157-
else
158-
echo "Now, adding a new file ..."
159-
add_file_http_code=$(add_file)
160-
if [ $add_file_http_code != 201 ]
161-
then
162-
report_error 5 "ERROR: Failed to add a file to the project in Crowdin"
163-
else
164-
echo "The new source file has added to the project in Crowdin"
165-
fi
166-
fi
138+
echo "The new source file has been added to the project in Crowdin"
167139
fi
168140

169141
cleanup

0 commit comments

Comments
 (0)