فهرست منبع

readme update

randoman 6 سال پیش
والد
کامیت
a78e951f0b
2فایلهای تغییر یافته به همراه21 افزوده شده و 16 حذف شده
  1. 19 14
      README.md
  2. 2 2
      src/XUnity.AutoTranslator.Plugin.Core/AutoTranslationPlugin.cs

+ 19 - 14
README.md

@@ -27,7 +27,7 @@ If you intend on redistributing this plugin as part of a translation suite for a
 From version 3.0.0 it is possible to implement custom translators. See [this section](#implementing-a-translator) for more info.
 
 ## Translators
-The supported online translators are:
+The supported translators are:
  * [GoogleTranslate](https://anonym.to/?https://translate.google.com/), based on the online Google translation service. Does not require authentication.
    * No limitations, but unstable.
  * [GoogleTranslateLegitimate](https://anonym.to/?https://cloud.google.com/translate/), based on the Google cloud translation API. Requires an API key.
@@ -40,7 +40,7 @@ The supported online translators are:
    * Not sure on quotas on this one.
  * [YandexTranslate](https://anonym.to/?https://tech.yandex.com/translate/), based on the Yandex translation service. Requires an API key.
    * Free up to 1 million characters per day, but max 10 million characters per month.
- * [WatsonTranslate](https://anonym.to/?https://cloud.ibm.com/apidocs/language-translator), based on IBM's Watson. Requires a URL, username and password.
+ * [WatsonTranslate](https://anonym.to/?https://cloud.ibm.com/apidocs/language-translator), based on IBM's Watson. Requires a URL and an API key.
    * Free up to 1 million characters per month.
  * LecPowerTranslator15, based on LEC's Power Translator. Does not require authentication, but does require the software installed.
    * No limitations.
@@ -99,7 +99,7 @@ Installation instructions for all methods can be found below.
 Additionally it can be installed without a dependency on a plugin manager through ReiPatcher. However, this approach is not recommended if you use one of the above mentioned Plugin Managers!
 
 ## Configuration
-The default configuration file, looks as such (2.6.0+):
+The default configuration file, looks as such:
 
 ```ini
 [Service]
@@ -170,9 +170,8 @@ BaiduAppSecret=                  ;OPTIONAL, needed if BaiduTranslate is configur
 YandexAPIKey=                    ;OPTIONAL, needed if YandexTranslate is configured
 
 [Watson]
-WatsonAPIUrl=                    ;OPTIONAL, needed if WatsonTranslate is configured
-WatsonAPIUsername=               ;OPTIONAL, needed if WatsonTranslate is configured
-WatsonAPIPassword=               ;OPTIONAL, needed if WatsonTranslate is configured
+Url=                             ;OPTIONAL, needed if WatsonTranslate is configured
+Key=                             ;OPTIONAL, needed if WatsonTranslate is configured
 
 [Custom]
 Url=                             ;Optional, needed if CustomTranslated is configured
@@ -226,7 +225,7 @@ Resizing of a UI component does not refer to changing of it's dimensions, but ra
 
 #### Reducing Translation Requests
 The following aims at reducing the number of requests send to the translation endpoint:
- * `EnableBatching`: Batches several translation requests into a single with supported endpoints (Only GoogleTranslate and GoogleTranslateLegitimate at the moment)
+ * `EnableBatching`: Batches several translation requests into a single with supported endpoints.
  * `UseStaticTranslations`: Enables usage of internal lookup dictionary of various english-to-japanese terms.
  * `MaxCharactersPerTranslation`: Specifies the maximum length of a text to translate. Any texts longer than this is ignored by the plugin. Cannot be greater than 500.
 
@@ -266,7 +265,8 @@ REQUIRES: [BepInEx plugin manager](https://github.com/BepInEx/BepInEx) (follow i
 The file structure should like like this:
 ```
 {GameDirectory}/BepInEx/XUnity.AutoTranslator.Plugin.Core.dll
-{GameDirectory}/BepInEx/XUnity.AutoTranslator.Plugin.Core.BepInEx.dll
+{GameDirectory}/BepInEx/XUnity.AutoTranslator.Plugin.BepInEx.dll
+{GameDirectory}/BepInEx/XUnity.AutoTranslator.Plugin.ExtProtocol.dll
 {GameDirectory}/BepInEx/ExIni.dll
 {GameDirectory}/BepInEx/Translators/{Translator}.dll
 {GameDirectory}/BepInEx/Translation/AnyTranslationFile.txt (these files will be auto generated by plugin!)
@@ -281,7 +281,8 @@ REQUIRES: [IPA plugin manager](https://github.com/Eusth/IPA) (follow its install
 The file structure should like like this
 ```
 {GameDirectory}/Plugins/XUnity.AutoTranslator.Plugin.Core.dll
-{GameDirectory}/Plugins/XUnity.AutoTranslator.Plugin.Core.IPA.dll
+{GameDirectory}/Plugins/XUnity.AutoTranslator.Plugin.IPA.dll
+{GameDirectory}/Plugins/XUnity.AutoTranslator.Plugin.ExtProtocol.dll
 {GameDirectory}/Plugins/0Harmony.dll
 {GameDirectory}/Plugins/ExIni.dll
 {GameDirectory}/Plugins/Translators/{Translator}.dll
@@ -297,7 +298,8 @@ REQUIRES: UnityInjector (follow its installation instructions first!).
 The file structure should like like this
 ```
 {GameDirectory}/UnityInjector/XUnity.AutoTranslator.Plugin.Core.dll
-{GameDirectory}/UnityInjector/XUnity.AutoTranslator.Plugin.Core.UnityInjector.dll
+{GameDirectory}/UnityInjector/XUnity.AutoTranslator.Plugin.UnityInjector.dll
+{GameDirectory}/UnityInjector/XUnity.AutoTranslator.Plugin.ExtProtocol.dll
 {GameDirectory}/UnityInjector/0Harmony.dll
 {GameDirectory}/UnityInjector/ExIni.dll
 {GameDirectory}/UnityInjector/Translators/{Translator}.dll
@@ -325,6 +327,7 @@ The file structure should like like this
 {GameDirectory}/ReiPatcher/ReiPatcher.exe
 {GameDirectory}/{GameExeName}_Data/Managed/ReiPatcher.exe
 {GameDirectory}/{GameExeName}_Data/Managed/XUnity.AutoTranslator.Plugin.Core.dll
+{GameDirectory}/{GameExeName}_Data/Managed/XUnity.AutoTranslator.Plugin.ExtProtocol.dll
 {GameDirectory}/{GameExeName}_Data/Managed/0Harmony.dll
 {GameDirectory}/{GameExeName}_Data/Managed/ExIni.dll
 {GameDirectory}/AutoTranslator/Translators/{Translator}.dll
@@ -384,7 +387,7 @@ TextureHashGenerationStrategy=FromImageName
 This is done through a hash-value that is stored in square brackets in each image file name, like this: `file_name [0223B639A2-6E698E9272].png`. This configuration specifies how these hash-values are generated:
  * `FromImageName` means that the hash is generated from the internal resource name that the game uses for the image, which may not exist for all images or even be unique. However, it is generally fairly reliable. If an image has no resource name, it will not be dumped.
  * `FromImageData` means that the hash is generated from the data stored in the image, which is guaranteed to exist for all images. However, generating the hash comes at a performance cost, that will also be incurred by the end-users.
- * `FromImageNameAndScene` means that it should use the name and scene to generate a hash. The name is still required for this to work. When using this option, there is a chance the same texture could be dumped with different hashes, which is undesirable, but it could be required for some games, if the name itself is not unique and the `FromImageData` option causes performance issues.
+ * `FromImageNameAndScene` means that it should use the name and scene to generate a hash. The name is still required for this to work. When using this option, there is a chance the same texture could be dumped with different hashes, which is undesirable, but it could be required for some games, if the name itself is not unique and the `FromImageData` option causes performance issues. If this is used, it is recommended to enable `EnableTextureScanOnSceneLoad` as well.
 
 There's an important catch you need to be aware when dealing with these options and that is if ANY of these options exists: `EnableTextureDumping=True`, `EnableTextureToggling=True`, `TextureHashGenerationStrategy=FromImageData`, then the game will need to read the raw data from all images it finds in game in order to replace the image and this is an expensive operation.
 
@@ -423,6 +426,8 @@ Here's how it works, and what is required:
     3. IMGUI: public static event Func<object, string, string> OnUnableToTranslateIMGUI
  * Also, the events can be either instance based or static.
 
+Be aware that if you do this, that the hooking functionality of the Auto Translator itself will be disabled. So you are entirely responsible for implementing the required hooks for the overriden text framework.
+
 ### Implementing a component that the Auto Translator should not interfere with
 As a mod author, you might not want the Auto Translator to interfere with your mods UI. If this is the case there's two ways to tell Auto Translator not to perform any translation:
  * If your UI is based on GameObjects, you can simply name your GameObjects containing the text element (for example Text class) to something that contains the string "XUAIGNORE". The Auto Translator will check for this and ignore components that contains the string.
@@ -517,7 +522,7 @@ Whenever you implement a translator based on an online service, it is important
 
 With that in mind, consider the following:
  * The `WWW` class in Unity establishes a new TCP connection on each request you make, making it extremely poor at this kind of job. Especially if SSL (https) is involved because it has to do the entire handshake procedure each time. Yuck.
- * The `UnityWebRequest` class in Unity does not exist in most games, because they use an old engine, so it is not a good choice either.
+ * The `UnityWebRequest` class in Unity does not exist in most games, because the authors use an old engine, so it is not a good choice either.
  * The `WebClient` class from .NET is capable of using persistent connections (it does so by default), but has its own problems with SSL. The version of Mono used in most Unity games rejects all certificates by default making all HTTPS connections fail. This, however, can be remedied during the initialization phase of the translator (see examples below). Another shortcoming of this API is the fact that the runtime will never release the TCP connections it has used until the process ends. The API also integrates terribly with Unity because callbacks return on a background thread.
  * The `WebRequest` class from .NET is essentially the same as WebClient.
  * The `HttpClient` class from .NET is also unlikely to exist in most Unity games.
@@ -647,8 +652,8 @@ After implementing the class, simply build the project and place the generated D
 For more examples of implementations, you can simply take a look at this projects source code.
 
 **NOTE**: If you implement a class based on the `HttpEndpoint` and you get an error where the web request is never completed, then it is likely due to the web server requiring Tls1.2. Unity-mono has issues with this spec and it will cause the request to lock up forever. The only solutions to this for now are:
- * Disable SSL, if you can. There are many sitauations where it is simply not possible to do this because the web server will simply redirect back to the HTTPS endoint.
- * Use the `WwwEndpoint` instead. I do not recommend using this base class unless it is an authenticated endpoint though.
+ * Disable SSL, if you can. There are many situations where it is simply not possible to do this because the web server will simply redirect back to the HTTPS endoint.
+ * Use the `WwwEndpoint` instead. I highly advice against this though, unless it is an authenticated endpoint though.
 
 Another way to implement a translator is to implement the `ExtProtocolEndpoint` class. This can be used to delegate the actual translation logic to an external process. Currently there is no documentation on this, but you can take a look at the LEC implementation, which uses it.
 

+ 2 - 2
src/XUnity.AutoTranslator.Plugin.Core/AutoTranslationPlugin.cs

@@ -2214,7 +2214,7 @@ namespace XUnity.AutoTranslator.Plugin.Core
                {
                   translatedText = job.Key.RepairTemplate( translatedText );
 
-                  if( Settings.RomajiPostProcessing != RomajiPostProcessing.None && Settings.Language == Settings.Romaji )
+                  if( Settings.Language == Settings.Romaji && Settings.RomajiPostProcessing != RomajiPostProcessing.None )
                   {
                      translatedText = RomanizationHelper.PostProcess( translatedText, Settings.RomajiPostProcessing );
                   }
@@ -2288,7 +2288,7 @@ namespace XUnity.AutoTranslator.Plugin.Core
          {
             translatedText = job.Key.RepairTemplate( translatedText );
 
-            if( Settings.RomajiPostProcessing != RomajiPostProcessing.None && Settings.Language == Settings.Romaji )
+            if( Settings.Language == Settings.Romaji && Settings.RomajiPostProcessing != RomajiPostProcessing.None )
             {
                translatedText = RomanizationHelper.PostProcess( translatedText, Settings.RomajiPostProcessing );
             }