lang: Better handle duplicate translation target matches

For example, LANG_TIME_SET_BUTTON has these:

    *: none
    aigoerosq,erosqnative,gogearsa9200,samsungyh*: "PLAY = Set"
    gigabeat*,iaudiom5,iaudiox5,ipod*,iriverh10,iriverh10_5gb,mrobe100,sansac200*,sansaclip*,sansaconnect,sansae200*,sansafuze*: "SELECT = Set"
    iriverh100,iriverh120,iriverh300: "NAVI = Set"
    mpiohd300: "ENTER = Set"
    mrobe500: "HEART = Set"
    rtc: "ON = Set"
    vibe500: "OK = Set"

But all of these players will match their name _and_ the generic 'rtc'
feature that enables use of this phrase.  The language tooling
always used the final match in the list, so this resulted in
most devices showing the generic (and incorrect) 'ON = Set" instead
of the device-specific strings.

This patch changes the behavior so that only a match with the device
model itself can override the previously used string.

Change-Id: I93ee11b1e4925c39edaecdcbc13ccc51ed176a45
This commit is contained in:
Solomon Peachy 2025-05-04 18:30:35 -04:00
parent c08bbaac49
commit f38109f8ed
4 changed files with 38 additions and 65 deletions

View file

@ -37,10 +37,9 @@ $(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
# 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!
$(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(ENGLISH).lang $(BUILDDIR)/apps/features $(TOOLSDIR)/genlang
$(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(ENGLISH).lang $(BUILDDIR)/apps/genlang-features $(TOOLSDIR)/genlang
$(call PRINTS,GEN lang.h)
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $<
$(SILENT)$(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` $<
$(BUILDDIR)/lang/lang_core.c: $(BUILDDIR)/lang/lang.h $(TOOLSDIR)/genlang
$(BUILDDIR)/lang_enum.h: $(BUILDDIR)/lang/lang.h $(TOOLSDIR)/genlang