Announcement

Collapse
No announcement yet.

[Plugin] Automatic Google Translate (v1.3.3, 2017.10.26)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Translations] [Plugin] Automatic Google Translate (v1.3.3, 2017.10.26)

    Checks for any untranslated text in the game and translates it using Google, also keeps existing translations intact.

    Now with support for YATranslator by denikson.

    First some kudos to all of you, who help translating this great game, I really appreciate your work. But large parts of this game are sadly still not translated. Because I prefer some sucky machine translation over having absoulutly no idea what's going on, I wrote this little plugin to let Google translate the rest of the game. I know, there are already a few ways to do this (like here) I found none really appealing. I don't wan't to start X programms extra, I just wan't to play. Also I use VR, so everything that displays the translation in an extra window is right out.

    You can find the full source and downloads on Github.

    Features
    • Detects any text that is not translated in game and translates it using google
    • Translated text directly replaces the original japanese in game
    • All translations are cached to a file the Unified Translation Loader understands. This allows easy touchups and sharing
    • Works with the VR patch
    • Conifgurable and easy to install. No bells and whistles attached
    • Works with UTL, TranslationPlus and YATranslator.






    General Info
    You can use F10 (configurable) to disable/enable translations. Photo Mode has a few issues with translations, so either turn my plugin off before entering it, or loot at the Troubleshooting section for a workaround.

    All translations are saved to UnityInjector/Config/Strings/Translation/google_translated.txt. At the next start this file gets also loaded by UTL/T+. That means you keep all translations from this plugin, even if you uninstall it.
    All text will also get preprocessed before it is sent to Google. Some fancy punktuations will get replaced by more normal ones (e.g. 【/】 with [/]). This is because some fancy symbols may confuse Machine Translators. If you find some extra Punktuations that cause problems or want your fancy brackets back you can edit AutoTranslateTextSubstituions.txt.

    It is possible to ignore translations and use the original japanese text. This is important for some cases, where the game checks for the text on a button. Any translation of that text would break the button. This can be done by using the file 'Config/AutoTranslateIgnore.txt'. One string per line, those are ignored in the translation. Whole levels can be ignored by specifying $LEVEL <id> (replace with the numerical id of the level). Thanks to denikson for implementing this feature.







    Installation
    If you have game version < 1.41 download v1.0.1 of my plugin else download the newest version.
    Just drop CM3D2.AutoTranslate.Plugin.dll into UnityInjector/ and set your text speed to max.
    Requires either Unified Translation Loader OR TranslationPlus OR YATranslator to work.







    Using LEC
    Spoiler

    To use LEC with my plugin also download TranslationServer.zip and extract it somewhere. Change TranslationMethod to GeneralNetworkTranslation in the config file (UnityInjector/Config/AutoTranslatePlugin.ini). You need to start TranslationServer.exe each time before you start the game. If you have LEC installed then it should automatically detect it, else you need to copy the Nova/ folder into the Plugin/ folder next to TranslationServer.exe.






    Known Issues
    • It's machine translation, be prepared to read some gems like maids ironing your dog or something
    • It takes a few seconds till the translations pop up. It's the time google needs to translate. But after the first translation the text appears instant
    • Sometimes the contents of Text Input fields get translated (e.g. The name field for your character or a maid). Although it seems the textfield contains an 'english' name, the game still sees the original Kanjii.
    • The plugin overrides manual translations if your Text speed is *not* max (Thanks to Linaris for finding this)
    • Newer versions only work with Unity 5 versions of the game (Game version 1.41+), if you have an earlier version of the game use v1.0.1 of my plugin
    • Sometimes LEC gets scared and only translates gibberish
    • Photo Mode seems to have issues with translations. This can be worked around, by adding the following strings to 'Config/AutoTranslateIgnore.txt':
      Code:
      	足
      	胴体
      	手






    Config
    Spoiler
    The config file is UnityInjector/Config/AutoTranslatePlugin.ini. Those are the options in it:
    • General
      • PluginActive: False to disable the whole plugin (default: True)
      • TranslationMethod: Engine used to translate (default: Google)
        • Google: Send the text to google and use their translation, obviously requires an internet connection
        • GeneralNetworkTranslation: Send text to an extra program or server to translate, look at the LEC section to read more.
      • ToggleTranslationKey: Key to turn the plugin on/off ingame. (default: f10)
        Valid key names can be found here (bottom of page)
      • SubstitutionsFile: Path to a file containing text substitutions before sending the text to google (default:AutoTranslateTextSubstitutions.txt)
    • Cache
      • File: The file, where the translations are cached (default: google_translated.txt)
      • Folder: The folder where the translation file is, a subfolder of UnityInjector/Config/Strings/ (default: Translation)
      • WriteCacheToFile: False to disable caching of the translation on your HDD (default: True)
      • Frequenzy: How often should the cache file written to disk (defaul: OnQuit)
        • OnQuit: Only save when quitting the game
        • Instant: Save after every translated line, may degrade performance
        • Periodic: Save every X seconds, may lead to lag spikes when many lines at once need to be saved; also saved when quitting
      • PeriodicIntervall: Save intervall in seconds for Frequenzy = Periodic (default: 10)
    • Debug
      • VerbosityLevel: How much text the plugin prints to the console window. 0 means nothing, 10 is everything (default: 1)
      • ColorConsoleOutput: True to color the text of my plugin (default: false)
      • LogToFile: True to save all output of my plugin to UnityInjector/Config/Log/AutoTranslate.log (default: False)
    • Google (Only used with TranslationMethod = Google)
      • TargetLanguage: The language code (list here) for the language Google translates to (default: en)
    • GeneralNetworkTranslation (Only used with TranslationMethod = GeneralNetworkTranslation)
      • Host: Computer that hosts the translation server, localhost is your own pc (default: localhost)
      • Port: Port to connect to (default: 9586)











    Troubleshooting
    When asking for help, please include a logfile.





    Spoiler


    How to enable logging
    To enable logging open the config file and change Debug/VerbosityLevel to 10 and Debug/LogToFile to True. This will create a logfile in UnityInjector/Config/Log/.


    Photo Mode not working:
    Add the following strings to 'Config/AutoTranslateIgnore.txt':
    Code:
    足
    胴体
    手

    Plugin crashes with the following error:
    Code:
    Loading Assembly: 'C:\KISS\CM3D2\UnityInjector\CM3D2.AutoTranslate.Plugin.dll'
    System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
        at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
        at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
        at UnityInjector.PluginManager.LoadPlugins_DLL (System.String dll, System.String exe) [0x00000] in <filename unknown>:0
    Then you probably use a new version of my plugin (>v1.0.1) with an older version of CM3D2 (< 1.41). Either upgrade your game or use v1.0.1 of my plugin.





    Changelog
    Spoiler
    • v1.3.3 [2017.11.22]:
      - Fixed bug that prevented usage with UnifiedTranslationLoader
    • v1.3.2 [2017.10.26]:
      - Fixed: Using YAT everythin was translated only once. Thanks to denikson for the fix.
    • v1.3.1 [2017.09.24]:
      - Fixed: Subtitles from YAT not getting translated
    • v1.3.0 [2017.09.24]:
      - Added: Support for YATranslator
      - Added: 'AutoTranslateIgnore.txt' file to ignore specific strings
    • v1.2.3 [2017.07.27]:
      - Fixed: Some translated lines revert to japanese when you don't have internet
    • v1.2.2 [2017.06.20]:
      - Fixed: Broken translation in maid status screen
    • v1.2.1 [2017.05.01]:
      - Fixed: Translations and caching were messed up
    • v1.2.0 [2017.04.15]:
      - Added: Support to turn translation of ingame (Default Hotkey: F10)
      - Added: Preprocessing of text to replace fancy unicode with ASCII (this may improve translation results)
    • v1.1.3 [2017.04.08]:
      - Fixed: NotYetImplementedException: null caused by google changes
    • v1.1.2 [2017.03.16]:
      - Fixed: Correct handling for multiple translation requests for the same text box
      - Fixed: Sometimes text was not getting translated at all
    • v1.1.1 [2017.02.19]:
      - Plugin now also works with TranslationPlus for Sybaris
    • v1.1.0 [2017.02.05]:
      - Added: Interface to allow other programs provide translations
      - Added: Extra program that uses said interface to translate text with LEC
      - Added: Options to save cache after every translation, every X seconds or only when quitting the game
      - Fixed: Plugin no longer crashes when the cache file is corrupted
      - Improved: Program log is more concise with different colors for general text, warnings and errors
      - Improved: Log can now be saved to a logfile
    • v1.0.2 [2017.01.22]:
      - Fixed: Plugin doesn't create cache file automatically
      - Fixed: Translations contain sometimes a stray 'r' or 'n' at the end
      - Fixed: Sometimes translations get truncated (When your maid says multiple sentences in one dialog box only the first was translated)
      - Improved: More configuration options
    • v1.0.0 [2017.01.19]: Initial Release






    That's all folks, have fun!
    Attached Files
    Last edited by whootwhoot; 11-22-2017, 01:00 PM.

  • Where to get proper version of LEC? It seems i downloaded something from interner but TranslationServer doesnt detect it and theres no folder named Nova to put into Plugins. I think i downloaded wrong LEC xD
    Last edited by Kuromaki; 07-25-2018, 02:50 PM.
    <3

    Comment


    • After google translate stopped working, I installed LEC and modified the auto-translate plugin but I still get that error when launching the game and no translations are available :

      Adding Component: 'YATranslator'
      YATranslator::CacheAssets::Cached '0' Assets
      YATranslator::CacheTexture::Cached '0' Textures
      YATranslator::Strings::Loaded '51226' Translations
      YATranslator::Hooking complete
      Adding Component: 'YotogiAtmosphere'
      Adding Component: 'YotogiUtil'
      ----------------------------- Plugin Manager End ------------------------------
      [AutoTranslate] [1.3.3] [Error]: 503 Service Unavailable
      Log @ at System.Environment.get_StackTrace()
      at CM3D2.AutoTranslate.Plugin.Logger.LogError(System. Object msg)
      at CM3D2.AutoTranslate.Plugin.GoogleTranslationModule +<TranslateGoogle>d__9.MoveNext()
      at CM3D2.AutoTranslate.Plugin.CoroutineEx+<Run>d__13. MoveNext()
      at UnityEngine.SetupCoroutine.InvokeMoveNext(IEnumera tor enumerator, IntPtr returnValueAddress)


      Here is my AutoTranslatePlugin file from Sybaris :

      [Debug]
      VerbosityLevel=1
      ColorConsoleOutput=False
      LogToFile=False

      [General]
      PluginActive=True
      ToggleTranslationKey=f10
      TranslationMethod=GeneralNetworkTranslation
      SubstitutionsFile=AutoTranslateTextSubstitutions.t xt

      [Cache]
      File=google_translated.txt
      Folder=Translation
      WriteCacheToFile=True
      Frequenzy=OnQuit

      [GeneralNetworkTranslation]
      Host=localhost
      Port=9586

      Do anyone know what's the problem?

      (I start Translation Server before the games and it shouldn't be blocked by the windows firewall as I set its access to both private and public)
      The Translation Server give me that when I launch it :

      Translation Server v0.2
      Loading LEC...
      Successfully loaded LEC at 'D:\LEC\Nova\JaEn\EngineDll_je.dll'
      Listening on port 9586
      Waiting for connection...

      And it doesn't change even after I launch Custom Maid 3d 2
      Last edited by Lkelon; 07-26-2018, 05:29 AM.

      Comment


      • Nevermind, I managed to fix it.

        Comment


        • This plugin is broken because Google is refusing third party translations. Anything you can do to fix it? It's unplayable without.

          Comment


          • After blocking google server i installed LEC but the translation is very bad. Anyone knows if its possible to configure LEC better?

            Comment


            • Originally posted by bilioga1 View Post
              After blocking google server i installed LEC but the translation is very bad. Anyone knows if its possible to configure LEC better?
              Shoot me a link where you got LEC from, please.

              Comment


              • There is an update of the autotranslate plugin https://github.com/Scrublord1336/XUn...lator/releases but i don't know how to install it.

                Comment


                • PetrosGR
                  PetrosGR commented
                  Editing a comment
                  Its not plugin for custom maid.Its plugin for Illusion games tried to install this managed to broke my game

              • There is succesor of this plugin here:https://github.com/bbepis/XUnity.Aut...lator/issues/5

                Comment


                • Deathstalker22
                  Deathstalker22 commented
                  Editing a comment
                  For those looking for an easy replacement, this worked well for me.

              • A user on GitHub made a UnityInjector plugin for translation. It's not made for CM3D2, but it can potentially work for CM3D2, if anyone's willing to work into it.

                https://github.com/bbepis/XUnity.Aut...ment-409731667

                Hope this helps!

                Comment


                • PvPer
                  PvPer commented
                  Editing a comment
                  I tried again and the autotranslatorplugin.ini file was created after i launched the game once.
                  I then modified it as instructed but it didn't work:
                  i still get the google 503 error...
                  Any suggestion (i am on com3D2) ?

                • Hellemperor
                  Hellemperor commented
                  Editing a comment
                  It worked for me as well, I use the latest version of Sybaris, thanks a lot, all people have to do is to follow your instructions.

                • Chimp Reformed
                  Chimp Reformed commented
                  Editing a comment
                  Apologies fam, indeed I wasn't very clear. In the end, my game I've figured out is no longer being translated by this Google plugin, instead the YASD kicked in when I removed various files. Using all dlc and fully updated, including Sybaris 2 (needed to for CM3D2 access).

                  But your below instructions also fixed my menu issues, so cheers for that input as well.

              • was about to suggest to use unitytranslator from koikatu but, seems like someone already post it...

                but none of the instructions is actually clear enough, i got it worked once, but that's it, just once, then it stop working after i restart the game...i review the steps from here but no luck...

                for example, see attachment, i got 3 unityinjetor folder, common sense would be in Sybaris/UnityInjector and Sybaris\UnityInjector\Config

                but still not clear enough, which file to remove? to which folder? because no one is mentioning the full file name, for example, DistortCorrect, ExternalPreset, ExternalSaveData, there are 2 of each, do we remove all of them? or?

                and which "autotranslation" file? file containing this name seems more than 2...

                so, if anyone can give a clear instructions about this, that'd be great...

                other than for myself, i also want to help others who also seems confused about how to get it working...and i'm guessing it's because no one is mentioning the full folder path or name or full file name...or perhaps using different version...

                thanks
                Attached Files

                Comment


                • nekololiphile
                  nekololiphile commented
                  Editing a comment
                  Alright so per GR9456TF's instructions, it worked for me. I deleted everything he mentioned in his comment (both files, for example both of the DistortCorrect files). I only have one UnityInjector folder (Sybaris/Plugins/UnityInjector), so that's where I deleted the YotogiUtil file. Now I went into Sybaris/Loader and deleted DistortCorrect, ExternalPreset, ExternalSaveData (all files with those names, seems like they're all paired up). Then I went under Sybaris/Plugins/UnityInjector/Config and opened the autotranslatorplugin.ini with Notepad++ and changed the things he said to change, after I loaded the game once of course.

                  I don't know if this changes anything (just got the game working yesterday, so I'm new), but I'm running CM3D2 with Sybaris AIO + AIOUE
                  Last edited by nekololiphile; 08-07-2018, 08:03 PM.

              • I agree with raavaholic, we really need more detailed guide please.
                I still couldn't get it work.

                Comment


                • Following GR9456TF's instruction seem to work. But now the modslider window in on permanently, I can't remove it. Dragging it around only cause more problems.
                  Attached Files

                  Comment


                  • nekololiphile
                    nekololiphile commented
                    Editing a comment
                    What I did was just outright remove the ModSlider plugin

                • Erm... A couple of the posts are talking about instructions that work, but i can not see anything in the thread, can someone point me to them?..

                  Comment


                  • nekololiphile
                    nekololiphile commented
                    Editing a comment
                    "I managed to get it working after some fiddling (Game v160, Sybaris AIO).
                    I removed the old plugin and extracted the 5 .dll files to the UnityInjector folder, and I also extracted ExIni.dll to the Loader folder. I also had to remove some plugins, since there seemed to be a conflict.
                    Removed from Loader: DistortCorrect, ExternalPreset, ExternalSaveData
                    Removed from UnityInjector: YotogiUtil
                    In the config file after running the game once with it (autotranslatorplugin.ini inside the config folder in the UnityInjector folder), I changed:
                    Endpoint=GoogleTranslateHack
                    Delay=0.1
                    EnableLog=True"

                    From GR9456TF's comment under MayuriShiina's post
                    Last edited by nekololiphile; 08-11-2018, 01:44 PM.

                  • Glazier
                    Glazier commented
                    Editing a comment
                    Oh, thanks, seems to work now!

                • Did google change something or am I somehow spamming them. I keep seeing a service 503 unavailable error?

                  Comment


                • I made some fast baked changes to this plugin. The plugin will now use Yandex instead of Google. (Can be changed in config whether use google or yandex)

                  But to make this work, you need to provide your API key. (magic key that identifies your translation requests so they can count how many have you requested this month - from obvious reasons I don't provide my key with the plugin.)
                  Yandex offers 1 milion daily/10 milion monthly translated characters with their free account (no real personal/payment info needed to make the account and get the key)

                  The changed plugin is here:
                  http://www.mediafire.com/file/300nuf...andex.zip/file

                  There is readme.pdf that explains how to get your own API key and where to put it to make it work. (It may sound scary, but it doesn't take more than 2 minutes to get the key and another minute to insert it into the config file)


                  Main advantage of this solution is that you need to just perform few steps described in the readme and the plugin will work again without looking for replacements...(Tested with CM3D2 1.60, Sybaris AIO)

                  Comment


                  • BanditoPenguino
                    BanditoPenguino commented
                    Editing a comment
                    That totally did the trick! Thanks, I really appreciate the help.

                  • andromeda2010
                    andromeda2010 commented
                    Editing a comment
                    The Yandex worked, but is the Google translation already fixed?

                  • torcher54
                    torcher54 commented
                    Editing a comment
                    To shed some light on Google translation issue:
                    This plugin used google FREE translation API service at https://translate.googleapis.com/translate_a/ (page translate.google.com uses this service, you don't need to be logged-in or anything and it works for you...)

                    The thing is, that there were no limits how many requests can be send to this service and over time, lot of apps was build using this service...which causes a lot of load on google servers and they get no money at all from it.

                    Google has their official PAID translation API that should be used by apps etc...it's costs xxx$ per month, you get your special API key and you can translate all day long...and google gets their money...the free API kind of ruined their bussiness.

                    So what google did is that they remember how many translation requests send a given IP over last xxx minutes and if they exceed a limit, they block all future requests for xxx minutes. This way, page translate.google.com still works for you, because human is not able to send so many requests in short time to reach the limit, but programs like this plugin reach the limit really fast...

                    I don't see how this google translate issue gets ever fixed, since if Google enabled the unlimited free translation API again, they would lose lot's of money...

                    Yandex has the same paid system as google, but yandex provides some free translations per month, making it currently a better alternative.

                    When I have some free time, maybe I will look around for some more free alternatives...(if there are any)

                    EDIT: it seems somebody else was may able to fix this custommaid3d2.com/index.php?downloads/noctsouls-sybaris-for-cm3d2.62...the CM3D2.AutoTranslate.Plugin.dll plugin from this pack seems to be working OK so far.
                    Last edited by torcher54; 09-12-2018, 10:09 PM.
                Working...
                X