ソースを参照

Revert "disabled yandex+watson"

This reverts commit 5991775137ce836c52f8c7f9747126d318b1f5dc.
Scrublord1336 6 年 前
コミット
2d07107b60

+ 3 - 1
CHANGELOG.md

@@ -1,4 +1,6 @@
-### 2.9.1
+### 2.10.0
+ * FEATURE - Support Yandex translate (requires key)
+ * FEATURE - Support Watson translate (requires key)
  * MISC - Added automatic configuration migration support
    * Versions of this plugin were being distributed with predefined configuration to target "GoogleTranslateHack". The first time the plugin is run under this version, it will change this value back to the default.
 

+ 9 - 1
README.md

@@ -24,7 +24,7 @@ The default configuration file, looks as such (2.6.0+):
 
 ```ini
 [Service]
-Endpoint=GoogleTranslate         ;Endpoint to use. Can be ["GoogleTranslate", "BaiduTranslate", "GoogleTranslateHack", "ExciteTranslate"]
+Endpoint=GoogleTranslate         ;Endpoint to use. Can be ["GoogleTranslate", "BaiduTranslate", "GoogleTranslateHack", "YandexTranslate", "WatsonTranslate", "ExciteTranslate"]
 
 [General]
 Language=en                      ;The language to translate into
@@ -54,6 +54,14 @@ MaxClipboardCopyCharacters=450   ;Max number of characters to hook to clipboard
 BaiduAppId=                      ;OPTIONAL, needed if BaiduTranslate is configured
 BaiduAppSecret=                  ;OPTIONAL, needed if BaiduTranslate is configured
 
+[Yandex]
+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
+
 [Debug]
 EnablePrintHierarchy=False       ;Used for debugging
 EnableConsole=False              ;Enables the console. Do not enable if other plugins (managers) handles this

+ 4 - 4
src/XUnity.AutoTranslator.Plugin.Core/Configuration/Settings.cs

@@ -97,11 +97,11 @@ namespace XUnity.AutoTranslator.Plugin.Core.Configuration
          BaiduAppId = Config.Current.Preferences[ "Baidu" ][ "BaiduAppId" ].GetOrDefault( "" );
          BaiduAppSecret = Config.Current.Preferences[ "Baidu" ][ "BaiduAppSecret" ].GetOrDefault( "" );
 
-         //YandexAPIKey = Config.Current.Preferences[ "Yandex" ][ "YandexAPIKey" ].GetOrDefault( "" );
+         YandexAPIKey = Config.Current.Preferences[ "Yandex" ][ "YandexAPIKey" ].GetOrDefault( "" );
 
-         //WatsonAPIUrl = Config.Current.Preferences[ "Watson" ][ "WatsonAPIUrl" ].GetOrDefault( "" );
-         //WatsonAPIUsername = Config.Current.Preferences[ "Watson" ][ "WatsonAPIUsername" ].GetOrDefault( "" );
-         //WatsonAPIPassword = Config.Current.Preferences[ "Watson" ][ "WatsonAPIPassword" ].GetOrDefault( "" );
+         WatsonAPIUrl = Config.Current.Preferences[ "Watson" ][ "WatsonAPIUrl" ].GetOrDefault( "" );
+         WatsonAPIUsername = Config.Current.Preferences[ "Watson" ][ "WatsonAPIUsername" ].GetOrDefault( "" );
+         WatsonAPIPassword = Config.Current.Preferences[ "Watson" ][ "WatsonAPIPassword" ].GetOrDefault( "" );
 
          EnablePrintHierarchy = Config.Current.Preferences[ "Debug" ][ "EnablePrintHierarchy" ].GetOrDefault( false );
          EnableConsole = Config.Current.Preferences[ "Debug" ][ "EnableConsole" ].GetOrDefault( false );

+ 4 - 4
src/XUnity.AutoTranslator.Plugin.Core/KnownEndpoints.cs

@@ -21,10 +21,10 @@ namespace XUnity.AutoTranslator.Plugin.Core
                return new GoogleTranslateHackEndpoint();
             case KnownEndpointNames.BaiduTranslate:
                return new BaiduTranslateEndpoint();
-            //case KnownEndpointNames.YandexTranslate:
-            //   return new YandexTranslateEndpoint();
-            //case KnownEndpointNames.WatsonTranslate:
-            //   return new WatsonTranslateEndpoint();
+            case KnownEndpointNames.YandexTranslate:
+               return new YandexTranslateEndpoint();
+            case KnownEndpointNames.WatsonTranslate:
+               return new WatsonTranslateEndpoint();
             case KnownEndpointNames.ExciteTranslate:
                return new ExciteTranslateEndpoint();
             default: