schlangster / skyui

SkyUI interface mod for Skyrim.
270 stars 168 forks source link

Translation of scripts #78

Closed adrobkov closed 5 years ago

adrobkov commented 5 years ago

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...

Mardoxx commented 5 years ago

_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!

Mardoxx commented 5 years ago

So for your first example you'd do

Translation: $PSA_SyncWith{} Sync with {}

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

adrobkov commented 5 years ago

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!!!!!!! )))

Mardoxx commented 5 years ago

I'm so glad! Happy modding!

Mardoxx commented 5 years ago

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

E.g.

string test = "$otherTranslation"
AddToggleOption("$translation{" + test + "}", toggleVar)
adrobkov commented 5 years ago

Thank you very much! Really help))

adrobkov commented 5 years ago

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(

Mardoxx commented 5 years ago

No this is correct

On Mon, 8 Oct 2018, 17:24 adrobkov, notifications@github.com wrote:

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(

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/schlangster/skyui/issues/78#issuecomment-427896997, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOoMcv3VzQljWo3yoT-EcyS2NQu6CnSks5ui3w1gaJpZM4XNLdI .

adrobkov commented 5 years ago
    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