Beta test the new forum at
Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

[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.


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 * 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.
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.


I did a quick research on this.
The filename is something like pak.nippon/text/, 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, is recognized as one of I'm not sure if this causes translation anomalies. But at least it is recognized as and processing ends there, so I don't think it will move to processing to recognize it as a Japanese translation file.


I pooped out a countermeasure against this.

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.


Added some more fixes, hopefully working now as intended.


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