Subterfuge-Revived / Remake-Unity

User interface for the application made with Unity
Creative Commons Zero v1.0 Universal
17 stars 11 forks source link

Localization #17

Open QuinnBast opened 4 years ago

QuinnBast commented 4 years ago

We will need to store all app strings and text within a localization file in order to allow the application to be translated into other languages. A program called "Zeta" (? don't remember atm) is a localization tool that can auto-generate localization files by using a google translate API key. Google translate API key only works on I think 1000 translations until you need to pay so we can likely just wait until we are ready to release and generate the key at that time to localize the app before release. If any other tools are known then let us know.

QuinnBast commented 4 years ago

@tavurth commented:

Suggestion: Wrap all text to be translated inside your app with a stub translate function:

def translate(stringToTranslate):
    return stringToTranslate

Use it like this:

translate("This string will be translated when we're ready")

Then when you're ready to build the list you simply have to search the project for instances of translate()

Eliclax commented 4 years ago

Can we consider another name to avoid confusion with Unity's translate()?

pisanovo commented 4 years ago

Suggestion: Use crowdin - Community generated translation has advantages over Google Translate API or similar.

QuinnBast commented 4 years ago

Agreed with the crowd-sourced translation tool, that's a great idea.

Could use this unity plugin with a google spreadsheet to get community input as well: https://assetstore.unity.com/packages/tools/localization/i2-localization-14884

tavurth commented 4 years ago

Nice idea about crowd sourced translation.

A google form could be built and attached to the sheet, allowing users to simply visit a url and be presented with a simple translation task.

A separate form could also be used to fetch and check a random sampling of translations (review mode)

pisanovo commented 4 years ago

One advantage using crowdin would be the GitHub integration which automatically fetches the source language and updates foreign languages when a translation is approved.

It's also free for open source projects. Working with Google forms might get a bit difficult with many strings and different languages.

QuinnBast commented 4 years ago

The plugin I mentioned above is unfortunately $45. However....

https://developers.google.com/sheets/api/quickstart/dotnet

We can save some money by just making our own version of the plugin. It probably won’t be as in depth as the unity plugin but it should work. We just need to make sure all text components are set using our implementation of this API to allow switching language. Could probably make a prefab text component that auto translates based on value selected from an enum(?). I will start looking into this this weekend since this is pretty important

QuinnBast commented 4 years ago

Moving to unity repository as this doesn’t effect core

QuinnBast commented 4 years ago

Implemented the translator and game string enums. The only remaining part of this is to set up crowdin with the appropriate GameStrings for translation.

Once this is done there are a few alternatives:

Ideally, we would probably want to do uploads of our translation strings to the server and have the server provide an endpoint for us to just load the strings when the app starts.

QuinnBast commented 4 years ago

With the pull request, a base framework for translating text has been created.

TODOs still include:

QuinnBast commented 3 years ago

This is done now that crodin has been merged :)

Some TODOs remain:

When sending text back from the server, instead of sending a textual response, send back a string encoded as a Translaction string. For example:

details: "ERROR_CANNOT_LOGIN"

Then in unity we can do something like:

if(!message.isSuccess) {
    text.text = Translate(GameStrings.parseFrom(message.details));
}

This would allow Unity to translate errors into the user's language as well.