Skip to content

Instantly share code, notes, and snippets.

@CocoaBeans
Created September 27, 2013 20:46
Show Gist options
  • Save CocoaBeans/6734908 to your computer and use it in GitHub Desktop.
Save CocoaBeans/6734908 to your computer and use it in GitHub Desktop.
StringsLintCheck
#!/bin/bash
# for LocalizableStringsIn in $(find "${PROJECT_DIR}"/Languages -name "Localizable.strings.in" -print)
# do
# LocalizableStrings="${LocalizableStringsIn/Localizable.strings.in/Localizable.strings}"
# iconv -f UTF-8 -t UTF-16BE < "${LocalizableStringsIn}" > "${LocalizableStrings}"
# done
# NEEDLE='\( -path "*.lproj/*.strings" \! \( -path "*/build/*" \) \)'
HAYSTACK="${PROJECT_DIR}"
FILES=`find "${HAYSTACK}" \( -path "*.lproj/*.strings" \! \( -path "*/build/*" \) \) -print`
# FILES=`find . \( -path "*.lproj/*.strings" \! \( -path "./build*" \) \) -print0`
# FILES=`find . \( -path "*.lproj/*.strings" \! \( -path "./build*" \) \) -print | xargs -E \r`
#FILES=`find . \( -path "*.lproj/*.strings" \! \( -path "./build*" \) \) -print0 | xargs -0 plutil -lint`
# FILES=`find . \( -path "*.lproj/*.strings" \! \( -path "./build*" \) \) -print`
# echo "==============================================="
# echo "$FILES"
# echo "==============================================="
OLD_IFS="$IFS"
IFS="
"
XARGS=($FILES)
for STRING_FILE in "${XARGS[@]}"
do
# echo "==============================================="
# echo "lint checking: $STRING_FILE"
# printf "printf: %b\n" "$STRING_FILE"
plutil -lint -s "$STRING_FILE"
# echo "==============================================="
if [ $? -ne 0 ]
then
echo "Lint check found an error!"
echo "File path: ${STRING_FILE}"
exit 1
fi
done
echo "Lint check passed"
IFS="$OLD_IFS"
# find . ( ( -path "*.lproj/*.strings" ) -not ( -path "./build*" ) ) -print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment