[Ack] [R118] Duplicate tags in localization file (a kind of bug?)


#1

Hey there! A different kind of bug report this time, or should it be in the Localization forum? :stuck_out_tongue:

So, I have done some more work with my translation helping program, and have found two errors in the en.json file. Not critical bugs, but a FYI since I can’t imagine this is wanted by anyone :wink:

There are two tags that are duplicated:
“loading” : “Loading…”, (row 9 and 34)
and
"title_screen_load_game": “Load Game”, (row 19 and 21)

Short story:
I was about to continue the translation work, normally I first open the previous and new english file and compare them. Anyway, I noticed row 34 to be marked as “no translation”. Strange, because I remembered that I had translated this one! So I opened the original files (r99 and r118), oh yes, they were identical on this row! So I started to check through my code to look for errors in my program (due to the “…” after “Loading” or so). Couldn’t find any though, so I started to break down the translation files. And then I noticed the error on row 19-21 instead, and I had my explanation :blush: Btw, this “error” has existed for quite a while, I didn’t see it at first since I thought they were new tags.

Now, when I look at the localization file, it has no groups or categories, but the file itself is grouped by an empty row between groups of tags. So this question is for Radiant (@sdee perhaps?), will you have the same tag name in several places or is this a “bug” in your en.json file? When my software reads the second tag, it would place the translation on the first occation of the tag (again). So if you will reuse tag names I’ll have to rewrite my program, because it is not designed for this at all :wink:

Btw, I noticed the inventory tags are now called backpack tags :smile:


#2

nicely spotted! I hope it has implications of individual unit inventories that can perhaps be adjusted (or at least viewed)? :smiley:


#3

Good eye! Yes, that’s a bug; there shouldn’t be 2 tags of the same name. :slight_smile:


#4

Ok, good to know :blush:

Btw, you still have formatting in the localization file :stuck_out_tongue:

Anyway, I threw in a piece of code for next release:

//True means duplicate found
if (searchForDuplicate(NewItem.tagName))
   writeLog("Duplicate tag found: " + NewItem.tagName);

So I will look for if the tag already exists before adding a potential second one (it will still be added, but get no translation, and the log will notify the user. Perhaps a pop-up in addition if errors are found. Everyone loves pop-ups.


#5

Btw, this is how it looks when a duplicate is found now :wink:

From the log:

...
Opened the translation file.
Duplicate tag found: title_screen_load_game
Duplicate tag found: loading
...

And this is how it looks when tags get new names:

These have no translation (but they had before):

The old ones are now found at the bottom as “tags that can’t be found any longer”.