The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Vladki on January 11, 2021, 08:52:33 PM

Title: Help window Index - language and encoding mixup
Post by: Vladki on January 11, 2021, 08:52:33 PM
Hello,

as I was looking a bit more at translations, I found out that the index of help file does not follow the translations exactly:

1. (as shown in attached screenshot) - if you switch languages, some items stay in the language that was active on start of program. In this case - game started in Czech, then switched several languages and ended up in German. The same happens also with western languages - start in english, switch to german, and the index will be half english, half german. It has nothing to do with the fact if the referenced help file is translated or not.

2. when the language is Czech - some items are shown properly in iso-8859-2 font, but some are in iso-8859-1. It seems there is some correlation with those that stay in the first language, but I'm not sure. Slovak and Polish seem to be OK.

3. in Slovak language most of the help texts are show in iso-8859-1 font (instead of 8859-2). Czech and Polish seem to be OK...

So the question is - where is the charset for each language specified? I see font specification in xx.tab, but CZ, SK and PL have the same:
Code: [Select]
PROP_FONT_FILE
prop-latin2.fnt

I was trying to find out the translation file/template for the help index but found only this:
https://translator.simutrans.com/script/edit.php?obj_id=56145&index=0

Is that all? That seems to define only the main chapters of index, but not the names of individual topics. They seem to be generated. But where and how can I fix them?
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 12, 2021, 12:38:58 AM
First: Please give me the exact steps to recreate this. I could not. Each time the help window is opened, it rebuilds the language strings.

Second: Czech display seems broken in the left side of the Index. "Napovida - my1" instead "Napoveda - mys" when using the wrong Latin2 font by manual selection. However, I could not find this string in the translation files ... Any hint will greatly help with debugging.

There should be only unicode internally but these seem to stay in Latin2. (The prop-latin2.fnt is internally replaced by cyr.bdf.)
Title: Re: Help window Index - language and encoding mixup
Post by: makie on January 12, 2021, 07:30:15 AM
There should be only unicode internally but these seem to stay in Latin2. (The prop-latin2.fnt is internally replaced by cyr.bdf.)
We can change the output of the translator to UTF-8.
For these language or for all of language.
This can be changed here:
https://makie.de/translator/script/admin.php?action=language
That just changes the output. From my point of view or from the perspective of the translator, this can be changed at will.
I just didn't dare to change it, because I don't know the effects on the Simutrans program.
Title: Re: Help window Index - language and encoding mixup
Post by: Dwachs on January 12, 2021, 07:53:11 AM
These section names are taken from the title in title-tags of the corresponding txt-helpfiles
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 12, 2021, 08:34:13 AM
The titles are extracted before the file is recoded. This requires some more effort. The content is correctly converted on loading (albeit for other languages some more characters needs to be checked.) Still getting offtopic from the initial error.
Title: Re: Help window Index - language and encoding mixup
Post by: Vladki on January 12, 2021, 12:02:45 PM
First: Please give me the exact steps to recreate this. I could not. Each time the help window is opened, it rebuilds the language strings.
For me it works like this:
- start the game, load any game or just stay with the demo.sve, savegame or pakset does not matter
- press F1, check that the help is all in current language, close help
- switch languages
- press F1, check that the topics on left side are mixed especially the tools/werkzeuge part.
I have downloaded fresh nightly including the support files (text, themes, etc) and deleted all xml and sve files, so there should not be any leftovers

Second: Czech display seems broken in the left side of the Index. "Napovida - my1" instead "Napoveda - mys" when using the wrong Latin2 font by manual selection. However, I could not find this string in the translation files ... Any hint will greatly help with debugging.
These section names are taken from the title in title-tags of the corresponding txt-helpfiles
That's what I see too (and reported as point 2). I have checked all txt helpfiles, and they are properly encoded in iso-latin-2, yet some of the titles are shown using latin-1 font.

I can try exporting files from translator in UTF-8, but still wonder why Polish is OK (and uses iso-latin-2 too).
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 12, 2021, 12:57:13 PM
The left index changes in my tests in the same language that I select, no matter if I start in Czech or in German.

EDIT: r9558 shopuld fix the index display error with latin2 languages.
Title: Re: Help window Index - language and encoding mixup
Post by: Dwachs on January 13, 2021, 05:55:41 PM
compiler warns about unused variable:
Code: [Select]
gui/help_frame.cc:443:12: warning: unused variable 'cc' [-Wunused-variable]
                                        utf32 cc = utf8_decoder_t::decode(c, len);
not sure, what to do here.
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 14, 2021, 12:57:09 AM
That was from too much copy and paste. We do not need the return value.
Title: Re: Help window Index - language and encoding mixup
Post by: Vladki on January 16, 2021, 03:30:08 PM
I confirm that issues 2 (nápověda - myš) & 3 (slovak help texts) are fixed. But the issue #1 still remains. Now I have started the game in german, help index was all in german. Then switched to english, polish, czech, slovak, and about half  of the tools index was still in german.
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 17, 2021, 12:46:35 PM
Please name a tool that stays the same. Because I cannot reproduce it. After closing and opening the help window, everything is in the same language.
Title: Re: Help window Index - language and encoding mixup
Post by: Vladki on January 18, 2021, 05:32:36 PM
I have downloaded fresh pak64 (using get_pak.sh) to avoid any pak related problems.
Game started in Slovak, switch to English. These topics remained in slovak: Landscaping tools, Railroad tools, monorail tools, tram/light rail tools, road tools, shipping tools, airport tools, narrow-gauge tools, special tools, map editing tools.
Second try - pak128, game started in english, switch to german - same topics remained in english.

Ohh. I noticed that If I have some of the above mentioned toolbars open, then the menu index is correctly translated - but only for those that are open.  So, finally steps to reproduce:

load a game, close all toolbars, check F1 help, close, change language, check F1 help (should be mixed), close
open some toolbars, check F1 - those toolbars that are open should be in correct language
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 23, 2021, 01:52:00 PM
So I choose the easiest option in r9582: Selecting a new language will just close all open windows ...
Title: Re: Help window Index - language and encoding mixup
Post by: Vladki on January 23, 2021, 03:21:23 PM
Yeah that will help when switching between latin-1 and latin-2 languages. I will try the help index later.

The help index is still mixed language after that. You have to _OPEN_ all toolbars to fix it. Not close them.
Title: Re: Help window Index - language and encoding mixup
Post by: prissi on January 24, 2021, 01:36:18 PM
Hopefully fixed for good in r9585
Title: Re: Help window Index - language and encoding mixup
Post by: Vladki on January 24, 2021, 06:08:46 PM
Fix confirmed, thank you.