2 sets of Language Source

More
7 years 10 months ago - 7 years 10 months ago #2009 by ct
2 sets of Language Source was created by ct
Hi, I am trying to have 2 instances of Language Source on two difference objects so that I can put them in separate asset bundles.
The idea is to have 1 in the core game, another in dlc.

I created 2 Language Source on separate prefabs, not on I2Languages.prefab. It seems to work fine until I import from google sheets into the Language Source. It seems to delete all the Terms that is in the other Language Source which I did not import.

e.g. I have A and B Language Sources. Each on separate prefabs.
Importing google sheet on A deletes all the terms that are already on B.
Same thing happens when I import google on B.

I am using 2 separate sets of google spread sheets. 1 for A and 1 for B.

I noticed that as soon as I verify the web service for A, all the terms that are listed on B disappears. But checking the prefab in a text file, I still see my terms in the prefab text file even though it is not showing in the Language Source component UI. Not quite sure what is going on there.

Is there a better way to achieve having different Language Source on different prefabs so that I can put them in separate asset bundles?

Thank you!
Last edit: 7 years 10 months ago by ct.

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

More
7 years 10 months ago #2010 by Frank
Replied by Frank on topic 2 sets of Language Source
Hi,
What you doing for having both LanguageSources is correct.

However, for the plugin to detect/uses other LanguageSources (aside 'I2 Languages.prefab'), they have to be instantiated into the scene.
That will add them to the Sources list, and after any operation with google, the plugin will try rebuilding the internal dictionary with all terms in the sources from that list.

Most likely, what's happening to you is that the plugin rebuilds the terms, and then shows only those. Even though the terms of both prefabs are still there, its just that I2L doesn't know that it should look for the other prefab.

If you don't want to instantiate the source in the scene, then you could add its name to the list of prefabs that should be loaded at all time:
LocalizationManager.cs line 203.
public static string[] GlobalSources = new string[]{"I2Languages"};
make it something like:
public static string[] GlobalSources = new string[]{"I2Languages", "BundledSource"};

That should add it to the LocalizationManager.Sources list, and then the ParseTerm function will iterate through it and populate the list that its shown in the UI.

I will investigate a bit more if there is any issue with this procedure just to be sure, and get back to you if I find anything.

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: ct

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

More
7 years 10 months ago #2014 by ct
Replied by ct on topic 2 sets of Language Source
Hi Frank,

Thanks for your quick reply.

I noticed that if I put all the terms in the same worksheet and reference just one worksheet, it shows up no problem in 2 different prefabs (with same set of strings which makes sense). It's when I try to put certain terms in separate worksheets just so that not all the terms are imported into one prefab, I get a problem. It can only import from one worksheet and not both. If that makes sense?

I did not have to instantiate nor add the prefab into GlobalSources for it to be recognized. I managed to get my translated term just by using
I2.Loc.ScriptLocalization.Get

I am trying to have 2 different prefabs reference different google worksheets and it can't seem to do that. It can only import from one worksheet.
Is there a way to keep different terms separate in different worksheets so that different prefabs would have different terms?

Thanks in advance!
ct

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

More
7 years 10 months ago #2015 by ct
Replied by ct on topic 2 sets of Language Source
I just noticed that the translation does not get picked up unless I verify the worksheet once? That is when the prefab is not added in code to GlobalSources nor instantiated.

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

More
7 years 10 months ago #2016 by Frank
Replied by Frank on topic 2 sets of Language Source
Hi,
I was doing some tests now and for me its working as expected:

I duplicated the I2Languages.prefab and renamed it to something like (I2Languages_Features1.prefab)

Because a prefab in your project is not automatically recognized by I2L, unless its in the GlobalSources array or its part of the scene, I created an empty scene and instantiated the prefab there. That scene doesn't need to be included in your build, its just for testing that the new prefab is found by I2L.

Then, I placed the URL to the webService in both the I2Languages.prefab and I2Languages_Features1.prefab. And selected a different spreadsheet in each of them. Then I import-Replace in both.

If I click each of the prefabs I see the different keys from that spreadsheet.

If you run the game, it will only recognize the translations from the I2Languages.prefab. Which makes sense given that I2Languages_Features1.prefab is not in the GlobalSources array.

Because you want that prefab to be included in a bundle, then the best is that once you download the bundle, you should instantiate the prefab in your scene. By doing that, you get access to both translations.

An easy way to accomplish that, its to include in your bundle the scene you created previously, and then at runtime, additively load that scene from the bundle.

Hope that helps, and please, let me know if I'm missing any step to reproduce the issue.
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: ct

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

More
7 years 10 months ago #2023 by ct
Replied by ct on topic 2 sets of Language Source
Hi Frank,

Thanks for your reply.

I just realized that when I switch from one prefab to another, the filter switches from Everything to Nothing automatically. That is why the text was never showing for me! Doh! Sorry about that. I realized that only when I was trying to take a screenshot to show you. The text from the different google spreadsheets show up on the respective prefab.

Thank you very much!
ct

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

Time to create page: 0.196 seconds
Template by JoomlaShine