Skip to content

Sugoi Translator addon for Translator++ by Dreamsavior.

License

Notifications You must be signed in to change notification settings

reddo9999/transRedSugoi

Repository files navigation

transRedSugoi

transRedSugoi is Translation Engine for Translator++ by Dreamsavior. Initially only functioned with Sugoi Translator, but it evolved into a general-use Translator Engine that can be extended for any translator supported by Translator++.

What are translation engines?

The default Translation Engines are somewhat simple: they get the rows to translate, they do some escaping using the default algorithms, and then off it goes to the translator itself and back. This works well, most of the time. But every translator has its own Translator Engine and changes need to be made for all of them.

How does transRedSugoi do it?

A Translation Engine class was created. This class handles the rows, and the translator-specific code no longer has to care about that. This allows the translator code to focus only on the translation process itself. This is also true about the text processing: every translator in transRedSugoi deals with the text in the exact same way, the only part that changes is where they get the translations from (as of 0.29, we have Sugoi Translator and Google Translator). So we can easily change how text gets processed and have it spread to every translator.

How does this help?

It becomes exceedingly trivial to add new escaping placeholder types (we had 10 as of 0.29!), as well as adding new kinds of text processing. And since every translator uses the same base classes, additions are immediately available to all translators. These are the current global options we have:

  • Text processing: To get better results, as well as faster results, we split Rows by paragraphs. This is done in three steps: first we split on multiple empty lines; then we split when a line ends with something that also ends a sentence (like a dot, or an exclamation mark); finally we also split when a line begins with something that starts a sentence (like quotes, parenthesis, etc).
  • Code Escaping Algorithm: Each translator can use a different placeholder style. These placeholders are symbols that most translators will maintain through the translation process, which allows us to bring back the original, untranslated text for a portion of the final result (useful when script commands are being executed in the middle of the code - translating these would break things).
  • Merge Escaped Symbols: Besides escaping symbols and replacing them with placeholders, we can also escape multiple sequential placeholders with a single one, resulting in better translations.
  • Split Ends/Cut Corners: If escaped symbols are at the corners of the sentence, we can strip them before sending to the translator, which means these symbols will never be lost in the translation process.
  • Cache: Every time a translation is sent to the translator, we store the translation it made. Since we also have text processing, we end up with smaller sentences, and therefore we can get a lot of repetition in most use-cases.
  • Literal String Detection: Sometimes what is being translated is a script, so it's pretty much a coded string. Translating these used to be a problem, as the string could be broken during translation. This option adds additional processing before and after the translation so that it not only remains a valid string afterwards, but even uses the same quote style as it did before being translated.

What are the goals for transRedSugoi?

Reliability and speed. The first goal is for translations to be reliable in the sense that they won't damage any scripts and that symbols will be properly maintained after translation. Speed is mostly a consequence of handling texts with more care - you begin sending less characters to the translator, it speeds up in response, though we also care about how we send them to the translator as to maximize efficiency. A third goal would be translation quality - a lot of the text processing is done with the goal of sending smaller sentences which translators are better able to handle, but this also results in better translations.

Main differences with the default Translator Engines

  • Our escaping system is very thorough. We will loop through the custom escaper patterns as long as we find something to escape. This also means that it's possible for an user to have escape patterns that result in a pattern another escape pattern detects, and we can also have nested escaped symbols.
  • There isn't any actual text processing happening with the default Translator Engines, so our text processing can bring huge differences in how translations happen - we are not sending the same text to the translator, ours is smaller sentences, rather than the full row. In most cases, this will be a positive difference.
  • While the default Translator Engines had support to a manually curated cache, redSugoiTrans has an automatic cache every time it translates anything - and we never translate the same sentence twice. Depending on how often a sentence appears, this can result in huge speedups.

About

Sugoi Translator addon for Translator++ by Dreamsavior.

Resources

License

Stars

Watchers

Forks

Packages

No packages published