1
0
Fork 0
forked from len0rd/rockbox

build: Tweaks to better support non-English as primary language

* get rid of $(LANGUAGE) in top-level makefile (and configure script)
 * un-hardcode English-as-primary-language in a couple more places
 * allow DEFAULT_VOICE_LANG to be overriden

To actually change the primary from English, one must change:

 * $english in voice.pl
 * hardcoded 'english' in rbutil
 * $ENGLISH in apps/lang/lang.make
 * DEFAULT_VOICE_LANG in apps/talk.c
 * configure script (default prompt)

Of course, if one wants to change the default UI language, it's simpler
to change the default language setting variable at compile time, or
perhaps by adding a configuration file with the desired value into the
.rockbox directory when the .zip is assembled.

Change-Id: If5cf76019d416e838628a2eccd4ec7d6cbaeeb74
This commit is contained in:
Solomon Peachy 2020-07-21 08:54:14 -04:00
parent 688c89cfe1
commit a5df94beb5
3 changed files with 6 additions and 7 deletions

View file

@ -11,6 +11,7 @@ LANGS := $(call preprocess, $(APPSDIR)/lang/SOURCES)
LANGOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.lng) LANGOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.lng)
VOICEOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.vstrings) VOICEOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.vstrings)
LANG_O = $(BUILDDIR)/lang/lang_core.o LANG_O = $(BUILDDIR)/lang/lang_core.o
ENGLISH := english
CLEANOBJS += $(BUILDDIR)/lang/max_language_size.h $(BUILDDIR)/lang/lang* CLEANOBJS += $(BUILDDIR)/lang/max_language_size.h $(BUILDDIR)/lang/lang*
@ -36,7 +37,7 @@ $(BUILDDIR)/lang/lang_core.o: $(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang/lang_core
# instead we pretend that genlang create lang_core.c and that lang.c depends from lang.h # instead we pretend that genlang create lang_core.c and that lang.c depends from lang.h
# it will work fine as long as one never manually removes lang.c and not lang.h, and it will avoid # it will work fine as long as one never manually removes lang.c and not lang.h, and it will avoid
# race conditions such as running genlang twice or worse in parallel with other things! # race conditions such as running genlang twice or worse in parallel with other things!
$(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(LANGUAGE).lang $(BUILDDIR)/apps/features $(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(ENGLISH).lang $(BUILDDIR)/apps/features
$(call PRINTS,GEN lang.h) $(call PRINTS,GEN lang.h)
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $< perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $<
@ -49,8 +50,8 @@ $(BUILDDIR)/lang_enum.h: $(BUILDDIR)/lang/lang.h
$(BUILDDIR)/%.lng $(BUILDDIR)/%.vstrings: $(ROOTDIR)/%.lang $(BUILDDIR)/apps/genlang-features $(BUILDDIR)/%.lng $(BUILDDIR)/%.vstrings: $(ROOTDIR)/%.lang $(BUILDDIR)/apps/genlang-features
$(call PRINTS,GENLANG $(subst $(ROOTDIR)/,,$<)) $(call PRINTS,GENLANG $(subst $(ROOTDIR)/,,$<))
$(SILENT)mkdir -p $(dir $@) $(SILENT)mkdir -p $(dir $@)
$(SILENT)$(TOOLSDIR)/genlang -u -e=$(APPSDIR)/lang/english.lang $< > $@.tmp $(SILENT)$(TOOLSDIR)/genlang -u -e=$(APPSDIR)/lang/$(ENGLISH).lang $< > $@.tmp
$(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/english.lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$*.lng -c=$*.vstrings $@.tmp $(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/$(ENGLISH).lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$*.lng -c=$*.vstrings $@.tmp
$(SILENT)rm -f $@.tmp $(SILENT)rm -f $@.tmp
$(BUILDDIR)/apps/lang/voicestrings.zip: $(VOICEOBJ) $(BUILDDIR)/apps/lang/voicestrings.zip: $(VOICEOBJ)

View file

@ -82,7 +82,9 @@ const char* const file_thumbnail_ext = ".talk";
#define LOADED_MASK 0x80000000 /* MSB */ #define LOADED_MASK 0x80000000 /* MSB */
#ifndef DEFAULT_VOICE_LANG
#define DEFAULT_VOICE_LANG "english" #define DEFAULT_VOICE_LANG "english"
#endif
/***************** Data types *****************/ /***************** Data types *****************/

4
tools/configure vendored
View file

@ -4669,9 +4669,6 @@ fi
echo "Using source code root directory: $rootdir" echo "Using source code root directory: $rootdir"
# this was once possible to change at build-time, but no more:
language="english"
uname=`uname` uname=`uname`
if [ "yes" = "$simulator" ]; then if [ "yes" = "$simulator" ]; then
@ -5039,7 +5036,6 @@ export MANUFACTURER=${t_manufacturer}
export OBJDIR=${pwd} export OBJDIR=${pwd}
export BUILDDIR=${pwd} export BUILDDIR=${pwd}
export RBCODEC_BLD=${pwd}/lib/rbcodec export RBCODEC_BLD=${pwd}/lib/rbcodec
export LANGUAGE=${language}
export VOICELANGUAGE=${voicelanguage} export VOICELANGUAGE=${voicelanguage}
export MEMORYSIZE=${memory} export MEMORYSIZE=${memory}
export BUILDDATE:=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d') export BUILDDATE:=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')