Default value for missing terms?

More
7 years 8 months ago #1643 by hengineer
Ok another quick question:
Is it possible to automatically use the English translation if a term is missing in the current language?

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

More
7 years 8 months ago - 7 years 8 months ago #1646 by Frank
Hi,
That seems like a great idea!
I modified the code to allow that and also another feature I wanted to include related to this:

Now, in the LanguageSource's Language tab, there is a setting that allows you defining what will happen whenever the game requests the translation of a term, but it has not yet been translated to the current language.





Valid options are:
1- Empty: The label will be displayed as empty (this is the previous behavior)

2- Show Warning: The label will show the text: "<!--MISSING Translation--!>.
This mode is useful while developing the game to easily detect any label that hasn't been translated yet. Just make your QA team to switch to this mode every so often and verify that all your screens look correct.

3- Fallback

As you suggested, the plugin will try finding the first language with a valid translation and display that instead.
Normally, you will like to set "English" as the first language in the LanguageSource, so that will be used.

This means, that if you have the term "MY_EXAMPLE"
With the following translations:
English: "This is an example"
Spanish "Esto es un ejemplo"
Arabic ""

If you set the Spanish language and ask for the the translation of MY_EXAMPLE, it will return "Esto es un ejemplo", given that the translation was found.

However, if the language is set to Arabic, asking for MY_EXAMPLE will return "This is an example", because that term hasn't been translated yet to Arabic and therefore the plugin fallbacks to the first language in the list.

On that example, for the arabic language, the MY_TERM will show:

OnMissingTranslation:
EMPTY : ""
FALLBACK : "This is an example"
SHOW WARNING: "<!-MISSING TRANSLATION-!>"

I will be uploading version 2.6.8 a2 to the beta folder later today.

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
Attachments:
Last edit: 7 years 8 months ago by Frank.
The following user(s) said Thank You: mcmorry, Sarr

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

More
7 years 8 months ago #1647 by mcmorry
I was going to ask you exactly the same! :D
Very good timing!

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

More
7 years 8 months ago #1649 by hengineer
Amazing, thank you!!

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

More
7 years 7 months ago - 7 years 7 months ago #1729 by SimonAL
This is a very usefull option. Very nice addon.

We used to change the original code in LocalizationManager.cs - GetTermTranslation() - to
return "NOT LOCALIZED [" + Term + "] NOT LOCALIZED" instead of string.Empty when IF statement failed.

We had to change this part of the script every time we updated the code and it looks like we won't have to do it anymore in the future. :D

Maybe one additional suggestion:

SHOW WARNING: "<!-MISSING TRANSLATION-!>"

could be

SHOW WARNING: "<!-MISSING TRANSLATION [Term]-!>" ---- (return "<!-MISSING TRANSLATION [" + Term + "]-!>";)

This way the QA can easily fix the problematic term without guessing!


Keep up with the good work!
Last edit: 7 years 7 months ago by SimonAL.

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

More
7 years 7 months ago #1730 by Frank

SHOW WARNING: "<!-MISSING TRANSLATION [Term]-!>" ---- (return "<!-MISSING TRANSLATION [" + Term + "]-!>";)

This way the QA can easily fix the problematic term without guessing!


Done!
The change will be in the next beta.

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

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

Time to create page: 0.165 seconds
Template by JoomlaShine