Skip to content

Commit

Permalink
Make <img> translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
ignotus666 committed Aug 16, 2024
1 parent b2a7a75 commit c666056
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
11 changes: 6 additions & 5 deletions _po4a-tools/po4a-create-all-targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,17 @@ process_with_po4a () {
THRESHOLD="$THRESH_VAL"
fi

# Determine file format to be used
# Determine file format to be used and set options (configured as an array to allow adding an arbitrary number of them)
OPTION=()
if [ $ext == yml ] ; then
FILE_FORMAT=yaml
OPTION="skip_array"
OPTION=("skip_array")
elif [[ $ext == html || "$filename" == *'-index' ]] ; then # '-index.md' has a markdown extension but is actually html and should be processed as such by po4a
FILE_FORMAT=xml
OPTION="ontagerror=warn"
OPTION=("ontagerror=silent" "translated=<img>" "attributes=<img>src <img>alt")
elif [ $ext == md ] ; then
FILE_FORMAT=text
OPTION="markdown"
OPTION=("markdown")
fi

# Run po4a-translate and create target files
Expand All @@ -120,7 +121,7 @@ process_with_po4a () {
--localized "$targ_doc" \
--localized-charset "UTF-8" \
--no-deprecation \
--option "$OPTION" \
"${OPTION[@]/#/--option=}" \
--keep "$THRESHOLD"

# Display message if translated file is created
Expand Down
12 changes: 7 additions & 5 deletions _po4a-tools/po4a-update-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ while IFS= read -r -d '' doc ; do
echo creating "$po_file"
fi

# Determine file format to be used
# Determine file format to be used and set options (configured as an array to allow adding an arbitrary number of them)
OPTION=()
if [ $ext == yml ] ; then
FILE_FORMAT=yaml
OPTION="skip_array"
OPTION=("skip_array")
elif [[ $ext == html || "$filename" == *'-index' ]] ; then # '-index.md' has a markdown extension but is actually html and should be processed as such by po4a
FILE_FORMAT=xml
OPTION="ontagerror=warn"
OPTION=("ontagerror=silent" "translated=<img>" "attributes=<img>src <img>alt")
elif [ $ext == md ] ; then
FILE_FORMAT=text
OPTION="markdown"
OPTION=("markdown")
fi

# Update/create .po files
Expand All @@ -80,7 +81,7 @@ while IFS= read -r -d '' doc ; do
--msgmerge-opt --no-wrap \
--wrap-po newlines \
--no-deprecation \
--option "$OPTION" \
"${OPTION[@]/#/--option=}" \
--po "$po_file" ; then
echo ''
echo Error updating "$lang" PO file for: "$filename".$ext
Expand All @@ -103,3 +104,4 @@ for lang in $(ls "$PO_DIR") ; do
# Delete line in file header that pollutes commits
sed -i '/^"POT-Creation-Date:/d' $PO_DIR/$lang/*.po
done

2 changes: 1 addition & 1 deletion wiki/en/misc/1-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Jamulus lets you play, rehearse, or jam with your friends, your band, or anyone
<div class="fx-col-100-xs">
<figure class="mainbannerfig">
<a href="wiki/Getting-Started" rel="canonical">
<img src="{% include img/en-screenshots/main-screen-medium.inc %}" style="border: 5px solid grey;" id="jamulusbanner" loading="lazy" alt="A screenshot of the main mixer window showing five people from different countries connected.">
<img src="{% include img/en-screenshots/main-screen-medium.inc %}" style="border: 5px solid grey;" id="jamulusbanner" loading="lazy" alt="A screenshot of the main mixer window showing several people from different countries connected.">
</a>
<figcaption>Jamulus is international</figcaption>
</figure>
Expand Down

0 comments on commit c666056

Please sign in to comment.