🧑💻 Script to make non-accented languages
This commit is contained in:
parent
c2572de9f4
commit
22f370a3fa
|
@ -29,7 +29,7 @@
|
|||
* See also https://marlinfw.org/docs/development/lcd_language.html
|
||||
*/
|
||||
|
||||
#define DISPLAY_CHARSET_ISO10646_1
|
||||
#define DISPLAY_CHARSET_ISO10646_1
|
||||
|
||||
namespace Language_pt {
|
||||
using namespace Language_en; // Inherit undefined strings from English
|
||||
|
|
|
@ -67,21 +67,21 @@ LANGS_DEFAULT="an bg ca cz da de el el_CY en es eu fi fr gl hr hu it jp_kana ko_
|
|||
#
|
||||
# Generate data for language list MARLIN_LANGS or all if not provided
|
||||
#
|
||||
for LANG in ${LANG_ARG:=$LANGS_DEFAULT} ; do
|
||||
echo "Generating Marlin language data for '${LANG}'" >&2
|
||||
case "$LANG" in
|
||||
for ALANG in ${LANG_ARG:=$LANGS_DEFAULT} ; do
|
||||
echo "Generating Marlin language data for '${ALANG}'" >&2
|
||||
case "$ALANG" in
|
||||
zh_* ) FONTFILE="wenquanyi_12pt" ;;
|
||||
ko_* ) FONTFILE="${DN_EXEC}/NanumGothic.bdf" ;;
|
||||
* ) FONTFILE="${DN_EXEC}/marlin-6x12-3.bdf" ;;
|
||||
esac
|
||||
DN_WORK=$(mktemp -d)
|
||||
cp Configuration.h ${DN_WORK}/
|
||||
cp src/lcd/language/language_${LANG}.h ${DN_WORK}/
|
||||
cp src/lcd/language/language_${ALANG}.h ${DN_WORK}/
|
||||
cd "${DN_WORK}"
|
||||
${DN_EXEC}/uxggenpages.sh "${FONTFILE}" $LANG
|
||||
${DN_EXEC}/uxggenpages.sh "${FONTFILE}" $ALANG
|
||||
sed -i fontutf8-data.h -e 's|fonts//|fonts/|g' -e 's|fonts//|fonts/|g' -e 's|[/0-9a-zA-Z_\-]*buildroot/share/fonts|buildroot/share/fonts|' 2>/dev/null
|
||||
cd - >/dev/null
|
||||
mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/fontdata/langdata_${LANG}.h
|
||||
mv ${DN_WORK}/fontutf8-data.h src/lcd/dogm/fontdata/langdata_${ALANG}.h
|
||||
rm -rf ${DN_WORK}
|
||||
done
|
||||
|
||||
|
|
39
buildroot/share/fonts/make_lang_na.sh
Executable file
39
buildroot/share/fonts/make_lang_na.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# make_lang_na.sh
|
||||
#
|
||||
# Create non-accented language files given a list of accented language files.
|
||||
#
|
||||
|
||||
which gsed >/dev/null || { echo "gsed is required for this script." ; exit 1 ; }
|
||||
which perl >/dev/null || { echo "perl is required for this script." ; exit 1 ; }
|
||||
|
||||
#
|
||||
# Get language arguments
|
||||
#
|
||||
[ $# ] || { echo "One or more language codes (such as 'fr') must be supplied." ; exit 1 ; }
|
||||
|
||||
LANG_ARG="$@"
|
||||
|
||||
#
|
||||
# Change to working directory 'Marlin'
|
||||
#
|
||||
OLDWD=`pwd`
|
||||
[[ $(basename "$OLDWD") != 'Marlin' && -d "Marlin" ]] && cd Marlin
|
||||
[[ -f "Configuration.h" ]] || { echo -n "cd to the 'Marlin' folder to run " ; basename $0 ; exit 1; }
|
||||
|
||||
#
|
||||
# Generate a non-accented language file
|
||||
#
|
||||
for ALANG in $LANG_ARG ; do
|
||||
echo "Generating a non-accented language for '${ALANG}'" >&2
|
||||
OUTFILE=src/lcd/language/language_${ALANG}_na.h
|
||||
cp src/lcd/language/language_${ALANG}.h $OUTFILE
|
||||
perl -pi -e 's/\s*#define DISPLAY_CHARSET_.+\n*//g' $OUTFILE
|
||||
perl -pi -e 's/\s*constexpr .+ CHARSIZE.+\n*//g' $OUTFILE
|
||||
perl -pi -e "s/namespace Language_${ALANG}/#define DISPLAY_CHARSET_ISO10646_1\n#define NOT_EXTENDED_ISO10646_1_5X7\n\nnamespace Language_${ALANG}_na/" $OUTFILE
|
||||
gsed -i 'y/āáǎàâäēéěèêīíǐìïîōóǒòöôūúǔùǖǘǚǜüûĀÁǍÀĒÉĚÈÊĪÍǏÌÎŌÓǑÒÔŪÚǓÙǕǗǙǛÜÛÇçÑñ/aaaaaaeeeeeiiiiiioooooouuuuuuuuuuAAAAEEEEEIIIIIOOOOOUUUUUUUUUUCcNn/' $OUTFILE
|
||||
perl -pi -e 's/ß/ss/g' $OUTFILE
|
||||
done
|
||||
|
||||
cd "$OLDWD"
|
Loading…
Reference in a new issue