Load translations from file, but disable color output

This commit is contained in:
southerntofu 2020-12-01 17:36:12 +01:00
parent 0caa9c0eba
commit 711a04d378

View File

@ -22,6 +22,10 @@ fi
# - we load the requested language if it exists, fail otherwise # - we load the requested language if it exists, fail otherwise
# - when no language is requested, default to something (TODO) # - when no language is requested, default to something (TODO)
if [[ "$LANG" != "NONE" ]]; then if [[ "$LANG" != "NONE" ]]; then
# If LANG is a file, load it directly
if [ -f "$LANG" ]; then
locale_strings="$(cat $LANG)"
else
# Enable colors (escape codes) as echo option # Enable colors (escape codes) as echo option
COLORS=1 COLORS=1
@ -40,7 +44,7 @@ if [[ "$LANG" != "NONE" ]]; then
# Initialize translations # Initialize translations
[ -f $I18N_DIR/$locale.json ] && locale_strings="$(cat $I18N_DIR/$locale.json)" || locale_strings="$(cat $I18N_DIR/en.json)" [ -f $I18N_DIR/$locale.json ] && locale_strings="$(cat $I18N_DIR/$locale.json)" || locale_strings="$(cat $I18N_DIR/en.json)"
fi
fi # End translations initialization fi # End translations initialization
# Takes one argument, looks up translation # Takes one argument, looks up translation
@ -305,7 +309,7 @@ done
# Error when the requested basedir (or the default ~/.forgebuild) does not exist # Error when the requested basedir (or the default ~/.forgebuild) does not exist
if [ ! -d $BASEDIR ]; then if [ ! -d $BASEDIR ]; then
i18n_basedir="$BASEDIR" export i18n_basedir="$BASEDIR"
error "missing_basedir" error "missing_basedir"
exit 1 exit 1
fi fi