Before I buy - will I be able to localize lists?

More
8 years 4 months ago #1672 by Sarr
Hello,

I'm looking for best possible localization system for a game with lots of text, but easy to use (we're making our first game).
I need to be able to easily quickly do 2 things:

1. Translate loads of text which are coming from scripts (are generated in game) based on state-machines and if statements.
So I just need to be able to translate text which comes not from UnityUI, but from the script into UnityUI Text components.
Is it possible, is it much coding?
2. I need to be able to translate strings on the lists. For example, equipment. We're importing that into UnityUI dynamically, depending on the list contents, and we need to translate each position. So, character may have "Inventory", which would be a text component in UnityUI, and the content would change depending on what items character has on the list. Each check of inventory (open the window, etc) would import strings from the generic list of inventory items and this should be translated instantly.

If that's all possible and not a headache, I'm buying your system right away.

Thanks,
Sarr

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago - 8 years 4 months ago #1673 by Frank

1. Translate loads of text which are coming from scripts (are generated in game) based on state-machines and if statements.


If you need to translate strings in code, you can do it in one of two ways:

- You can add the terms to your I2Languages.prefab (e.g. "PowerUp Bomb" -> translated into all your languages),
then do
var translatedText = ScriptLocalization.Get("PowerUp Bomb");   // translatedText will get the translation into the current language.

- If you need to translate dynamic strings (fully generated in game), you can use In-Game-Dynamic-Translation.


That will query Google Translator and return the translation to any language you need.

2. I need to be able to translate strings on the lists


you could either manually translate each element of the list using ScriptLocalization.Get
List<string> yourList = ....
List<string> translatedList = yourList.Select (x=> ScriptLocalization.Get(x) ).ToList();

of, you could have a list with all your TERMS (e.g. "POWERUP_Bomb", "POWERUP_Speed", etc)

Then, the text component that will display the content of the list should have a Localize component.

and finally, instead of doing:
Text text = GetComponent<UI.Text>();
text.text = yourList[0];

do
Text text = GetComponent<UI.Text>();
text.GetComponent<Localize>().SetTerm( yourList[0] );    // this will automatically set the text to the translated value of yourList[0]

Also, if you need to translate a Dropdown list, there is a built in support: Just add a LocalizeDropdown component to that object and select the term for each element in the list.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Last edit: 8 years 4 months ago by Frank.
The following user(s) said Thank You: Sarr

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #1674 by Sarr
Yes, that really helps :). We don't have any text "made up" by game or players yet, so it's only static text being pulled from scripts into UI, if it's on the list, etc.

Also, I think we should be able to make some terms filled with maybe whole pages of text in your plugin, so those terms will insert whole of that text into UnityUI Text component.
For example, I would use "_intro_text" or some other string as a term, and it would pull whole page of text from your asset in right language. Would it work?
Is there enough space in your Asset's UI to insert such page-long translation of a single term?

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #1675 by Frank

For example, I would use "_intro_text" or some other string as a term, and it would pull whole page of text from your asset in right language. Would it work?


That will work. Thats the same some developers are using for their tutorials, helps and legal info.
- Just add a term to the I2Languages.prefab (e.g. "Legal Info")
- then, for every language, add the whole text.
- Add a Localize component to your UI.Text object and select the term "Legal Info".

The text of that object will automatically update to show the translated text you set for the current language. If the users changes languages, the text will be updated automatically.

Is there enough space in your Asset's UI to insert such page-long translation of a single term?


The plugins uses a TextArea that grows depending on your content. So, you can accommodate any amount of text.
However, if its too difficult to write the text in the Editor or it gets too big, then you could use a Spreadsheet to edit your translations and Import/Export from Google or CSV to keep I2Languages.prefab synchronized with the spreadsheet.

The good thing about linking with a Google Spreadsheet, is that after you submit your game, if you make a change in the spreadsheet, your game will automatically detect it and download the changes :-)

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The following user(s) said Thank You: Sarr

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago - 8 years 4 months ago #1676 by Sarr
That's great :). Certainly google spreadsheets then. So one last question:

What if I have the content of the list added to the text component. Now, player opens the panel, and just sees his equipment items as words like this:

_sword, _chain_mail, _shield, _an_orange.

This is stored as a variable and is visible in Unity's editor as Text player_inventory. And basically, each word put there from list would be a term. So _sword would be translated in English to Sword, _chain_mail to Chain mail etc.
This would be the fastest way for me if I could just run some update of translation function whenever player opens Inventory Panel - and those multiple terms would be instantly translated with commas or other symbols left alone. Just those terms and "from code side" the content for the lists would be left alone - strings on the list would be "_sword", "chain_mail" etc. List was only used to import those strings (terms) into that text component, so we leave it alone.

In other words, I get some terms generated from the list and put into UI.
Now I just need to translate all terms from that window (UnityUI Text content, visible in editor). We don't know which terms will there be, but I have a whole list of those terms translated in ILocalize. I have also a variable connected with that Text component, it's just Text player_inventory.

Which function should I run for this?
Last edit: 8 years 4 months ago by Sarr.

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #1677 by Frank
Hi,
The ideal is to place Localize component to your Text GameObject and set a Callback to call a custom function every time the language changes.

If you have a list with all the terms, then the callback is something like:
List<string> CurrentItemTerms;  // your game should fill this list  (e.g. { "_sword", "_chain_mai", "_shield" })

public void OnModifyLocalization()
{
       var translatedTerms = CurrentItemTerms.Select(x=>ScriptLocalization.Get(x)).ToArray();
       Localize.MainTranslation = string.Join(", ", translatedTerms);   // for English, it returns "Sword, Chain mail, Shield"
}


If you don't have the items list, and instead you want to parse the "_sword, _chain_mail, _shield, _an_orange" text, you could do
public void OnModifyLocalization()
{
       var arrayItems = itemsText.text.Split(", ");
       var translatedTerms = arrayItems.Select(x=>ScriptLocalization.Get(x)).ToArray();
       Localize.MainTranslation = string.Join(", ", translatedTerms);   // for English, it returns "Sword, Chain mail, Shield"
}


You could do this without callbacks, by using the that code in your own scripts. However, using a callback from a Localize component is nice as it will be called automatically if the user goes to the menu and changes the language.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The following user(s) said Thank You: Sarr

Please Log in or Create an account to join the conversation.

Time to create page: 0.199 seconds
Template by JoomlaShine