Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Twine 1.4.2 with Sugarcube 2. Translate menu buttons?

By editing the Sugarcube 2 header.html (do I have the right to do so???), I managed to translate the Restart menu button, but not the ''Saves''. How can I do that? I wish both buttons to be in french & english.

Comments

  • With SugarCube 2, you don't need to edit the base story format or its compiled form (with your data added). It has a strings object which contains all of the user facing UI text (some error messages are not in there, but they're mostly the unrecoverable/fatal ones which you should hope your players never see).

    You simply need to overwrite the current value of each property you wish translated in a script-tagged passage. For example, to replace the "Saves" text on its menu item (and in its dialog title):
    strings.saves.title = "your preferred translation of 'Saves' here";
    
    You should check out the strings.js source file (also linked in its documentation) to see what you can replace. I'd suggest copying the current values from that file and then translating them, as some of the values include concatenations.

    Caveats:
    • Your translation should be UTF-8 encoded, not in your local code page. This is only a worry for translations which aren't completely ASCII.
    • Do not translate the replacement patterns within the UI code strings, which are described at the top of the strings.js source file, as they are replaced at run time by other properties within the strings object (e.g. %identity% is replaced by strings.identity).
    • Do not translate the non-UI code strings (e.g. in window.location.protocol === "file:", don't translate "file:").

    I should make this easier.
Sign In or Register to comment.