Author Topic: Questions about the Translation features  (Read 361 times)

0 Members and 1 Guest are viewing this topic.

Offline Novachen

  • 28
  • The one and only Capella supernova.
Questions about the Translation features
Heyya,

actually i have some questions about the Translation features that were implemented by m!m during the resolve of #1522 on github at the end of 2017.
All these features are still undocumented how they actually work.

So if you do not mind, i have some questions :).

About subtitles in the video player
What format is needed for the subtitles in the video player? .srt? .sub? Any other format i am not even know about? (Never created subtitles before).
How i can control the Position of the text?
If SRT is used i only know, that i can use the $Movie subtitle font: in game_settings.tbl to set the right font... but what is about size and color of this subtitle?
I am even asking how to handle if i have two subtitles at the same time... which both of them have to be at different spots and colors. A case for this is for example that next to the spoken a text display appears that i want to translate also?
The only knowledge i have is that i have to set a language of a subtitle and that eng, ger and spa is supported so far.

Translation of string variables
I am not sure, WHERE i actually have to set any XSTR in a .fs2 file so that i can translate it properly.
If i have to set the XSTR right at the beginning of the file in the $variables tab? (All following examples are from BtA files and missions)
For example:
Code: [Select]
10 "Bpre" XSTR("Targets in Blast Range: ", -1) "string"?
or do i have to change that in the event directly?
For example in a string-equals-SEXP?
Code: [Select]
( string-equals
         "@ammoSetting[430mm Fusion Mortar]"
         XSTR("430mm Suppression", -1)
?
Actually this seems unlikely to work, but this string is not available in the $variables section of the mission... i can change and so translate it only in these SEXPs...?
What is about the hud-set-text SEXP in general... is this one also supporting XSTRs now?

Translation of string scripts
Actually i think, that the .cfg files in /config got XSTR support with that?
Something like
Code: [Select]
@Name: XSTR("Headlines", -1) in a config file is now supported?
And what is about XSTR support in the Text values of hud_gauges? Are these also supported now? The last time i test that (end of 2016 i have to admit), the whole XSTR was showed also in the HUD in the end.

I hope you can get me some answers, so that i can improve my translation efforts :).
And yes, i already have the new version of tstrings for all that.

Greetings,

Novachen
Female FS2 pilot since 1999.

Global Moderator in the German FreeSpace Galaxy.
German Translations created by me: Between the Ashes 1, FreeSpace Port, The Destiny of Peace, Silent Threat: Reborn
Campaign & Mod Upgrades created by me: Into the Halls of Valhalla, Luyten Civil War, Renegade Resurgence, VeniceMirror Chapter One: The Laramis Schism, A Walk in the Sun, Rogues!, Revenge: Final Conflict

If you want to know, what my nickname means, -chen is a german diminutive term, so you can translate Novachen as something like Little Nova or Novalet.
Even my original meaning of this name is more like "Sweet pretty deadly (Super)Nova".

 

Offline m!m

  • 211
Re: Questions about the Translation features
About subtitles in the video player

What format is needed for the subtitles in the video player? .srt? .sub? Any other format i am not even know about? (Never created subtitles before).
I developed the subtitle code with .srt encoded subtitles but other may work as well.

How i can control the Position of the text?
If SRT is used i only know, that i can use the $Movie subtitle font: in game_settings.tbl to set the right font... but what is about size and color of this subtitle?
I am even asking how to handle if i have two subtitles at the same time... which both of them have to be at different spots and colors. A case for this is for example that next to the spoken a text display appears that i want to translate also?
At the moment, you can't control the position of the text. The movie player will always render the text in the in the middle of the screen on the lower half. You can change the size of the font by using a custom font with a specific size. The movie player will respect that setting. The color cannot be changed at the moment.

The only knowledge i have is that i have to set a language of a subtitle and that eng, ger and spa is supported so far.
The only reason that list does not contain more entries is because my test files did not have any other language. New language mappings can be added to the code pretty easily though.

In general the new subtitle renderer is pretty limited since I only had a very limited test movie. If you have a movie file that renders subtitles correctly in other video player I could take a look at it and try to implement the required functionality but FSO is not a video player and supporting all options of SRT is not in the scope of the video player.

Translation of string variables
I am not sure, WHERE i actually have to set any XSTR in a .fs2 file so that i can translate it properly.
If i have to set the XSTR right at the beginning of the file in the $variables tab? (All following examples are from BtA files and missions)
For example:
Code: [Select]
10 "Bpre" XSTR("Targets in Blast Range: ", -1) "string"?
or do i have to change that in the event directly?
For example in a string-equals-SEXP?
Code: [Select]
( string-equals
         "@ammoSetting[430mm Fusion Mortar]"
         XSTR("430mm Suppression", -1)
?
Actually this seems unlikely to work, but this string is not available in the $variables section of the mission... i can change and so translate it only in these SEXPs...?
The only new thing is the modify-variable-xstr SEXP. You can use it to set a variable to the translated version of a string. The default value is not supposed to be used with XSTR (but it may still work). I imagined that the mission would use the new SEXP at the start to initialize the translated SEXP variables with their localized text instead of relying on the default value.

What is about the hud-set-text SEXP in general... is this one also supporting XSTRs now?
It is not supported directly but you could use a translated SEXP variable to get the translated text and then use the standard hud-set-text SEXP with that variable to set a translated HUD text.

Translation of string scripts
Actually i think, that the .cfg files in /config got XSTR support with that?
Something like
Code: [Select]
@Name: XSTR("Headlines", -1) in a config file is now supported?
The script config files are not handled by FSO in any way so XSTR support can not be added automatically. The script that reads these files needs to handle that by itself (it has the ability to do so using the ba.XSTR function). I discussed that with Axem a while back on Discord and he was afraid that it might break the existing parser :p

And what is about XSTR support in the Text values of hud_gauges? Are these also supported now? The last time i test that (end of 2016 i have to admit), the whole XSTR was showed also in the HUD in the end.
I am not aware of any translation restrictions in the HUD gauges table. Do you have a test file which shows this behavior? I could take a look at it to determine which it isn't displayed correctly.

 

Offline Novachen

  • 28
  • The one and only Capella supernova.
Re: Questions about the Translation features
Heyya m!m,

thanks for the answers :)

About subtitles in the video player

What format is needed for the subtitles in the video player? .srt? .sub? Any other format i am not even know about? (Never created subtitles before).
I developed the subtitle code with .srt encoded subtitles but other may work as well.

Well i am not know much about subtitles, but AFAIK the main difference between .srt (SubRip) and .sub (VobSub) is, that .srt is plain text and .sub is actually a graphic layer. .sub enables different fonts and colors, even graphic effects (Scrolling and transition effects etc., not sure about the actual positioning). DVDs and BluRays are using this. This would be a huge difference... as you can imagine. Based on your answer i think that only Plain text subtitles are supported so far. Well, maybe i will create a small test video for myself for testing purposes.

Translation of string variables stuff
The only new thing is the modify-variable-xstr SEXP. You can use it to set a variable to the translated version of a string. The default value is not supposed to be used with XSTR (but it may still work). I imagined that the mission would use the new SEXP at the start to initialize the translated SEXP variables with their localized text instead of relying on the default value.

Okay, that means, that i actually have to change some missions or to better say, i have to wait for an BtA-Update... because i was contacted two months ago, if i can help to include my translation into the actual mod. Because i do not heard anything since then i have started to thought about how i can do that myself with the version i have.. the answer is, i can not. Good to know.

What is about the hud-set-text SEXP in general... is this one also supporting XSTRs now?
It is not supported directly but you could use a translated SEXP variable to get the translated text and then use the standard hud-set-text SEXP with that variable to set a translated HUD text.

Ah, that would be an idea, but i do not think that this one is needed to implement yet as long all the other features are not useable without bigger changes.

Translation of string scripts
Actually i think, that the .cfg files in /config got XSTR support with that?
Something like
Code: [Select]
@Name: XSTR("Headlines", -1) in a config file is now supported?
The script config files are not handled by FSO in any way so XSTR support can not be added automatically. The script that reads these files needs to handle that by itself (it has the ability to do so using the ba.XSTR function). I discussed that with Axem a while back on Discord and he was afraid that it might break the existing parser :p

Okay, another thing i can not implement with the current public version of the modification as it seems.

And what is about XSTR support in the Text values of hud_gauges? Are these also supported now? The last time i test that (end of 2016 i have to admit), the whole XSTR was showed also in the HUD in the end.
I am not aware of any translation restrictions in the HUD gauges table. Do you have a test file which shows this behavior? I could take a look at it to determine which it isn't displayed correctly.

Well... maybe this was fixed in the meantime. I tested that a few minutes ago and this time it worked. No idea what was wrong back then. So this is an non-issue now.
Female FS2 pilot since 1999.

Global Moderator in the German FreeSpace Galaxy.
German Translations created by me: Between the Ashes 1, FreeSpace Port, The Destiny of Peace, Silent Threat: Reborn
Campaign & Mod Upgrades created by me: Into the Halls of Valhalla, Luyten Civil War, Renegade Resurgence, VeniceMirror Chapter One: The Laramis Schism, A Walk in the Sun, Rogues!, Revenge: Final Conflict

If you want to know, what my nickname means, -chen is a german diminutive term, so you can translate Novachen as something like Little Nova or Novalet.
Even my original meaning of this name is more like "Sweet pretty deadly (Super)Nova".

 

Offline Axem

  • Administrator
  • 211
Re: Questions about the Translation features
Translation of string scripts
Actually i think, that the .cfg files in /config got XSTR support with that?
Something like
Code: [Select]
@Name: XSTR("Headlines", -1) in a config file is now supported?
The script config files are not handled by FSO in any way so XSTR support can not be added automatically. The script that reads these files needs to handle that by itself (it has the ability to do so using the ba.XSTR function). I discussed that with Axem a while back on Discord and he was afraid that it might break the existing parser :p

Okay, another thing i can not implement with the current public version of the modification as it seems.

Actually this might seem easier than I thought. Novachen's problem before was caused by not having a config file converted to UTF8. After that was done, my parser script was able to get the text completely fine without modification.

For simple CFG files (with @Index) I can add some sort of XSTR support where you specify the XSTR index for the field immediately after the one you want to translate.

So for example it'd look like...

Code: [Select]
@Name: I like cake
@XSTR: 55
@Text: I really love cake you know
@XSTR: 56

A problem arises for the more complex CFG files that use JSON as the format (like the system viewer). I can't do something similar because there's never a guarantee in what order everything gets put in the end. And there's such a mix of strings and all sorts of other data that having XSTR indexes for this would be really difficult. But I do have an idea. I could add the ability to load a translated copy that has the language code in the file name. So if the normal config file is
Code: [Select]
cakedefs.cfg then with an added lua function I could detect the game's language and then look for something like
Code: [Select]
cakedefs-de.cfg or
Code: [Select]
cakedefs-fr.cfg
Does that sound reasonable?