Quantcast
Download
(18 Kb)
Download
Updated: 08/02/20 01:36 PM
Compatibility:
Stonethorn (6.1.0)
Greymoor (6.0.5)
Updated:08/02/20 01:36 PM
Created:12/25/19 03:15 AM
Monthly downloads:33
Total downloads:201
Favorites:1
MD5:
6.0.5
eso-azure-translate
Version: 2.0.3
by: AlbinoPython [More]
eso-azure-translate
Have you ever wanted to store all of your addon strings in a JSON file? You are in luck because this small Node utility that uses Azure Cognitive Services to translate English strings to any language and generates the corresponding Lua files. Supports all languages defined from this endpoint though the abbreviations may not match as expected. Please let me know if anyone finds one.

This is just the TypeScript source code and other misc files. See installation instructions below or use link above for the latest published version on NPMJS

Tested so far with German (DE), French (FR), Japanese (JA), Russian (RU)

Install
Code:
npm install -g eso-azure-translate
Help
Code:
eso-azure-translate --help
Parameters
  • --inputDir
    Directory that contains en.json and the language overrides. For example, entries in a fr.json file will be used to override any French translations returned by Azure.



  • --outputDir
    This is where your Lua files will end up. Every entry in en.json will get a
    Code:
    ZO_CreateStringId("VAR_NAME", "Some translated text")
    line of code in the corresponding Lua file



  • --langs
    Target languages to translate to. Example usage to translate to French, German, Russian, and Japanese:
    Code:
    eso-azure-translate --inputDir strings --outputDir lang --langs "fr,de,ru,ja"



  • --key
    You will need to authenticate to Azure. Once you get a key it is recommended to set it as an environment variable. Otherwise this parameter can be used

Prepare
  1. Create English source file

    en.json
    Code:
    {
      "STR_1": "A random string",
      "STR_2": "Some other string ",
      "SI_BINDING_NAME_SOME_BINDING": "Some binding name"
    }
  2. Bring your own translations. Machine translations can be bad sometimes. If you already have good translations you can override.
    fr.json
    Code:
    {
      "STR_2": "We are pretending this is a better French translation than Azure can give us"
    }
  3. Set ESO_TRANSLATOR environment variable with the key used to access the Azure services. Otherwise you can pass the token on the command line but that is not recommended.

Run
Code:
eso-azure-translate --inputDir test --outputDir lang --langs "fr,de,ru,ja"
Output

lang/en.lua
Code:
ZO_CreateStringId("STR_1", "A random string")
ZO_CreateStringId("STR_2", "Some other string ")
ZO_CreateStringId("SI_BINDING_NAME_SOME_BINDING", "Some binding name")
lang/de.lua
Code:
ZO_CreateStringId("STR_1", "Eine zufällige Zeichenfolge")
ZO_CreateStringId("STR_2", "Einige andere Zeichenfolgen ")
ZO_CreateStringId("SI_BINDING_NAME_SOME_BINDING", "Einige Bindungsnamen")
lang/fr.lua
Code:
ZO_CreateStringId("STR_1", "Une chaîne aléatoire")
ZO_CreateStringId("STR_2", "We are pretending this is a better French translation than Azure can give us")
ZO_CreateStringId("SI_BINDING_NAME_SOME_BINDING", "Un nom de liaison")
lang/ja.lua
Code:
ZO_CreateStringId("STR_1", "ランダムな文字列")
ZO_CreateStringId("STR_2", "その他の文字列")
ZO_CreateStringId("SI_BINDING_NAME_SOME_BINDING", "いくつかのバインディング名")
lang/ru.lua
Code:
ZO_CreateStringId("STR_1", "Случайная строка")
ZO_CreateStringId("STR_2", "Некоторые другие строки ")
ZO_CreateStringId("SI_BINDING_NAME_SOME_BINDING", "Некоторое обязательное имя")
2 August 2020
Reduce payload sizes

1 August 2020
Added ability to translate to arbitrary languages
Added language overrides

26 December 2019
Add description
Sync published version with esoui version

25 December 2019
Initial release
Optional Files (0)


Archived Files (3)
File Name
Version
Size
Uploader
Date
2.0.3
18kB
AlbinoPython
08/01/20 08:55 PM
2.0.3
13kB
AlbinoPython
12/26/19 04:36 PM
1.0.10
12kB
AlbinoPython
12/25/19 03:15 AM


Post A Reply Comment Options
Unread 12/28/19, 10:58 AM  
AlbinoPython
AddOn Author - Click to view AddOns

Forum posts: 10
File comments: 47
Uploads: 10
I am not clear on exactly what that method would do for me. eso-azure-translate does not run in-game. It is meant to be used while developing an add on. You can store all of your strings in a JSON file (see Provinatus' strings file) and then run this utility to generate German and French translations using Azure's services. It then auto-generates the corresponding Lua files. (see Provinatus' lang folder)
Report comment to moderator  
Reply With Quote
Unread 12/27/19, 03:56 AM  
Micke2nd
AddOn Author - Click to view AddOns

Forum posts: 43
File comments: 76
Uploads: 1
Following the API def you can change the current language for labels & other strings with
Code:
   /script SetCVar("language.2","en")
.
I thought this switch could help to get the indeed in-game wording either immediately or with a exported dictionary as intermediate step.
Doesn't this deliver what you need ? An external service won't presumably be failure free.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: