Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization #17

Open
QuinnBast opened this issue Apr 11, 2020 · 11 comments
Open

Localization #17

QuinnBast opened this issue Apr 11, 2020 · 11 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@QuinnBast
Copy link
Contributor

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
Copy link
Contributor Author

@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
Copy link
Contributor

Eliclax commented Apr 11, 2020

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

@pisanovo
Copy link
Contributor

pisanovo commented Apr 11, 2020

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

@QuinnBast
Copy link
Contributor Author

QuinnBast commented Apr 11, 2020

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
Copy link

tavurth commented Apr 12, 2020

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
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

Moving to unity repository as this doesn’t effect core

@QuinnBast QuinnBast transferred this issue from Subterfuge-Revived/Remake-Core Apr 24, 2020
@QuinnBast QuinnBast added enhancement New feature or request help wanted Extra attention is needed labels Apr 24, 2020
@QuinnBast
Copy link
Contributor Author

QuinnBast commented Apr 24, 2020

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:

  • Have the backend send the whole file & load the file when the game starts
    • Pro: Translations always available if server up.
    • Con: More backend work. If server down, text strings are the default.
  • Use the google sheets api to read a google sheet
    • Pro: Dynamic updates to translations
    • Con: If google is down, all strings are dead. Need to link the cell number # the key.
  • Translation file packaged with app
    • Pro: Reliable
    • Con: Requires update to change.

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 QuinnBast mentioned this issue May 4, 2020
14 tasks
@QuinnBast
Copy link
Contributor Author

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

TODOs still include:

  • Backend server to provide localization file as text
  • Localization class should include a parser and convert the localization file into C# objects for language updates
  • Localization class should send an API request to the backend to get localization files. (while testing just send an example of the csv as a string.)
  • crowdin website should be updated with the correct game strings.
  • Localization could potentially store the language strings to the user's device so that if the user is offline they can use a cached version on the device.

@QuinnBast
Copy link
Contributor Author

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.

@QuinnBast QuinnBast added this to TODO in Subterfuge Remake via automation Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Development

No branches or pull requests

4 participants