Referensed Fonts atlases swapping

10 years 3 months ago #45 by Wonderwood Games
Dear support,

Thank you for the great plug-in!

We have several questions and issues:

1. How to make Referenced Fonts swipe with localization change?

We use 2 atlases (SD and HD) for the GUI and Fonts + Retina Pro to switch it (with the reference atlases). And i want to use your atlas swipe feature to make different Fonts atlases for Latin, Cyrillic and Asian fonts. How should i setup it?

We use Bitmapped Fonts So we have Referensed Fonts and i can't add it to your plug-in as Fonts or as UIAtlas...

We do need this feature for localization as soon as possible and we really count on your help!
Can you write a tutorial how to make it or add this feature to the plug-in?

2. I can't import/export Google Sheets. Console writes to me some errors:

Execution of request failed:
I2.Loc.LocalizationEditorDB:Import_Google(String) (at Assets/I2/Localization/Editor/DB/LocalizationEditorDB_Import_Google.cs:76)
I2.Loc.LocalizationEditor:OnGUI_GoogleButtons_ImportExport(String) (at Assets/I2/Localization/Editor/Localization/LocalizationEditor_Spreadsheet_Google.cs:192)
I2.Loc.LocalizationEditor:OnGUI_GoogleSpreadsheetsInGDrive() (at Assets/I2/Localization/Editor/Localization/LocalizationEditor_Spreadsheet_Google.cs:152)
I2.Loc.LocalizationEditor:OnGUI_Spreadsheet_Google() (at Assets/I2/Localization/Editor/Localization/LocalizationEditor_Spreadsheet_Google.cs:51)
I2.Loc.LocalizationEditor:OnGUI_ImportExport() (at Assets/I2/Localization/Editor/Localization/LocalizationEditor.cs:79)
I2.Loc.LocalizationEditor:OnGUI_Main() (at Assets/I2/Localization/Editor/Localization/LocalizationEditor.cs:60)
I2.Loc.LocalizationEditor:OnInspectorGUI() (at Assets/I2/Localization/Editor/Inspectors/LanguageSourceInspector.cs:69)

We work on Macs + Unity 4.3.3

Looking forward to hear from you soon!

Wonderwood Games Team

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

10 years 3 months ago - 10 years 3 months ago #46 by Frank

I’m glad you found the plugin useful!

Here is a way around your issues:

1- Reference Atlas/Fonts

I also have used Reference atlases in my projects, here is how I set it up:
I have a different atlas for each of the resolutions:
Atlas1_BIG, Atlas1_SMALL, …
Then, I created a Placeholder atlas which is using the NGUI mReplacement functionality to use the data from the resolution dependent ones.
Atlas1  (uses mReplacement to use the corresponding atlas Atlas1_BIG, Atlas1_SMALL)

However given that you want to make localized copies of the Atlas1, you also need to make localized copies of the resolution dependent ones:
Atlas1_ES  (references: Atlas1_ES_BIG, Atlas1_ES_LOW)
Atlas1_CH  (references: Atlas1_CH_BIG, Atlas1_CH_LOW)

Once you have all those atlases ready, then you can setup the UI Localization to switch between Atlas1_ES or Atlas1_CH depending on the language.
And then use RetinaPro or your own scripts to make the selected Atlas (e.g. Atlas1_CH) to point to the correct replacementAtlas (Atlas1_CH_BIG, Atlas1_CH_LOW)

The Atlas1_ES and Atlas1_CH are regular NGUI Atlases so they can be assigned to the Localize component without problem.
The same structure works for Reference Fonts.

For the next I2 Localization version I will add a sample scene using the above setup to show how the replacement atlases working with I2 Localization.

But if you still have issues with that setup, let me know and I can further explain that structure.

2- Accessing Google

The problem you are facing could be one of the following things:
- If the project’s target is set to Web Player then the policies will not allow the google dlls to access Google. For my Web project I have to switch to PC do all the localization and then switch back to Web.

- Make sure that your account has access to the spreadsheet your opening.

- Are you using the latest version (2.0.1) ?

- Sometimes you need to open a browser and log into google (gmail or gdrive) before exporting/importing spreadsheets. Usually just by providing your credentials in the Editor it will connect fine, but in the past I have seen cases where it couldn’t connect unless there is an open tab in your default browser with your account logged in. I will try reproducing that again and see if it’s an issue on Mac as I remember that I got that problem when using a Mac.

- The key you are using for the spreadsheet (1FK2i-CUnAxAhDmyppZhY26cI7VkleJFJRpzzTN2scV4) seems a bit weird to me. I have never seen a key with a “–“ in-between. Please, verify that key is correct. Try creating a new Spreadsheet in your google drive and access that one instead to rule out any other issue.

If after checking those points, you still can’t connect to your google spreadsheet, please let me know if you are using a shared spreadsheet, if the spreadsheet is in your gdrive or in other’s account gdrive. If by clicking the Refresh button in the Editor Google section you are able to select the spreadsheet in the dropdown list.

I will try reproducing that issue and finding a way around, but any further info that could help me match your setup will be helpful.

Thanks a lot,

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: 10 years 3 months ago by Frank.

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

10 years 3 months ago #47 by Wonderwood Games
Hi, Frank

Thank you for your help!

About the Fonts
Unfortunately i still didn't understood how to add UIFont switching, so i've added this functionality to your scripts and now everything is great! :-)

1. I've added to Script Localization_Term_Description.cs line to the section #if NGUI on line ~184
case eTermType.UIFont		: ObjType = typeof(UIFont); break;

2. To file LocalizationEditorDB.cs in eTermType {}
#if NGUI

3. In file LocalizeNGUI.cs i've changed in the void DoLocalize_UILabel()
//--[ Localize UIFont Object ]----------
	UIFont newFont = GetSecondaryTranslatedObj<UIFont>(ref MainTranslation, ref SecondaryTranslation);
	if (newFont!=null) mTarget_UILabel.ambigiousFont = newFont;

So now i can change referenced UIFonts in labels :)

About the Google:
Nothings helps..
  1. Build settings is to iOS
  2. I use login/pass to the account that contain this spreadsheet (not even shared)
  3. Version is v2.0.1 for Asset store
  4. I've logined in every Browser.
  5. Key is correct

It is not a problem to import/export in locally, but it will be perfect to use GDrive

Thank you once again for help!

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

10 years 2 months ago - 10 years 2 months ago #48 by Frank

You were right. While it was possible to use referenced Atlases when targeting NGUI, I just had dynamic fonts coded in.
Now I added Bitmap Fonts as well in a similar way to how you set it up. Thanks for detecting that only dynamic fonts were supported! I will be releasing those changes in version 2.0.2 in the next few days with a few other improvements.

Regarding Google, I have been trying to reproduce that issue. I tried on both Win and Mac, Having public or private Spreadsheets. Also tested having spreadsheets inside folders or just in the root. But I have always been able to export/import.

I have a question though. Are you introducing the spreadsheet key by copy/pasting it or are you having the editor look into your google Drive by clicking the Refresh button, and then selecting the spreadsheet from the dropdown list so that the editor finds for you the correct key?

Also, once you have the key set, if you click the Refresh button, the editor will look into your google drive, download the name of all your spreadsheets, and if there is one that matches the key you set, it will list the spreadsheet name in the "In Google Drive" dropdown. Does that happens for you or the dropdown just show as empty/has nothing selected?

I really want to help you solve the issue as accessing Google Spreadsheets is one of the most useful features in the plugin. If you want you can contact me to This email address is being protected from spambots. You need JavaScript enabled to view it. and we can chat to find out exactly how to reproduce that issue.

Thanks a lot!

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: 10 years 2 months ago by Frank.

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

10 years 2 months ago #49 by Wonderwood Games
Unfortunately nothing helps with Google.

L2 successfully connects to the GDrive, see my sheets and selects it by key in the Editor, but when i hit the Import - i get the Error.
I've also tried to make new sheet (without "-" letter in the Key) - this also does not help.

But now we have more complex problem - how to make a localizable text with some dynamical text in it?
Something like "You score is {here is the dynamical data} point for this hit".
As i know Terms are static? But we need a bit more flexibility in the texts... There are many cases when we need it. For example mission generator that makes objectives by some patterns.

I didn't found such thing in examples (by the way NGUI example scene is a bit corrupted or not finished in the asset store version of L2).

Thank you!

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

10 years 2 months ago #50 by Frank
I2 provides event callbacks for changing the translations at runtime.

The Unity Standard Components example scene contains a label that uses callback for correct concatenation.
That way the translation:

"{winner} Player Wins"

can be parsed before displayed and the {winner} section can be replaced by some value that makes sense within your game (e.g. "Red Player Wins")

That allows for correct concatenation on different languages:
Spanish: "El jugador {winner} ha ganado"  
(In Spanish the color will be in the middle of the sentence)

Also, the replaced part can be translated by accessing the terms in the Script. Therefore, if you know that the winner is the Red, instead of concatenating "Red", that can also be translated and concatenated in the correct language (e.g. "El jugador rojo ha ganado")

Hope that helps.

I'm still trying to reproduce your issue with google, but so far it always export/import for me. Can you email me so that I could send you a test spreadsheet that I know its working. That way we could rule out any issue with the terms in your list.


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.332 seconds
Template by JoomlaShine