Adventure Game Studio | Forums

AGS Support => Advanced Technical Forum => Topic started by: guga2112 on Thu 06/02/2020 19:13:32

Title: [SOLVED] Translation: same original sentence, but two different meanings
Post by: guga2112 on Thu 06/02/2020 19:13:32
Hi guys,
I'm currently working on the translation of my game, and I ran into an issue.

I have the same string in two places, but the translation needs to be different. And the .trs file only lists one.

The string is "Music" - one is in the Options screen, so it will be translated to "Musica", but the other one is an in-game sentence, where it should be "La musica".

How can I solve this? Is there a way of putting non-printable characters into the code?

A workaround I thought of is changing one of the two sentences to something like "BLAHBLAHBLAH" and add an English translation to bring back the original value, but this is something I'd like to avoid. Any pointers?
Title: Re: Translation: same original sentence, but two different meanings
Post by: Crimson Wizard on Thu 06/02/2020 19:36:43
Quote from: guga2112 on Thu 06/02/2020 19:13:32
The string is "Music" - one is in the Options screen, so it will be translated to "Musica", but the other one is an in-game sentence, where it should be "La musica".

In this particular example, cannot english sentence also include an article? Like "A music" or "The music"?


In general, when above approach does not apply, I know only one workaround for this problem: use voice-over tags. They should not cause any trouble if you don't have any voice-over and be ignored, but they will become a part of the string key for translation.

For example: "&1 Music" and "&2 Music". Or "Music" for GUI setting and "&1 Music" for in-game sentence (because GUI are usually not voiced over).
Title: Re: Translation: same original sentence, but two different meanings
Post by: fernewelten on Thu 06/02/2020 20:21:15
Unfortunately, the assumption is flawed from the get-go that source terms and target terms are in n:1 correspondence. There's the grammar angle: The translation might need to be declined dependent on the context, which might require different articles in the translation as well as different word spellings.

English "bear"; German "Der Bär" / "des Bären" / "dem Bär," / "den Bären" depending on the context.

And there are cases where one term in the source language corresponds to completely different terms in the target language, never mind the article.
German: "Mutter", English "nut" / "mother" dependent on the context
English "scales"; German "Schuppen" / "Waage", dependent on the context.

If there are only a few ambiguous terms in your code, you might get by by using "scalesX" and "scalesY" in your code and then cutting off the last letter before showing the word on screen. Then the translators can convert "scalesX" to "SchuppenX" and "scalesY" to "WaageY", so that the right thing happens when the last letter is cut off. Or, using the code (N)ominative, (G)enitive, (D)ative, (A)ccusative, put "bearN", "bearG", "bearD"; "bearA" in the code and let them be translated to "der BärN", "des BärenG", "dem BärD", "den BärenA", respectively. However, there are still some cases where the target language uses different grammar cases than the source language: English "I (nominative) can't think of anything!" German "Mir (dative) fällt nichts ein!" French "Je (nominative) n'en ai aucune idée".

Or else, simply ignore the issue and provide bad translations. I seem to recall that most of the classic Point & Click games treated the Germans with poetic gems such as "Benutze Der Zahnbürste mit Der Bär", and nobody seemed to mind much.

By the bye: Translation friendly code should always prefer patching full sentences to piecing together parts. For instance, if you code
Code (ags) Select
String verb = "take";
    String thing = "hammer";
    String s = "Should I " + verb " the " + hammer + "?";

then the translator might find that they ought to move the pieces around in the translation, but can't.
English: Should I take the hammer?
German: Soll ich den Hammer nehmen?
Or the typographic conventions differ, note the space before the question mark:
French: Il faut prendre le marteau ?

On the other hand, if you code
Code (ags) Select
String s = "Should I <verb> the <thing>?"
... and then replace "<verb>" by the verb and "<thing>" by the thing,
then the German translator can translate that to : "Soll ich <thing> <verb>?" (changing the sequence), and the French translator to "Il faut <verb> <thing> ?" (adding the space).
Note that this, right here, is an instance where you have to deal with articles and grammatical cases in some way, too. "thing" might turn out to be male, female or neuter in different languages, and it will probably turn out to be accusative here, but nominative elsewhere.

Internationalization is harder than it seems at first glance.
Title: Re: Translation: same original sentence, but two different meanings
Post by: Cassiebsg on Thu 06/02/2020 22:42:45
since it's your game, there's also the option to add an invisible character to one of the texts.

Like:
Music

&

Music

(If you can't see the difference, highlight the words. I added a space to the end of the second word.)

So then you could translate

Musica

&

La Musica

Because AGS sees the space character as just another character.
The other option is to tell AGS to treat each entry as one new entry, even if the words/sentences are exactly the same.
Title: Re: Translation: same original sentence, but two different meanings
Post by: guga2112 on Fri 07/02/2020 12:25:00
Thank you all.

In the end, it was only just that one, which I solved as Cassiebsg suggested: on the GUI I just put "Music ", my label looks exactly the same, but I get two different translation entries.

I like the AGS translation system - it's pretty fast and simple, but this is quite a limitation. I have an idea for an improvement, but I don't have the time now to look into it. I'll post it on the appropriate subforum :)

Thanks again!