0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00
Anki-Android/tools/find-broken-strings-variables.sh
2014-06-25 14:45:06 +09:00

29 lines
1.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /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
grep -R "%1$ s" res/values*
grep -R "%1$ d" res/values*
grep -R "%1" res/values* | grep -v "%1\\$"
grep -RH '%' res/values* |
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
#grep -v '% ' | # Same, at the beginning of the string
grep -v '%で' | # Same, no spaces in Japanese
grep -v '%s' | # Single string variable
grep -v '%d' | # Single decimal variable
grep -v '%[0-9][0-9]\?$s' | # Multiple string variable
grep -v '%[0-9][0-9]\?$d' | # Multiple decimal variable
grep -v '%1$.1f' | # ?
grep -v '%.1f' |
grep -v '%\\n'
grep -R '' res/values*
grep -R "CDATA " res/values*
lint --check StringFormatInvalid ./res