crueter
1 month ago
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
6 changed files with
56 additions and
13 deletions
-
.github/workflows/strings.yml
-
.github/workflows/translations.yml
-
tools/find-unused-strings.sh
-
tools/generate-legacy-icons.sh
-
tools/optimize-assets.sh
-
tools/stale-translations.sh
|
|
|
@ -0,0 +1,22 @@ |
|
|
|
name: Check Strings |
|
|
|
|
|
|
|
on: |
|
|
|
push: |
|
|
|
branches: [ master ] |
|
|
|
|
|
|
|
jobs: |
|
|
|
check-strings: |
|
|
|
runs-on: source |
|
|
|
steps: |
|
|
|
- uses: actions/checkout@v4 |
|
|
|
with: |
|
|
|
fetch-depth: 0 |
|
|
|
|
|
|
|
- name: Find Unused Strings |
|
|
|
run: ./tools/find-unused-strings.sh |
|
|
|
|
|
|
|
- name: Find Stale Translations |
|
|
|
run: ./tools/stale-translations.sh |
|
|
|
|
|
|
|
- name: Diff |
|
|
|
run: git --no-pager diff --exit-code HEAD |
|
|
|
@ -5,6 +5,7 @@ on: |
|
|
|
schedule: |
|
|
|
cron: |
|
|
|
- '0 14 * * 1,3,6' |
|
|
|
workflow_dispatch: |
|
|
|
|
|
|
|
jobs: |
|
|
|
tx-update: |
|
|
|
|
|
|
|
@ -1,7 +1,23 @@ |
|
|
|
#!/bin/sh -e |
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project |
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later |
|
|
|
|
|
|
|
cat src/android/app/src/main/res/values/strings.xml \ |
|
|
|
| grep 'string name="' | awk -F'"' '$0=$2' \ |
|
|
|
| xargs -I {} sh -c 'grep -qirnw R.string.'{}' src/android/app/src || echo '{} |
|
|
|
ANDROID=src/android/app/src/main |
|
|
|
STRINGS=$ANDROID/res/values/strings.xml |
|
|
|
|
|
|
|
SRC=$(mktemp) |
|
|
|
|
|
|
|
# We start out by getting the list of source strings... |
|
|
|
grep -e "string name" $STRINGS | cut -d'"' -f2 > "$SRC" |
|
|
|
|
|
|
|
# ... then search for each string as R.string. or @string/ |
|
|
|
while IFS= read -r str; do |
|
|
|
grep -qre "R.string.$str\|@string/$str" "$ANDROID" && continue |
|
|
|
|
|
|
|
echo "-- Removing unused string $str" |
|
|
|
sed "/string name=\"$str\"/d" "$STRINGS" > "$STRINGS.new" |
|
|
|
mv "$STRINGS.new" "$STRINGS" |
|
|
|
done < "$SRC" |
|
|
|
|
|
|
|
rm -rf "$TMP_DIR" |
|
|
|
@ -10,11 +10,11 @@ ROOTDIR=$PWD |
|
|
|
|
|
|
|
cd src/android/app/src/main |
|
|
|
|
|
|
|
pushd res/drawable |
|
|
|
cd res/drawable |
|
|
|
# convert vector to svg--needed to generate launcher png |
|
|
|
cp ic_yuzu_icon.xml tmp |
|
|
|
|
|
|
|
python3 $ROOTDIR/tools/VectorDrawable2Svg.py tmp |
|
|
|
python3 "$ROOTDIR"/tools/VectorDrawable2Svg.py tmp |
|
|
|
|
|
|
|
inkscape -w 768 -h 768 tmp.svg -o ic_tmp.png |
|
|
|
magick ic_icon_bg_orig.png -resize 512x512 bg_tmp.png |
|
|
|
@ -23,7 +23,8 @@ magick bg_tmp.png -strip -type TrueColor -depth 8 -colorspace sRGB -color-matrix |
|
|
|
magick -verbose bg_tmp_rgb.png ic_tmp.png -gravity center -composite -colorspace sRGB ic_launcher.png |
|
|
|
echo |
|
|
|
|
|
|
|
rm *tmp* |
|
|
|
popd |
|
|
|
rm ./*tmp* |
|
|
|
|
|
|
|
# Add legacy here when legacy gets merged |
|
|
|
cd "$ROOTDIR" |
|
|
|
|
|
|
|
# TODO: add legacy icons |
|
|
|
@ -1,7 +1,10 @@ |
|
|
|
#!/bin/sh -e |
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project |
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later |
|
|
|
|
|
|
|
which optipng || exit |
|
|
|
NPROC=$(nproc) |
|
|
|
[ -z "$NPROC" ] && NPROC=8 |
|
|
|
find . -type f -iname '*.png' | xargs -P $NPROC -I {} optipng -o7 {} |
|
|
|
NPROC=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4) |
|
|
|
|
|
|
|
# shellcheck disable=SC2038 |
|
|
|
find . -type f -iname '*.png' | xargs -P "$NPROC" -I {} optipng -o7 {} |
|
|
|
@ -29,6 +29,6 @@ while IFS= read -r locale; do |
|
|
|
{ grep -e "string name=\"$unused\"" "$STRINGS" >/dev/null; } || \ |
|
|
|
{ echo "-- Removing unused translation $unused" && sed "/string name=\"$unused\"/d" "$locale" > "$locale.new" && mv "$locale.new" "$locale"; } |
|
|
|
done < "$COMBINED" |
|
|
|
done < "$LOCALES" |
|
|
|
|
|
|
|
echo "-- done" |
|
|
|
done < "$LOCALES" |
|
|
|
rm -rf "$TMP_DIR" |