schlangster/skyui

Translation of scripts

adrobkov opened this issue · 9 comments

Hello!
I redo some mods and translate them into several languages. Not to translate the script a few times I edit scripts adding a $sign to the text. But I noticed that not everything can be translated. I read the SkyUI documentation, but found nothing there that can help.

For example, this string works fine and the translation is picked up from the translation file...
_iSyncHeightWerewolfID = AddToggleOption("$PSA_SyncWith", FPHmain.WerewolfSyncHeight)
and this does not work anymore...
_iSyncHeightWerewolfID = AddToggleOption("$PSA_SyncWith" + " " + FPHmain.GetRaceName(), FPHmain.WerewolfSyncHeight)
Maybe there are ways to solve this problem?

Similarly, translation does not work in:
            if (a_conflictName != "")
                msg = "This key is already mapped to:\n'" + a_conflictControl + "'\n(" + a_conflictName + ")\n\nAre you sure you want to continue?"
            else
                msg = "This key is already mapped to:\n'" + a_conflictControl + "'\n\nAre you sure you want to continue?"
            endIf
            continue = ShowMessage(msg, true, "$Yes", "$No")
if you bring to mind:
            if (a_conflictName != "")
                msg = "$KeyMapped" + ":\n'" + a_conflictControl + "'\n(" + a_conflictName + ")\n\n" + "$SureContinue"
            else
                msg = "$KeyMapped" + ":\n'" + a_conflictControl + "'\n\n" + "$SureContinue"
            endIf
            continue = ShowMessage(msg, true, "$Yes", "$No")
Although the variables $Yes and $No well translated...

Help if you know... The very meaning of such a translation is lost, if due to some points you still need to keep the script file in different languages...

_iSyncHeightWerewolfID = AddToggleOption("$PSA_SyncWith" + " " + FPHmain.GetRaceName(), FPHmain.WerewolfSyncHeight)

This would look for a translation keyed with "$PSA_SyncWith Nord" with a space. Are you sure that's right?


I can't remember what mechanism we had for nested translations. I think it was something like this "$outerKey{otherKey}{otherText2}" So it looks for a key of $outerKey{}{} then recursively finds and replaces inner instances, similar to string.format()?

English translation key:
$KeyMapConflict{}{} This key is already mapped to:\n{}\n({})\n\nAre you sure you want to continue?

Papyrus script
msg = "$KeyMapConflict{" + a_conflictControl + "}{" + a_conflictName + "}"

This may work! I can not test it, been years since I've touched this stuff!

So for your first example you'd do

Translation:
$PSA_SyncWith{} Sync with {}

Papyrus:
_iSyncHeightWerewolfID = AddToggleOption("$PSA_SyncWith{" + FPHmain.GetRaceName() + "}", FPHmain.WerewolfSyncHeight)

So it was in the original script:
_iSyncHeightWerewolfID = AddToggleOption("Sync With " + FPHmain.GetRaceName(), FPHmain.WerewolfSyncHeight)

YEEEES! its WORK!
Translation:
$PSA_SyncWith{} Sync with {}

Papyrus:
_iSyncHeightWerewolfID = AddToggleOption("$PSA_SyncWith{" + FPHmain.GetRaceName() + "}", FPHmain.WerewolfSyncHeight)
THANKS!!!!!!! )))

I'm so glad! Happy modding!

The strings within the {} can also be translation lookups.

E.g.

string test = "$otherTranslation"
AddToggleOption("$translation{" + test + "}", toggleVar)

Thank you very much! Really help))

I'm sorry, I know this is arrogance...

debug.MessageBox("FISS not found. Operation aborted!") is work
debug.MessageBox("$FissMiss") and so, too, does not want to transfer(

	string FissMiss = "$mHUD_FissMiss"
	debug.MessageBox("FissMiss")

and so, too, does not want to transfer...

What's right?
https://www.nexusmods.com/skyrim/mods/48265
Quote:

FISSInterface fiss = FISSFactory.getFISS()
If !fiss
debug.MessageBox(“FISS not installed. Save/Reload disabled”)
return
endif