News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[r10350] r10350 broke loading some translation files

Started by Ranran, October 08, 2022, 10:49:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ranran

Before r10350, it was possible to read ja.*.tab and translate object names into Japanese.
But since r10350 it is no longer possible. (I incorporated this into extended and infected extended as well.)
On the other hand, r10350 made *ja.tab translations readable.
However, backward compatibility with the old ja.*.tab format is lost, which renders previously uploaded translation files useless. There are a lot of stuff whose author has disappeared on the websites. That's a huge loss and not a good thing.


// try instead the start of the stringLooking at the code, it seems that this is not the intended behavior as you can see in the comments.


https://github.com/aburch/simutrans/blob/54edc8037e323cd088b5163929c41a0e1399fa0a/src/simutrans/dataobj/translator.cc#L432
lang = get_lang_by_iso("ja");For example, if you rewrite the above line of code like this, ja.*.tab will be read as before, and you can see that the old translation file can be read. So I believe this is a bug.

I tried to improve this by referencing the old code, but I was unsuccessful. So I post this as a bug report.

Ranran

#1
I did a quick research on this.
The filename is something like pak.nippon/text/ja.butagoya.tab, and I don't think the first two strings of the filename will be an iso code (like "ja").
This is why line 432 doesn't work properly.

Also, from r10350, sometimes unintended files are read as translation files in different languages.
For example, ja.denen.tab is recognized as one of en.tab. I'm not sure if this causes translation anomalies. But at least it is recognized as en.tab and processing ends there, so I don't think it will move to processing to recognize it as a Japanese translation file.

Ranran

#2
I pooped out a countermeasure against this.
https://github.com/Ranran-the-JuicyPork/simutrans-extended/commit/79a8e42739de6d7f5e2fede288ecf2e609ab6744

First check if it matches [/??.*]. I think this will be more reliable than it used to be.
But I'm not sure if the translation file name doesn't contain "/". In other words, does it take into consideration the case where it is in the same folder as the executable file?
Any code reviews or opinions on this would be appreciated.

I hope that many of Japanese obsolete heritage can be saved.

prissi

Added some more fixes, hopefully working now as intended.

Ranran

Quote from: prissi on October 18, 2022, 07:25:46 AMAdded some more fixes, hopefully working now as intended.
Thank you for your correction  :)