So, I've got an AGS4 game that has the usual ANSI (ASCII) code files.
It features room 1 having the code:
function room_AfterFadeIn()
{
[…]
player.Say("Vamp squawks: Say hello to Felix or Jody!");
}
The corresponding trs file has the name DE-de.trs:
// AGS TRANSLATION SOURCE FILE
// […]
//
// ** Translation settings are below
// ** Leave them as "DEFAULT" to use the game settings
// The normal font to use - DEFAULT or font number
//#NormalFont=DEFAULT
// The speech font to use - DEFAULT or font number
//#SpeechFont=DEFAULT
// Text direction - DEFAULT, LEFT or RIGHT
//#TextDirection=DEFAULT
// Text encoding hint - ASCII or UTF-8
#Encoding=UTF-8
[…]
Vamp squawks: Say hello to Felix or Jody!
Vamp quäkt: Grüß Felix bzw. Jody schön!
... and is in UTF-8 without BOM, as far as I can ascertain.
When I compile the translation and run the program, it seems that the Engine:
- does find the translation of the sentence,
- but does not convert its UTF-8 combinations properly into multibyte characters:
(https://www.loquimur-online.de/ags/talk/2022-04-07/vampquaekt.png)
So what am I missing so that UTF-8 translation files work and display umlauts correctly?
The game is here: https://www.loquimur-online.de/ags/talk/2022-04-07/Test.zip
Hi Fernewelten! I am not sure, but I think it's the font being WFN. Can you try replacing the font with this unifont-14.0.02.ttf (https://unifoundry.com/pub/unifont/unifont-14.0.02/font-builds/unifont-14.0.02.ttf)?
If this solves, I think we really need to start a thread to accumulate possible pixel UTF-8 valid fonts.
Edit: ah, the project is different from the compiled data in data dir...
Edit2: uhm, I don't get anywhere switching the font too.
Edit3: found the error, your translation file (DE-de.trs) header you uncommented the # tag, you should leave it under the comment, like this:
// AGS TRANSLATION SOURCE FILE
// Format is alternating lines with original game text and replacement
// text. If you don't want to translate a line, just leave the following
// line blank. Lines starting with '//' are comments - DO NOT translate
// them. Special characters such as [ and %%s symbolise things within the
// game, so should be left in an appropriate place in the message.
//
// ** Translation settings are below
// ** Leave them as "DEFAULT" to use the game settings
// The normal font to use - DEFAULT or font number
//#NormalFont=DEFAULT
// The speech font to use - DEFAULT or font number
//#SpeechFont=DEFAULT
// Text direction - DEFAULT, LEFT or RIGHT
//#TextDirection=DEFAULT
// Text encoding hint - ASCII or UTF-8
//#Encoding=UTF-8
//
// ** REMEMBER, WRITE YOUR TRANSLATION IN THE EMPTY LINES, DO
// ** NOT CHANGE THE EXISTING TEXT.t
There was a second hint there too, I removed it.
(https://i.imgur.com/s7xqc9hl.png)
You're great! Many, many thanks for the fast response. It hadn't occurred to me that the line that specifies the encoding needs to be commented out.
Yeah, being commented is a weird choice, I don't know why it's like this!
It's not just the line with encoding needs to be commented out, it's the general syntax for translation options: this is how the translation compiler differs the options from the text lines.
The manual:
https://adventuregamestudio.github.io/ags-manual/Translations.html#additional-options
Quote
Font options let you define certain font substitutes for this particular translation. All options begin with the comment opening and a pound sign: //# - followed by OPTION=VALUE kind of string where "OPTION" is the corresponding name.