Skip to content

Commit f4b76fc

Browse files
committed
Implemented script to find resources syntax bugs
1 parent e978c53 commit f4b76fc

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

commons/res/values-nb/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<item quantity="one">1 opplasting</item>
6161
<item quantity="other">%d opplastinger</item>
6262
</plurals>
63-
<string name="categories_not_found">Ingen kategorier som stemte overens med %1 funnet</string>
63+
<string name="categories_not_found">Ingen kategorier som stemte overens med %1$s funnet</string>
6464
<string name="categories_skip_explanation">Legg til kategorier for å gjøre bildene dine lettere å finne på Wikimedia Commons.
6565

6666
Begynn å skrive navnet på kategoriene.

commons/res/values-or/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<string name="uploading_started">ଅପଲୋଡ଼ ଆରମ୍ଭ ହେଲା!</string>
1515
<string name="upload_completed_notification_title">%1$s ଅପଲୋଡ଼ ହୋଇଗଲା!</string>
1616
<string name="upload_completed_notification_text">ନିଜର ଅପଲୋଡ଼ ଦେଖିବା ନିମନ୍ତେ ଟ୍ୟାପ କରନ୍ତୁ</string>
17-
<string name="upload_progress_notification_title_start">%1$ତମ ଅପଲୋଡ଼ ଆରମ୍ଭ କରୁଛି</string>
17+
<string name="upload_progress_notification_title_start">%1$sତମ ଅପଲୋଡ଼ ଆରମ୍ଭ କରୁଛି</string>
1818
<string name="upload_progress_notification_title_in_progress">%1$s ଅପଲୋଡ଼ ହୋଇଗଲା</string>
1919
<string name="upload_progress_notification_title_finishing">%1$s ଅପଲୋଡ଼ ସରୁଛି</string>
2020
<string name="upload_failed_notification_title">%1$s ଅପଲୋଡ଼ କରିବାରେ ବିଫଳ ହେଲୁ</string>

commons/res/values-pl/strings.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
<string name="login_failed">Logowanie nie powiodło się!</string>
1313
<string name="authentication_failed">Błąd uwierzytelniania!</string>
1414
<string name="uploading_started">Wysyłanie rozpoczęte</string>
15-
<string name="upload_completed_notification_title">Przesłano %1$!</string>
15+
<string name="upload_completed_notification_title">Przesłano %1$s!</string>
1616
<string name="upload_completed_notification_text">Kliknij aby zobaczyć swój wysłany plik</string>
17-
<string name="upload_progress_notification_title_start">Rozpoczęto wysyłanie pliku : %1$</string>
18-
<string name="upload_progress_notification_title_in_progress">Wysyłanie %1$</string>
19-
<string name="upload_progress_notification_title_finishing">Zakończono wysyłanie pliku %1$</string>
17+
<string name="upload_progress_notification_title_start">Rozpoczęto wysyłanie pliku : %1$s</string>
18+
<string name="upload_progress_notification_title_in_progress">Wysyłanie %1$s</string>
19+
<string name="upload_progress_notification_title_finishing">Zakończono wysyłanie pliku %1$s</string>
2020
<string name="upload_failed_notification_title">Wysyłanie %1$s zakończone porażką</string>
2121
<string name="upload_failed_notification_subtitle">Kliknij aby zobaczyć</string>
2222
<string name="title_activity_contributions">Moje wysłane pliki</string>

commons/res/values-uk/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<string name="login_failed">Не вдалося увійти!</string>
1313
<string name="authentication_failed">Помилка автентифікації!</string>
1414
<string name="uploading_started">Завантаження розпочато!</string>
15-
<string name="upload_completed_notification_title">Завантажено %1$!</string>
15+
<string name="upload_completed_notification_title">Завантажено %1$s!</string>
1616
<string name="upload_completed_notification_text">Торкніться, щоб переглянути Ваше завантаження</string>
1717
<string name="upload_progress_notification_title_start">Розпочинається завантаження %1$s</string>
1818
<string name="upload_progress_notification_title_in_progress">%1$s завантажується</string>

find-broken-strings-variables.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#! /bin/sh
2+
# Spot malformed string replacement patterns in Android localization files.
3+
# First install Lint from the Android SDK
4+
5+
grep -R "%1$ s" commons/res/values*
6+
grep -R "%1$ d" commons/res/values*
7+
grep -R "%1" commons/res/values* | grep -v "%1\\$"
8+
9+
grep -RH '%' commons/res/values* |
10+
sed -e 's/%/\n%/g' | # Split lines that contain several expressions
11+
grep '%' | # Filter out lines that do not contain expressions
12+
grep -v ' % ' | # Lone % character, not a variable
13+
grep -v '%<' | # Same, at the end of the string
14+
#grep -v '% ' | # Same, at the beginning of the string
15+
grep -v '%で' | # Same, no spaces in Japanese
16+
grep -v '%s' | # Single string variable
17+
grep -v '%d' | # Single decimal variable
18+
grep -v '%[0-9][0-9]\?$s' | # Multiple string variable
19+
grep -v '%[0-9][0-9]\?$d' | # Multiple decimal variable
20+
grep -v '%1$.1f' | # ?
21+
grep -v '%.1f' |
22+
grep -v '%\\n' |
23+
grep -v '%20' # Ignore URL whitespace
24+
exit
25+
# Double-width percent sign
26+
grep -R '' commons/res/values*
27+
28+
# Broken CDATA syntax
29+
grep -R "CDATA " commons/res/values*
30+
31+
# Android SDK Lint (does not detect most syntax errors)
32+
lint --check StringFormatInvalid commons

0 commit comments

Comments
 (0)