2011-01-28 07:08:17 +01:00
|
|
|
|
#! /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*
|
2014-03-26 23:25:20 +01:00
|
|
|
|
grep -R "%1" res/values* | grep -v "%1\\$"
|
2011-05-19 10:45:17 +02:00
|
|
|
|
|
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
|
2011-05-19 10:45:17 +02:00
|
|
|
|
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
|
|
|
|
|
2014-06-25 07:45:06 +02:00
|
|
|
|
grep -R "CDATA " res/values*
|
|
|
|
|
|
2014-01-02 06:52:54 +01:00
|
|
|
|
lint --check StringFormatInvalid ./res
|