fixup! scripts: fetch-lineage-translations: Support cm_plurals and lineage-sdk
Change-Id: I5dd91d31b7430eaeef2dda8293645ed156b1d2a1
diff --git a/lineage-merger/fetch-lineage-translations.sh b/lineage-merger/fetch-lineage-translations.sh
index d1acec6..2531710 100755
--- a/lineage-merger/fetch-lineage-translations.sh
+++ b/lineage-merger/fetch-lineage-translations.sh
@@ -85,17 +85,17 @@
git fetch https://github.com/LineageOS/android_$(echo $PROJECTPATH | sed 's|/|_|g') "${BRANCH}"
- for CM_STRINGS in $(find -iregex '.*/values/cm_(strings|plurals).xml'); do
+ for CM_STRINGS in $(find -iregex '.*/values/cm_\(strings\|plurals\).xml'); do
STRINGS_TO_FIND=$(grep -Po '<(string|plurals) name="\K[^"]*' "$CM_STRINGS")
PATTERN="$(dirname $CM_STRINGS | sed 's|^\./||g')-[^/]*/$(basename $CM_STRINGS)"
for TRANSLATION in $(git ls-tree -r --name-only FETCH_HEAD | grep -P "$PATTERN"); do
if [ "$(basename $CM_STRINGS)" = "cm_plurals.xml" ]; then
EXTRATRANSLATION="$(dirname $TRANSLATION)/plurals.xml"
else
- EXTRATRANSLATION="$(dirname $TRANSLATION/strings.xml"
+ EXTRATRANSLATION="$(dirname $TRANSLATION)/strings.xml"
fi
if [ ! -z "$EXTRAPATHREPLACE" ]; then
- EXTRATRANSLATION="$(echo $EXTRATRANSLATION | sed s|$EXTRAPATHREPLACE|g)"
+ EXTRATRANSLATION="$(echo $EXTRATRANSLATION | sed "s|$EXTRAPATHREPLACE|g")"
fi
mkdir -p $(dirname $TRANSLATION)
echo '<?xml version="1.0" encoding="utf-8"?>' > $TRANSLATION
@@ -107,7 +107,7 @@
FILENAME=$TRANSLATION
if [ "$REF" != "FETCH_HEAD" ]; then
FILENAME=$EXTRATRANSLATION
- if [ -z $(git ls-tree -r --name-only $REF $FILENAME) ]; then
+ if [ -z "$(git ls-tree -r --name-only $REF $FILENAME)" ]; then
continue;
fi
fi