Переглянути джерело

Version 3.0.0

 * FEATURE - UI to control plugin more conveniently (press ALT + 0 (that's a zero))
 * FEATURE - Dynamic selection of translator during game session
 * FEATURE - Support BingTranslate API
 * FEATURE - Support LEC Offline Power Translator 15
 * FEATURE - Enable custom implementations of translators
 * FEATURE - Removed support for Excite translate because it only support the 'WWW' API in Unity due to missing Tls1.2 support
 * FEATURE - Updated Watson translate to v3
 * FEATURE - Support for 'romaji' as output language. Only google supports this at the moment
 * FEATURE - Batching support for all endpoints where the API supports it
 * BUG FIX - Too many small fixes to mention
 * MISC - {GameExeName} variable can now be used in configuration of directories and files
 * MISC - Changed the way the 'Custom' endpoint works. See README for more info
 * MISC - Added new configuration 'GameLogTextPaths' to enable special handling of text components that text is being appended to continuously (requires export knowledge to setup)
randoman 6 роки тому
батько
коміт
11108f0565

+ 2 - 1
README.md

@@ -518,6 +518,7 @@ Often an implementation of this interface will access an external web service. I
 Whenever you implement a translator based on an online service, it is important to not use it in an abusive way. For example by:
  * Establishing a large number of connections to it
  * Performing web scraping instead of using an available API
+ * Making concurrent requests towards it
  * *This is especially important if the service is not authenticated*
 
 With that in mind, consider the following:
@@ -653,7 +654,7 @@ For more examples of implementations, you can simply take a look at this project
 
 **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 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.
+ * Use the `WwwEndpoint` instead. I highly advice against this though, unless it is an authenticated endpoint.
 
 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 - 0
src/Translators/Lec.ExtProtocol/Program.cs

@@ -10,6 +10,8 @@ namespace Lec.ExtProtocol
    {
       static void Main( string[] args )
       {
+         // Implementation of this is based off of texel-sensei's LEC implementation
+
          try
          {
             if( args.Length == 0 )

+ 1 - 1
src/XUnity.AutoTranslator.Plugin.Core/Endpoints/Http/HttpEndpoint.cs

@@ -24,7 +24,7 @@ namespace XUnity.AutoTranslator.Plugin.Core.Endpoints.Http
       /// Gets the maximum concurrency for the endpoint. This specifies how many times "Translate"
       /// can be called before it returns.
       /// </summary>
-      public virtual int MaxConcurrency => 1;
+      public int MaxConcurrency => 1;
 
       /// <summary>
       /// Gets the maximum number of translations that can be served per translation request.

+ 4 - 3
src/XUnity.AutoTranslator.Plugin.Core/Endpoints/Www/WwwEndpoint.cs

@@ -7,6 +7,7 @@ using System.Text;
 using Harmony;
 using UnityEngine;
 using XUnity.AutoTranslator.Plugin.Core.Configuration;
+using XUnity.AutoTranslator.Plugin.Core.Constants;
 using XUnity.AutoTranslator.Plugin.Core.Web;
 
 namespace XUnity.AutoTranslator.Plugin.Core.Endpoints.Www
@@ -19,7 +20,7 @@ namespace XUnity.AutoTranslator.Plugin.Core.Endpoints.Www
    /// </summary>
    public abstract class WwwEndpoint : ITranslateEndpoint
    {
-      private static readonly ConstructorInfo WwwConstructor = Constants.ClrTypes.WWW.GetConstructor( new[] { typeof( string ), typeof( byte[] ), typeof( Dictionary<string, string> ) } );
+      private static readonly ConstructorInfo WwwConstructor = ClrTypes.WWW.GetConstructor( new[] { typeof( string ), typeof( byte[] ), typeof( Dictionary<string, string> ) } );
 
       /// <summary>
       /// Gets the id of the ITranslateEndpoint that is used as a configuration parameter.
@@ -112,11 +113,11 @@ namespace XUnity.AutoTranslator.Plugin.Core.Endpoints.Www
          yield return www;
 
          // extract error
-         string error = (string)AccessTools.Property( Constants.ClrTypes.WWW, "error" ).GetValue( www, null );
+         string error = (string)AccessTools.Property( ClrTypes.WWW, "error" ).GetValue( www, null );
          if( error != null ) wwwContext.Fail( "Error occurred while retrieving translation. " + error );
 
          // extract text
-         var text = (string)AccessTools.Property( Constants.ClrTypes.WWW, "text" ).GetValue( www, null );
+         var text = (string)AccessTools.Property( ClrTypes.WWW, "text" ).GetValue( www, null );
          if( text == null ) wwwContext.Fail( "Error occurred while extracting text from response." ); 
 
          wwwContext.ResponseData = text;