Skip to content

Commit

Permalink
support ja edition (#144)
Browse files Browse the repository at this point in the history
* wip

* fix release

* delete claude comments
  • Loading branch information
StefanVukovic99 authored Oct 3, 2024
1 parent b861ecd commit 16619bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
languages: ${{ steps.load-languages.outputs.languages }}
edition_languages: ${{ steps.load-languages.outputs.edition_languages }}
isos: ${{ steps.load-languages.outputs.isos }}
calver: ${{ steps.tag.outputs.calver }}
steps:
Expand Down Expand Up @@ -46,8 +46,8 @@ jobs:
- name: Load Languages
id: load-languages
run: |
languages=$(jq '[.[] | select(.hasEdition == true) | .language]' languages.json | jq -c 'map(.)')
echo "languages=$languages" >> $GITHUB_OUTPUT
edition_languages=$(jq '[.[] | select(.hasEdition == true) | .language]' languages.json | jq -c 'map(.)')
echo "edition_languages=$edition_languages" >> $GITHUB_OUTPUT
isos=$(jq -r '.[].iso' languages.json | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "isos=$isos" >> $GITHUB_OUTPUT
Expand All @@ -69,7 +69,7 @@ jobs:
strategy:
max-parallel: 1
matrix:
edition_language: ${{fromJson(needs.prepare.outputs.languages)}}
edition_language: ${{fromJson(needs.prepare.outputs.edition_languages)}}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -134,15 +134,15 @@ jobs:
- name: Download IPA dicts
run: |
mapfile -t iso_array < <(printf '%s' '${{needs.prepare.outputs.isos}}' | jq -r '.[]')
supported_editions="de en es fr ru zh"
edition_languages=$(printf '%s' '${{needs.prepare.outputs.edition_languages}}' | jq -r 'join(" ")')
for source_iso in "${iso_array[@]}"; do
for target_iso in "${iso_array[@]}"; do
filename="kty-${source_iso}-${target_iso}-ipa.zip"
if [ -f "$filename" ]; then
continue
fi
if [[ ! "$supported_editions" == *"$target_iso"* ]]; then
if [[ ! "$edition_languages" == *"$target_iso"* ]]; then
continue
fi
url="https://github.com/themoeway/kaikki-to-yomitan/releases/download/${{needs.prepare.outputs.tag}}/kty-${source_iso}-${target_iso}-ipa.zip"
Expand Down
11 changes: 10 additions & 1 deletion auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,16 @@ declare -a languages="($(
jq -r '.[] | @json | @sh' languages.json
))"

supported_editions="de en es fr ru zh"
supported_editions_array=()

for lang in "${languages[@]}"; do
has_edition=$(echo "$lang" | jq -r 'if .hasEdition == true then .iso else empty end')
if [ ! -z "$has_edition" ]; then
supported_editions_array+=("$has_edition")
fi
done

supported_editions="${supported_editions_array[*]}"

#Iterate over every edition language
for edition_lang in "${languages[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{"iso": "hu", "language": "Hungarian", "flag": "🇭🇺" },
{"iso": "id", "language": "Indonesian", "flag": "🇮🇩" },
{"iso": "it", "language": "Italian", "flag": "🇮🇹" },
{"iso": "ja", "language": "Japanese", "flag": "🇯🇵" },
{"iso": "ja", "language": "Japanese", "flag": "🇯🇵", "hasEdition": true },
{"iso": "kn", "language": "Kannada", "flag": "🇮🇳" },
{"iso": "km", "language": "Khmer", "flag": "🇰🇭" },
{"iso": "ko", "language": "Korean", "flag": "🇰🇷" },
Expand Down

0 comments on commit 16619bc

Please sign in to comment.