FS#7574 - Genlang produces lng files with ID number gaps in some cases

Attached to Project: Rockbox
Opened by Nils Wallménius (nls) - Friday, 10 August 2007, 13:41 GMT
Last edited by Daniel Stenberg (bagder) - Friday, 10 August 2007, 22:10 GMT
Task Type Bugs
Category Language
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


If I run the following genlang command on the attached testlang.lang file it produces a .lng file with an ID gap. Yes gets ID 0, No gets 1 but Off gets ID 3 and there's no string with ID 2.

./genlang -b=testlang.lng -e=testlang.lang -t=player -i=1 testlang.lang
This task depends upon

Closed by  Daniel Stenberg (bagder)
Friday, 10 August 2007, 22:10 GMT
Reason for closing:  Fixed
Additional comments about closing:  Committed a fix right now: r14274
Comment by Jens Arnold (amiconn) - Friday, 10 August 2007, 20:42 GMT
From examining an english.lng file for archos player I can confirm that there ID gaps. They are inserted for every string that is not to be included for a target. For the built-in language it just works by coincidence - none of ID numbers are literally included in the .c or .h file, they just form an enum.

In order to correct this, the way IDs are generated by counting english.lang entries must take into account whether we're building for a specific target or upgrading a .lang file.
When invoked with -p and -b, it must not count entries which evaluate to 'none' for that target, with -u it has to count all entries.