2023-05-27 11:08:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# OrcaSlicer gettext
|
|
|
|
# Created by SoftFever on 27/5/23.
|
|
|
|
#
|
2023-09-05 14:36:29 +00:00
|
|
|
|
|
|
|
# Check for --full argument
|
|
|
|
FULL_MODE=false
|
|
|
|
for arg in "$@"
|
|
|
|
do
|
2024-03-05 14:35:46 +00:00
|
|
|
if [ "$arg" = "--full" ]; then
|
2023-09-05 14:36:29 +00:00
|
|
|
FULL_MODE=true
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if $FULL_MODE; then
|
|
|
|
xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f ./localization/i18n/list.txt -o ./localization/i18n/OrcaSlicer.pot
|
2024-07-29 12:38:10 +00:00
|
|
|
python3 scripts/HintsToPot.py ./resources ./localization/i18n
|
2023-09-05 14:36:29 +00:00
|
|
|
fi
|
2023-05-27 11:08:42 +00:00
|
|
|
|
|
|
|
|
2024-03-05 14:35:46 +00:00
|
|
|
echo "$0: working dir = $PWD"
|
2023-08-09 05:06:58 +00:00
|
|
|
pot_file="./localization/i18n/OrcaSlicer.pot"
|
|
|
|
for dir in ./localization/i18n/*/
|
2023-05-27 11:08:42 +00:00
|
|
|
do
|
|
|
|
dir=${dir%*/} # remove the trailing "/"
|
|
|
|
lang=${dir##*/} # extract the language identifier
|
|
|
|
|
|
|
|
if [ -f "$dir/OrcaSlicer_${lang}.po" ]; then
|
2023-09-05 14:36:29 +00:00
|
|
|
if $FULL_MODE; then
|
2024-03-05 14:35:46 +00:00
|
|
|
msgmerge -N -o "$dir/OrcaSlicer_${lang}.po" "$dir/OrcaSlicer_${lang}.po" "$pot_file"
|
|
|
|
fi
|
|
|
|
mkdir -p "resources/i18n/${lang}"
|
|
|
|
msgfmt --check-format -o "resources/i18n/${lang}/OrcaSlicer.mo" "$dir/OrcaSlicer_${lang}.po"
|
2023-10-26 05:08:53 +00:00
|
|
|
# Check the exit status of the msgfmt command
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error encountered with msgfmt command for language ${lang}."
|
|
|
|
exit 1 # Exit the script with an error status
|
|
|
|
fi
|
2023-05-27 11:08:42 +00:00
|
|
|
fi
|
|
|
|
done
|