-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c39c01d
commit ff72303
Showing
3 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |