0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00
Anki-Android/tools/find-broken-strings-variables.sh

27 lines
1.0 KiB
Bash
Raw Normal View History

#! /bin/sh
# Spot malformed string replacement patterns in Android localization files.
# Hopefully it will prevent this kind of bugs: https://code.google.com/p/ankidroid/issues/detail?id=359
2014-03-20 09:25:16 +01:00
grep -R "%1$ s" res/values*
grep -R "%1$ d" res/values*
grep -R "%1" res/values* | grep -v "%1\\$"
2014-03-20 09:25:16 +01:00
grep -RH '%' res/values* |
2011-01-28 08:00:59 +01:00
sed -e 's/%/\n%/g' | # Split lines that contain several expressions
grep '%' | # Filter out lines that do not contain expressions
grep -v ' % ' | # Lone % character, not a variable
grep -v '%<' | # Same, at the end of the string
2013-12-26 13:14:33 +01:00
#grep -v '% ' | # Same, at the beginning of the string
2011-07-30 17:43:51 +02:00
grep -v '%で' | # Same, no spaces in Japanese
2011-01-28 08:00:59 +01:00
grep -v '%s' | # Single string variable
grep -v '%d' | # Single decimal variable
grep -v '%[0-9][0-9]\?$s' | # Multiple string variable
2012-02-28 15:53:13 +01:00
grep -v '%[0-9][0-9]\?$d' | # Multiple decimal variable
grep -v '%1$.1f' | # ?
2014-02-24 13:46:19 +01:00
grep -v '%.1f' |
grep -v '%\\n'
2011-08-02 15:49:05 +02:00
2014-03-20 09:25:16 +01:00
grep -R '' res/values*
2014-01-02 06:52:54 +01:00
lint --check StringFormatInvalid ./res