Skip to content

Commit

Permalink
Merge pull request #11 from XUnity-Development/prbranch
Browse files Browse the repository at this point in the history
All changes from 2.5.0 -> 2.14.0
  • Loading branch information
bbepis authored Aug 26, 2018
2 parents 2d02719 + 09ea6bc commit 0558622
Show file tree
Hide file tree
Showing 83 changed files with 18,617 additions and 706 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8-bom
insert_final_newline = true
trim_trailing_whitespace = true

# CSharp code style settings:
[*.cs]
indent_size = 3
csharp_space_between_method_call_parameter_list_parentheses = true
csharp_space_between_method_declaration_parameter_list_parentheses = true
csharp_space_between_square_brackets = true
csharp_space_after_keywords_in_control_flow_statements = false
csharp_space_between_parentheses = control_flow_statements, expressions
112 changes: 97 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,91 @@
### 2.14.0
* FEATURE - Dramatically improved the text hooking capability for NGUI to much better handle static elements

### 2.13.1
* BUG FIX - Minor bug fix in rich text parser
* MISC - Enable Rich Text for TextMeshPro
* MISC - Improved whitespace handling with additional configuration option

### 2.13.0
* FEATURE - Support for older Unity Engine versions
* BUG FIX - Respect BepInEx logger config over own config
* BUG FIX - Fix exception that could occur in relation to NGUI
* MISC - Less leniency in what constitutes an error when translating

### 2.12.0
* FEATURE - General support for rich text in relation to UGUI and Utage
* FEATURE - Experimental support for custom fonts for UGUI
* CHANGE - Support only source languages with predefined character checks - for now (ja, zh-CN, zh-TW, ru, ko, en)
* CHANGE - Slightly different translation load priority from files
* BUG FIX - Dramatically improved resize behaviour for NGUI
* BUG FIX - Fixed a bug where hook overrides would not always be honored depending on mod load order
* MISC - 3 additional spam prevention checks
* MISC - Uses BepInLogger for BepInEx implementation (requires 4.0.0+)
* MISC - Redirect "GoogleTranslateHack" to "GoogleTranslate" because instructions were being distributed to use this, and it is not very friendly towards their APIs

### 2.11.0
* FEATURE - Support for legitimate Google Cloud Translate API (requires key)
* BUG FIX - Fixed situations where a text would not be translated on a component if a operation is ongoing on the component
* BUG FIX - Less delay on translation in certain situations
* MISC - Plugin seeded with ~10000 manually translated texts for commonly used translations to avoid hitting the configured endpoint too much (enable or disable with "UseStaticTranslations")
* Only applies when configured for Japanese to English (default)

### 2.10.1
* BUG FIX - Fix to prevent text overflow for large component for UGUI

### 2.10.0
* FEATURE - Support Yandex translate (requires key)
* FEATURE - Support Watson translate (requires key)
* FEATURE - Batching support for selected endpoints (makes translations much faster and requires lesser request)
* FEATURE - Experimental Utage support
* BUG FIX - Fixed minor bug during reading of text translation cache
* BUG FIX - Now escapes the '='-sign in the translation file, so texts containing this character can be translated
* BUG FIX - Fixed kana check when testing if a text is a candidate for translation
* MISC - No longer creating a new thread for each translation
* MISC - Proactive closing of unused TCP connections
* CONFIG - TrimAllText, to indicate whether whitespace in front of and behind translation candidates should be removed
* CONFIG - EnableBatching, to indicate whether batching should be enabled for supported endpoints
* CONFIG - EnableUIResizing, to indicate whether the plugin should make a "best attempt" at resizing the UI upon translation. Current only work for NGUI

### 2.9.1
* 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.

### 2.9.0
* FEATURE - Installation as UnityInjector plugin
* FEATURE - Support Excite translate
* MISC - Better debugging capabilities with extra config options

### 2.8.0
* CHANGE - Whether SSL is enabled or not is now entirely based on chosen endpoint support
* FEATURE - Support for IMGUI translation texts with numbers
* FEATURE - Support for overwriting IMGUI hook events
* BUG FIX - Improved fix for gtrans (23.07.2018) by supporting persistent HTTP connections and cookies and recalculation of TKK and SSL
* BUG FIX - Fixed whitespace handling to honor configuration more appropriately
* BUG FIX - User-interaction (hotkeys) now works when in shutdown mode
* MISC - Prints out to console errors that occurrs during translation
* MISC - IMGUI is still disabled by default. Often other mods UI are implemented in IMGUI. Enabling it will allow those UIs to be translated as well.
* Simply change the config, such that: EnableIMGUI=True

### 2.7.0
* FEATURE - Additional installation instructions for standalone installation through ReiPatcher
* BUG FIX - Fixed a bug with NGUI that caused those texts not to be translated
* BUG FIX - Improved fix for gtrans (23.07.2018)

### 2.6.0
* FEATURE - Support for newer versions of unity engine (those including UnityEngine.CoreModule, etc. in Managed folder)
* BUG FIX - Fix for current issue with gtrans (23.07.2018)
* BUG FIX - Keeps functioning if web services fails, but no requests will be sent in such scenario. Texts will simply be translated from cache
* BUG FIX - Changed hooking, such that if text framework fails, the others wont also fail
* MISC - Concurrency now based on which type of endpoint. For gtrans it is set to 1
* MISC - Bit more leniency in translation queue spam detection to prevent shutdown of plugin under normal circumstances

### 2.5.0
* Various new rate limiting patterns to prevent spam to configured translate endpoint
* Copy to clipboard feature
* FEATURE Copy to clipboard feature
* BUG FIX - Various new rate limiting patterns to prevent spam to configured translate endpoint

### 2.4.1
* Disabled IMGUI hook due to bug
* BUG FIX - Disabled IMGUI hook due to bug

### 2.4.0
* CHANGE - Completely reworked configuration for more organization
Expand All @@ -17,25 +99,25 @@
* BUG FIX - More leniency in allowing text formats (in translation files) to be included as translations

### 2.3.1
* Fixed bug that caused the application to quit if any hooks were overriden.
* BUG FIX - Fixed bug that caused the application to quit if any hooks were overriden.

### 2.3.0
* Allow usage of SSL
* Better dialogue caching handling. Often a dialogue might get translated multiple times because of small differences in the source text in regards to whitespace.
* FEATURE - Allow usage of SSL
* BUG FIX - Better dialogue caching handling. Often a dialogue might get translated multiple times because of small differences in the source text in regards to whitespace.

### 2.2.0
* Added anti-spam safeguards to web requests that are sent. What it means: The plugin will no longer be able to attempt to translate a text it already considers translated.
* Changed internal programmatic HTTP service provider from .NET WebClient to Unity WWW.
* MISC - Added anti-spam safeguards to web requests that are sent. What it means: The plugin will no longer be able to attempt to translate a text it already considers translated.
* MISC - Changed internal programmatic HTTP service provider from .NET WebClient to Unity WWW.

### 2.1.0
* Fixed a bug that could cause a StackOverflowException in unfortunate scenarios, if other mods interfered.
* Added configuration options to control which text frameworks to translate
* Added integration feature that allows other translation plugins to use this plugin as a fallback
* MUCH improved dialogue handling. Translations for dialogues should be significantly better than 2.0.1
* FEATURE - Added configuration options to control which text frameworks to translate
* FEATURE - Added integration feature that allows other translation plugins to use this plugin as a fallback
* BUG FIX - Fixed a bug that could cause a StackOverflowException in unfortunate scenarios, if other mods interfered.
* BUG FIX - MUCH improved dialogue handling. Translations for dialogues should be significantly better than 2.0.1

### 2.0.1
* Changed configuration path so to not conflict with the configuration files that other mods uses, as it does not use the shared configuration system. The previous version could override configuration from other mods.
* General performance improvements.
* BUG FIX - Changed configuration path so to not conflict with the configuration files that other mods uses, as it does not use the shared configuration system. The previous version could override configuration from other mods.
* MISC - General performance improvements.

### 2.0.0
* The initial release
* Initial release
95 changes: 85 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
# XUnity Auto Translator
# XUnity Auto Translator

## Text Frameworks
This is an auto translation mod that hooks into the unity game engine and attempts to provide translations for the following text frameworks for Unity:
* UGUI
* NGUI
* TextMeshPro
* IMGUI
* TextMeshPro
* Utage (VN Game Engine)

It does go to the internet, in order to provide the translation, so if you are not comfortable with that, dont use it.

## Plugin Frameworks
The mod can be installed into the following Plugin Managers:
* [BepInEx](https://github.com/bbepis/BepInEx)
* [IPA](https://github.com/Eusth/IPA)
* UnityInjector

Installations instructions for both 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.4.0+):
The default configuration file, looks as such (2.6.0+):

```ini
[Service]
Endpoint=GoogleTranslate ;Endpoint to use. Can be ["GoogleTranslate", "BaiduTranslate"]
EnableSSL=False ;Whether or not to use HTTPS endpoint over standard HTTP
Endpoint=GoogleTranslate ;Endpoint to use. Can be ["GoogleTranslate", "GoogleTranslateLegitimate", "BaiduTranslate", "YandexTranslate", "WatsonTranslate", "ExciteTranslate"]

[General]
Language=en ;The language to translate into
Expand All @@ -42,18 +45,45 @@ AllowPluginHookOverride=True ;Allow other text translation plugins to overri
[Behaviour]
Delay=0 ;Delay to wait before attempting to translate a text in seconds
MaxCharactersPerTranslation=150 ;Max characters per text to translate
IgnoreWhitespaceInDialogue=True ;Whether or not to ignore whitespace, such as newlines, in dialogue keys
IgnoreWhitespaceInDialogue=True ;Whether or not to ignore whitespace, including newlines, in dialogue keys
IgnoreWhitespaceInNGUI=True ;Whether or not to ignore whitespace, including newlines, in NGUI
MinDialogueChars=20 ;The length of the text for it to be considered a dialogue
ForceSplitTextAfterCharacters=0 ;Split text into multiple lines once the translated text exceeds this number of characters
CopyToClipboard=False ;Whether or not to copy hooked texts to clipboard
MaxClipboardCopyCharacters=450 ;Max number of characters to hook to clipboard at a time
EnableUIResizing=True ;Whether or not the plugin should provide a "best attempt" at resizing UI components upon translation. Only work for NGUI
EnableBatching=True ;Indicates whether batching of translations should be enabled for supported endpoints
TrimAllText=True ;Indicates whether spaces in front and behind translation candidates should be removed before translation
UseStaticTranslations=True ;Indicates whether or not to use translations from the included static translation cache
OverrideFont= ;Overrides the fonts used for texts when updating text components. NOTE: Only works for UGUI
WhitespaceRemovalStrategy=TrimPerNewline ;Indicates how whitespace/newline removal should be handled before attempting translation. Can be ["TrimPerNewline", "AllOccurrences"]

[Http]
UserAgent= ;Override the user agent used by APIs requiring a user agent

[GoogleLegitimate]
GoogleAPIKey= ;OPTIONAL, needed if GoogleTranslateLegitimate is configured

[Baidu]
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
EnableLog=False ;Enables extra logging for debugging purposes

[Migrations]
Enable=True ;Used to enable automatic migrations of this configuration file
Tag=2.9.0 ;Tag representing the last version this plugin was executed under. Do not edit
```

## Key Mapping
Expand All @@ -68,10 +98,10 @@ The plugin can be installed in following ways:
### BepInEx Plugin
REQUIRES: [BepInEx plugin manager](https://github.com/bbepis/BepInEx) (follow its installation instructions first!).

1. Download XUnity.AutoTranslator-BepIn-{VERSION}.zip from [releases](https://github.com/bbepis/XUnity.AutoTranslator/releases).
1. Download XUnity.AutoTranslator-BepIn-{VERSION}.zip from [releases](../../releases).
2. Extract directly into the game directory, such that the plugin dlls are placed in BepInEx folder.

The file structure should likke like this:
The file structure should like like this:
```
{GameDirectory}/BepInEx/XUnity.AutoTranslator.Plugin.Core.dll
{GameDirectory}/BepInEx/XUnity.AutoTranslator.Plugin.Core.BepInEx.dll
Expand All @@ -82,10 +112,10 @@ The file structure should likke like this:
### IPA Plugin
REQUIRES: [IPA plugin manager](https://github.com/Eusth/IPA) (follow its installation instructions first!).

1. Download XUnity.AutoTranslator-IPA-{VERSION}.zip from [releases](https://github.com/bbepis/XUnity.AutoTranslator/releases).
1. Download XUnity.AutoTranslator-IPA-{VERSION}.zip from [releases](../../releases).
2. Extract directly into the game directory, such that the plugin dlls are placed in Plugins folder.

The file structure should likke like this
The file structure should like like this
```
{GameDirectory}/Plugins/XUnity.AutoTranslator.Plugin.Core.dll
{GameDirectory}/Plugins/XUnity.AutoTranslator.Plugin.Core.IPA.dll
Expand All @@ -94,6 +124,50 @@ The file structure should likke like this
{GameDirectory}/Plugins/Translation/AnyTranslationFile.txt (this files will be auto generated by plugin!)
```

### UnityInjector Plugin
REQUIRES: UnityInjector (follow its installation instructions first!).

1. Download XUnity.AutoTranslator-UnityInjector-{VERSION}.zip from [releases](../../releases).
2. Extract directly into the game directory, such that the plugin dlls are placed in UnityInjector folder. **This may not be game root directory!**

The file structure should like like this
```
{GameDirectory}/UnityInjector/XUnity.AutoTranslator.Plugin.Core.dll
{GameDirectory}/UnityInjector/XUnity.AutoTranslator.Plugin.Core.UnityInjector.dll
{GameDirectory}/UnityInjector/0Harmony.dll
{GameDirectory}/UnityInjector/ExIni.dll
{GameDirectory}/UnityInjector/Translation/AnyTranslationFile.txt (this files will be auto generated by plugin!)
```

### Standalone Installation (ReiPatcher)
REQUIRES: Nothing, ReiPatcher is provided by this download.

1. Download XUnity.AutoTranslator-ReiPatcher-{VERSION}.zip from [releases](../../releases).
2. Extract directly into the game directory, such that "SetupReiPatcherAndAutoTranslator.exe" is placed alongside other exe files.
3. Execute "SetupReiPatcherAndAutoTranslator.exe". This will setup up ReiPatcher correctly.
4. Execute the shortcut {GameExeName}.lnk that was created besides existing executables. This will patch and launch the game.
5. From now on you can launch the game from the {GameExeName}.exe instead.

The file structure should like like this
```
{GameDirectory}/ReiPatcher/Patches/XUnity.AutoTranslator.Patcher.dll
{GameDirectory}/ReiPatcher/ExIni.dll
{GameDirectory}/ReiPatcher/Mono.Cecil.dll
{GameDirectory}/ReiPatcher/Mono.Cecil.Inject.dll
{GameDirectory}/ReiPatcher/Mono.Cecil.Mdb.dll
{GameDirectory}/ReiPatcher/Mono.Cecil.Pdb.dll
{GameDirectory}/ReiPatcher/Mono.Cecil.Rocks.dll
{GameDirectory}/ReiPatcher/ReiPatcher.exe
{GameDirectory}/{GameExeName}_Data/Managed/ReiPatcher.exe
{GameDirectory}/{GameExeName}_Data/Managed/XUnity.AutoTranslator.Plugin.Core.dll
{GameDirectory}/{GameExeName}_Data/Managed/0Harmony.dll
{GameDirectory}/{GameExeName}_Data/Managed/ExIni.dll
{GameDirectory}/AutoTranslator/AnyTranslationFile.txt (this files will be auto generated by plugin!)
```

## Translating Mods
Often other mods UI are implemented through IMGUI. As you can see above, this is disabled by default. By changing the "EnableIMGUI" value to "True", it will start translating IMGUI as well, which likely means that other mods UI will be translated.

## Integrating with Auto Translator
I have implemented a system that allows other dedicated translation mods to integrate with XUnity AutoTranslator.

Expand All @@ -109,4 +183,5 @@ Here's how it works, and what is required:
1. UGUI: public static event Func<object, string, string> OnUnableToTranslateUGUI
2. TextMeshPro: public static event Func<object, string, string> OnUnableToTranslateTextMeshPro
3. NGUI: public static event Func<object, string, string> OnUnableToTranslateNGUI
3. IMGUI: public static event Func<object, string, string> OnUnableToTranslateIMGUI
* Also, the events can be either instance based or static.
Loading

0 comments on commit 0558622

Please sign in to comment.