Tool Stardew Valley Localization Tool

Discussion in 'Mods' started by WarFollowsMe, Jun 6, 2016.

  1. WarFollowsMe

    WarFollowsMe Aquatic Astronaut

    Hello everyone.
    We are two developers: WarFollowsMe and Curiouspers.

    We very like Stardew Valley, but real excitement comes only when you play the game comfortably on your native language.

    That what pushed us forward to make Stardew Valley Localization to our native language - Russian. As we dig deeper and deeper into code, we realized that we can make this tool multilingual, and capable of other language packages.

    All of this became possible, when we decided not to change original texts in game resources, but create a mechanism to replace texts right before rendering stage. So the game thinks that it working with original texts, but our tool acts like a little build-up on top of the game, participating only at texts rendering stage, and don’t change the logic of the game.

    Well, it took us three month and now we want to share the results of our work with you, the great community of Stardew Valley!

    [​IMG]

    WARNING! This is not the end release, but pretty stable version. Bugs can occur here and there. The main goal right now is to figure out is there any interest to this project.

    Here’s the source code: https://github.com/WarFollowsMe/TranslationMod

    The tool itself consist of two parts:
    1. LanguagePatcher.exe - a little console program, that makes a series of injections to the game with help of Mono.Cecil library.
    2. MultiLanguage.dll - library, that contains methods to process intercepted texts and replacing them with localized texts from custom made dictionary.

    All language packages are placed in folder “languages”, that consist of:
    Code:
    [languages]
        Config.json      // required
        description.json // required
        [EN]             // required folder
        [RU]             // optional folder
        …...              // maybe your language folder here?
    1. Config.json - simple configuration file. Contains only two properties:
      • LanguageName - short language name that will be set when you launch the game, example: “RU
      • ExecutingAssembly - well, name of executable file, example: “Stardew Valley.exe”
    2. description.json - configuration file in format "ShortLanguageName":"FullLanguageName"
      Must always contain "EN":"English"! Other pairs are optional.
    3. Subfolders are language packages. Name of subfolders must always match the ShortLanguageName field in description.json. Subfolder EN must always be there.
    Language package must always contain 2 subfolders: “content” and “dictionaries”.
    Folder “content” keeps all .xnb files with textures, that may be redrawn to other languages. Folder structure replicates the in game Content folder.
    Folder “dictionaries” keeps all dictionaries in JSON format. That’s where you want to place the translations of original texts. Use the following format: “original text”:”translated text”.
    We split texts to different files on purpose. That way it’s easier to orient in all of these texts. Dictionaries contains special lines, started with “__comment”, that serves the same purpose, to make it clearer from what part of the game the following texts are.
    Also it’s very important to understand that, dictionaries with name started with underscore sign (“_”) are contains texts that was hardcoded into “Stardew Valley.exe”.
    Since in the game a lot of attention is paid to random generated dialogues and quests, we added complicated system of variables, that’s very easy to use.

    [​IMG]

    Now it’s only 5 variables:
    • @ key - placeholder for text that will be replaced by other (original) key from any dictionary
    • @ number - placeholder for numbers, floats and time
    • @ player - players name
    • @ farm - name of player’s farm
    • @playerChild - name of any player child
    It is possible that may put some new variables some day.

    Now, how to install it?
    1. You can download compiled archive from here: http://bit.ly/SV_TR, or compile it yourself from source code.
    2. List of files and folders that you must copy in root game folder:
      • [languages]
      • LanguagePatcher.exe
      • Mono.Cecil.dll
      • Mono.Cecil.Mdb.dll
      • Mono.Cecil.Pdb.dll
      • Mono.Cecil.Rocks.dll
      • MultiLanguage.dll
      • Newtonsoft.Json.dll
      • ICSharpCode.SharpZipLib.dll
      • Cyriller.dll
    3. Launch LanguagePatcher.exe. This program will check if your game patched, if not it will offer to patch the game. Press “y”, then press “Enter”. Then you can choose “1” create a new file, named Stardew Valley(multilang).exe or “2” to patch original file. In second case you must backup Stardew Valley.exe beforehand. Then you must see the message: "Patch successfully applied. Enjoy!". That’s all, you can start the game.
    How to add your language package:
    1. In the “languages” folder make a copy of “EN” folder and rename it, for example to “RU”
    2. Open descriptions.json and add another line, for example: "RU":"Russian"
    3. Translate every dictionary from dictionaries folder.
    4. You can use xnbNode to unpack and pack .xnb files with images that may be translated.
    (last one is optional, if you like english text on textures, that’s ok)

    To activate a new language package, you need to change “LanguageName” value in Config.json, or you may start a game and at the options page there will be new “Language” dropdown, you may also select your language there. IMPORTANT! Changes will take place only after game restart.

    [​IMG]

    Using mods
    • SMAPI doesn’t supported, because of the fact it’s using their own game wrapper, and our injections doesn’t work.
    • STORM API works, but we are not tested it much. To use it, you just need to patch original Stardew Valley.exe, and change in Config.json change ExecutingAssembly propery to name of .exe file storm uses.
    • Farmhand - not tested, but judging by source codes, it must work, in theory. Because it contains of similar approach from both Storm API and SMAPI, it changes game functionality with Mono.Cecil as we are.
    In any case you can test this tool at your own risk with other mod tools using this technique. At the time we do not prioritize this task.
     
      Last edited: Jun 7, 2016
    • WarFollowsMe

      WarFollowsMe Aquatic Astronaut





      P.S. Sorry for "google translate" strings ;)
       
      • Deadshot15

        Deadshot15 Master Chief

        Please update this tool to latest version :(
         

        Share This Page