Search Unity

I2 Localization ( The most complete Localization solution for Unity )

Discussion in 'Assets and Asset Store' started by Inter-Illusion, Feb 27, 2014.

  1. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    http://inter-illusion.com/forum/i2-localization/1117-crash-on-ios-in-xcode#3081

    I understand that its not desireable to get LocalizeAll called twice, but I don't see the problem you are having.
    Everytime you get the LocalizeAll executed, it will give you the parameters name and call the same callbacks. So, you will be able to do the same substitution as in the first call.

    Can you please elaborate more about the problem, so that I can give you a workaround.

    Said that, in the next release, I'm planning on going around this unity bug by finding all LocalizationParams objects when initializing the scene/game. That way they will not be initialized after the first LocalizeAll is executed.
     
  2. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    149
    Is this still the case? I can't seem to set the Localize component's Term to an empty string (equivalent of selecting "none" in the dropdown). I've tried using an empty string, however Localize.SetTerm() looks like it ignores empty or null strings passed to it and simply re-localizes whichever Term is already assigned.

    I believe I'm running I2Loc 2.8.5 f1.

    Code (CSharp):
    1. public void SetTerm (string primary)
    2. {
    3.     if (!string.IsNullOrEmpty(primary))
    4.         FinalTerm = mTerm = primary;
    5.  
    6.     OnLocalize (true);
    7. }
    Should I be setting the value of "mTerm" and/or "FinalTerm" instead?

    I noticed when the Localize component's data is serialized, the Term property has a value of '-' when it's set to "none" in the Inspector. Is there a specific value that should be assigned to Term or passed to SetTerm() to clear the existing term data?

    Update: I was able to set the Term dropdown to "<none>" by assigning the value of "-" to mTerm and FinalTerm. I then called OnLocalize(true), but that didn't update the associated Text component (which may be your desired behavior), so I set the Text value to string.Empty manually. Calling OnLocalize() afterward, doesn't seem to update the Text component at all, which is probably okay in this case, since the Term is set to "none".

    If there is a better way to go about clearing the existing Localize.Term and Text.text fields, please let me know.
     
    Last edited: Jun 8, 2018
  3. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    81
    TextMeshPro does not work on Unity 2018.2, it fails with this error.

    "No script asset for LocalizeTarget_TextMeshPro_UGUI. Check that the definition is in a file of the same name."

    To fix it, please rename the LocalizeTarget_TextMeshPro.cs to LocalizeTarget_TextMeshPro_UGUI.cs and this will make it work!

    Please, fix it on a next release!

    Edit... Changing it fixed the error, but it still does not work. It does not show Material as a Secondary Term and still does not work at all.

    Thanks
     
  4. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    In I2 Localization there is no LocalizeTarget_TextMeshPro.cs.
    upload_2018-6-14_17-55-54.png
    That was changed a few versions ago.
    If you still that file, it means that Unity didn't update the package correctly when installing it, and left older files behind.
    Solution: delete the I2 folder and reinstall the plugin.

    Hope that helps,
    Frank
     
    wagenheimer likes this.
  5. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    81
    Well... I deleted everything and imported it again. I imported I2 Localization 2.8.7 b4.unitypackage.

    It was still not working, but I did notice that Target is set to Prefab. I changed it to TextMeshPro UGUI and now it's working! =)

    But I had to change it on all Localize component over all my project.

    Could you please explain what is the objective of using Target = Prefab?
     
  6. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    The plugin was trying to detect what target to localize in those objects. But your TextMeshPro UGUI target was failing, so, it fallback to the only other target that could be applied.
    Then, you saved the scene, so it kept that fallback even when later the TMPro UGUI compiled fine.

    The Prefab Target, allows setting a term with prefabs and instantiating them based on what language you are on.
    There is an example of them in the Standard Components Example Scene.

    Hope that helps,
    Frank
     
    wagenheimer likes this.
  7. jvincealo

    jvincealo

    Joined:
    Apr 11, 2017
    Posts:
    2
    TextMeshPro is also not working in Unity 2017.2, I'm currently using v2.8.6 f2 and the Localize can only detect the prefab as the target. Is there a solution to this?
     
  8. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Can you please describe a bit more your problem?
    - Are you getting any compile errors? Or other messages in the Console?

    - Did you enable TextMeshPro as a target?
    http://inter-illusion.com/assets/I2LocalizationManual/EnablingLocalizationTargets.html

    - Did you try doing a clean install in case the unity package left old files
    (i.e. delete I2 folder and reinstall the plugin)

    - If there was an issue and the plugin only detected Prefab, then, when the issue is fixed, you have to click in the popup and change the target from Prefab to TextMeshPro.

    - Are you using TextMeshPro from AssetStore or from Package Manager?

    Please let me know if that fixes your problem and a bit more context about it so that I could narrow the solution for you.
    Hope that helps,
    Frank
     
  9. claudius_I

    claudius_I

    Joined:
    May 28, 2017
    Posts:
    142
    hi
    i have this error when imported

    Assets/I2/Localization/Scripts/Utils/PersistentStorage.cs(6,25): error CS0101: The namespace `I2.Loc' already contains a definition for `PersistentStorage'
     
  10. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    The PersistentStorage file was moved to Assets\I2\Localization\Scripts\Configurables
    So, it seems that Unity failed to import the package correctly and delete the old file.

    To solve this problem, you should
    - Delete the I2 folder
    - Install I2 Localization again.
    That will remove any old file and will compile fine.

    Hope that helps,
    Frank
     
  11. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    81
    Hi, my I2Languages prefab thinks that the editor is in play mode even when it isn't. How can I fix this? The last time this bug occurred I had to rewrite the entire localization table again. I can't do that again since there are too many terms now.

    upload_2018-6-27_17-17-5.png
     
  12. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    I'm not sure I follow you. What do you mean by "the prefab thinks that its in play mode"?
    Are you losing translations? Only the current language had data?

    If that's the case, are you using the latest version of I2 Localization (v2.8.7)? There was a change in that version to prevent the Unloading of languages to happen in Editor.

    Was there any error in the console before the issue you are seeing happened?
     
  13. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    81
    Yes I lost translations, only the current language has data.
    I was on version 2.8.5, updating now...
    Yes, there were errors that appeared after I saved a script in visual studio and went back to unity while it was in play mode. I forgot to exit play mode before saving a script.
    I'm checking the repository to see if I can rollback the I2 prefab but if it gets serialized with the scene I'm screwed.

    Edit: Rolling back the prefab and updating the plugin worked. Thanks!
     
    Last edited: Jun 27, 2018
  14. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Great!!!

    That was the cause of the lost. In previous versions, the unloading of languages to save memory ran in the editor as well, so if you had an error while exiting the Play mode, then the code that restores the translations didn't run.

    In 2.8.7, there is a new setting in the Languages Tab, to decide where the Unload languages is executed (NEVER, OnlyInDevice or InDeviceAndEditor). By default its set to OnlyInDevice.
    That way you can edit while playing in the editor, and errors like this don't remove the translations. Then, while playing in the device, the plugin will still unload languages to save memory!

    Hope that helps,
    Frank
     
  15. startleworks

    startleworks

    Joined:
    Jun 8, 2013
    Posts:
    33
    Hello,

    I am currently working on a project where i have two identical text fields that each has a language switch button(ex: one can be english, the other can be spanish). it's for a big touch panel where 2 people can use the app, side by side.

    How can I implement this? I've tried having 2 language sources, each assigned to it's own language switch, but when i click the button, both textfields change language.

    Is there a way to make this work?
     
  16. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    The plugin doesn't directly support multiple languages enabled at the same time.

    However, there are workarounds this:
    http://inter-illusion.com/forum/i2-localization/189-select-language-term-by-term#534
    http://inter-illusion.com/forum/i2-localization/209-multiple-languages-at-the-same-time#841

    Basically, the idea is to have a script that sets a Callback for every Localize component that uses the second language. Then when those try to localize, they invoke the callback, and you just replace the translation by the corresponding translation in the second language.

    That's a bit more involved and require a bit of setup, but should work fine and all you need its to add the script to the Localize Components using the second language.

    Hope that helps,
    Frank
     
  17. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hey guys,

    I'm going to visit my family for a couple weeks. ( vacations!!!! )
    I will be out of the country, so, most likely I won't have internet or very limited one, and I will not be able to provide support until August 1st.

    Sorry about this, I will try to catch up with support as soon as I get back!
    Thanks!
    Frank
     
  18. Gatskop_Software

    Gatskop_Software

    Joined:
    Sep 21, 2014
    Posts:
    54
    Let us know when you back got playmaker issue I need help with
     
  19. Meceka

    Meceka

    Joined:
    Dec 23, 2013
    Posts:
    322
    I had an Options category with various options like Graphics Level, Audio volume, etc. And I also added the term Options to that category for localization. So it makes that Options/Options. It was the best category for that term and I didn't see any warning that this structure could cause problems.

    Today I wanted to use the bake script option in tools section. It has done the bake, but I had 2 compiler errors saying something like "you can't have two of same classes" right in the Options/Options lines.

    Then I wanted to rename Options/Options to Options/options but something went seriously wrong and i2localization deleted 90% of the terms in my terms list.
    I could compare the i2languages.prefab file to the older version with version control and could clearly see right after Options/Options everything else was removed.

    This could be fine as I could just revert the prefab to lose some newly added terms. But it also modified my scenes and replaced terms of most objects with the term that's on top of the terms list. Therefore it forced me to also revert the scenes from version control, and causing me to lose some work.
     
  20. gdkid

    gdkid

    Joined:
    Nov 14, 2014
    Posts:
    2
    Hi

    Thanks for the great tool, I have a question to ask.

    When I first import the I2 Localization it scanned through the game and export a list of string as key (about 1000 keys to be exact)

    But the keys look messy, so we edited them (add prefix to categorize the key)

    When we load the file, now it has many "Missing" terms, and go through every single of it is very time-consuming.

    So, may I ask : Is there a faster way to mass edit the missing terms?

    Thanks a lot in advance
     
  21. Ibukii

    Ibukii

    Joined:
    Jun 23, 2016
    Posts:
    45
    Hi,

    Can I check if there is a way to import a new source at runtime? This is because the plugin now currently only handles local CSV and google. However the application is going to be deployed in countries that block Google. I need to download the CSV from websites that are allowed in those countries, then load into the localization.
     
  22. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hey Guys!!

    I'm finally back from vacations!!!
    I will be catching up with support in the next couple days!
     
    Igualop likes this.
  23. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    You just need to call source.Import_CSV in order to update a source with the translations inside the CSV.

    The documentation has the example code that handles downloading the CSV from a bundle, a website or a regular folder and importing that into the I2Languages.prefab at runtime.
    http://inter-illusion.com/assets/I2LocalizationManual/ImportingaCSVfile.html

    Hope that helps,
    Frank
     
  24. Gatskop_Software

    Gatskop_Software

    Joined:
    Sep 21, 2014
    Posts:
    54
    Error on the I2 Set Current Language on Unity 2018.2 Playmaker version 1.9.0.p4

    See screenshot



    MissingReferenceException: The object of type 'LanguageSource' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Object.get_name () (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:198)
    I2.Loc.LanguageSource.GetSourcePlayerPrefName () (at Assets/I2/Localization/Scripts/LanguageSource/LanguageSource_Import_Google.cs:167)
    I2.Loc.LanguageSource.Import_Google (Boolean ForceUpdate, Boolean justCheck) (at Assets/I2/Localization/Scripts/LanguageSource/LanguageSource_Import_Google.cs:125)
    I2.Loc.LocalizationManager+<Delayed_Import_Google>c__Iterator0.MoveNext () (at Assets/I2/Localization/Scripts/Manager/LocalizationManager_Sources.cs:98)
    I2.Loc.CoroutineManager+<Start>c__AnonStorey1.<>m__0 () (at Assets/I2/Localization/Scripts/Utils/CoroutineManager.cs:41)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)
     

    Attached Files:

  25. Gatskop_Software

    Gatskop_Software

    Joined:
    Sep 21, 2014
    Posts:
    54
    The playmaker example scenes have the same issue
     
  26. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    Thanks for reporting this issue. It was fixed in 2.8.8a2 (can be downloaded from the beta folder).
    I also went and updated the PlayMaker example scene to show better the SetTerm action.

    2.8.8a2 have some code to make sure the error doesn't happen even with bad settings, but If you can't update at the moment, there are a couple things you could do to fix the settings and avoid the issue.

    First be sure you have PlayMaker and the PlayMaker Unity UI Addon.
    Then, open the LocalizationSource in the PlayMaker Localization example scene and in the Spreadsheet/Google tab, change the Update frequency to NEVER.
    upload_2018-8-4_14-18-27.png

    That will prevent the error from happening.

    Hope that helps,
    Frank
     
  27. VicM

    VicM

    Joined:
    Mar 14, 2012
    Posts:
    22
    On my side it seems the google live sync is working partially on a released app.
    10 days ago we published a new version of our app in where we implemented for the first time I2 for localization.

    Today we had to update some terms translations, I went o the google sheet, changed the text and returned to the app and saw the text updated after some seconds. All working ok until there, but If I close and restart the app, the localization data that came with the released version is shown instead of the fresh data, it seems like I2 is not storing the fresh data on the device and fallback to the default local data. I suppose because some how the I2 detects that it already downloaded the data in the first attempt (for the weekly period) and do not perform the check again.

    I can reproduce this on both iOS and Android versions of the released app.
    My update frequency was set to WEEKLY with a 5 seconds DELAY.

    We used the I2 version 2.8.7 f1, the latest available so far in the asset store.

    Any insights to solve this will be appreciated.
     
  28. TailoraSAS

    TailoraSAS

    Joined:
    Jul 18, 2015
    Posts:
    5
    Hi, i think i found an unwanted behaviour in the version 2.8.7f1 for the startup language method.

    if you have a device with a system language that is disable in the source. when there is no savedlanguage, the disabled language is set regardless the fact it is disabled.

    the expected behaviour will be to not set the application to the disabled language, and to fallback to the default language set in the source.

    i tried to fix it by modifying the LocalizationManager_Language.cs file

    Code (CSharp):
    1. if (!Sources [0].IgnoreDeviceLanguage)
    2.             {
    3.                 // Check if the device language is supported.
    4.                 // Also recognize when not region is set ("English (United State") will be used if sysLanguage is "English")
    5.                 string ValidLanguage = GetSupportedLanguage (SysLanguage);
    6.                 if (!string.IsNullOrEmpty (ValidLanguage)) {
    7.                     if (HasLanguage (SysLanguage, Initialize: false) )
    8.                     {
    9.                         SetLanguageAndCode (ValidLanguage, GetLanguageCode (ValidLanguage), false);
    10.                         return;
    11.                     }
    12.                 }
    13.             }
    i don't know if it is working for all cases because HasLanguage does not work with the GetSupportedLanguage output value, but it worked with the raw system language.

    i hope it will help for a futur version.
     
  29. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Thanks for reporting this issue.
    This is now fixed in 2.8.8b1 !

    Thanks for looking in to that!
    This was already fixed in 2.8.8a2.

    here are a few of the other recent changes:
    Code (csharp):
    1. NEW: Added a flag to disable Localized Parameters
    2.      (http://inter-illusion.com/forum/i2-localization/1163-localization-params-auto-translating-design-flaw#3195)
    3. NEW: Merged all checkboxes in the Localize component into an "Options" popup to make the Localize's inspector use less space
    4. NEW: Find all terms in the Scene/Scripts now also detects those in your code using [TermsPopup] and LocalizedString
    5. FIX: Changing the Font or Material in a TextMeshPro now updates the linkedTextComponent
    6.  
    7. FIX: Startup language now ignores the disabled Languages if the "Default Language" is set to "Device Language"
    8.  
    9. FIX: Updated Playmaker example scene to show that it needs the Unity UI Addon.
    10. FIX: Prevented a null reference on the GetSourcePlayerPrefName function when using Google Live Synchronization in Scene's sources
    11. FIX: Google Live Synchronization was failing to load the downloaded data from the cache
    The 2.8.8xx version can be downloaded from the beta folder.
    I'm planning in releasing them to the AssetStore early next month.

    Hope that helps,
    Frank
     
  30. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    692
    Hi Frank,

    I have three wishes for the Localization Prefab Editor:
    1. Allow text search (not just searching for ids but also for the localized text itself). This would be helpful if you found a typo in the app but do not remember the loca-id...
    2. Add some filters to the list. I especially need a filter to find all entries which have no translation for a certain language.
    3. Add the possibility to tag entries (best would be a "bulk tag" operation to tag several entries)

    Point 2 and 3 are maybe special needs for my project, but it would help me a lot.
    In my project the user has access to different screens depending on the type of account. Some of these screens needs to be translated into all languages, others only in a subset.
    With a tag I could easily remove the not-required entries for the translators of non-required languages. With the filter I could easily find entries which needs to be translated and also can find entries which should be tagged as "EnglishOnly" for example (because parts of the app are already translated).
     
  31. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Great suggestions!!
    1. This has been something I have in my todo list, but haven't implemented yet because I was concerned of making the editor inspector more complicated than what already is by adding the filter toggle and it was going to a bit slower as it has to compare in all translations/descriptions/names.
    But I ran some tests, and given currently the plugin only updates does the parsing whenever there is a new term or the filter text changes, this is now quite fast.
    I will be adding this feature right away.

    2. I like that. Will add a UnTranslated toggle button next to the "Missings" filter

    3. That currently can be done by using the Description field. Just place your tags there. And once I implement the suggestion in (1), you will be able of finding all the terms with the tag.

    Until I have those features implemented, you can do the searching by using the Google Spreadsheet. Just export to google and do a search in the spreadsheet, thats quite fast and you have several options to find what you need.

    Hope that helps,
    Frank
     
    Hosnkobf likes this.
  32. BrothaMan

    BrothaMan

    Joined:
    May 19, 2013
    Posts:
    47
    Hey @Inter-Illusion

    Trying to figure out best way to support use case I have below. We basically have a tutorial that will be fully localized by language but also will be cross platform to different consoles.

    We like the ability to show the button sprites within the TextMeshPro text. However, that sprite will have to change depending on the platform.

    I know you can localize sprites with I2, however I'm not sure if it would support localizing the sprite within text, that will be localized itself.

    Let me know if you have any ideas on the best way to approach having the example below be localized and sprites easily changed depending on platform.

    upload_2018-8-26_13-4-1.png
     
    Last edited: Aug 26, 2018
  33. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    To show different texts depending on the platform, you can use the Input Specialization feature of I2 Localization:
    https://twitter.com/InterIllusion/status/973446312761769984

    Once you create a variant for each platform, you can specify the text that will be shown for each of them.

    Given that you are using TextMeshPro, you can set the sprite inside the text by just changing the number inside the text:
    e.g.

    XBOX: "Hold<sprite=7> to fire"
    PS4: "Hold <sprite=6> to fire"
    IOS: "Tab to Fire"

    Hope that helps,
    Frank
     
  34. wyznawca

    wyznawca

    Joined:
    Dec 27, 2012
    Posts:
    27
    Hey,
    Is there anyway to automatic load from sheets only some keys, not all of them? I mean, when i dont refresh the prefab in unity, but the translation is going directly to game
     
  35. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    You can move all the new terms to a new Sheet and name the Sheet starting with ~
    For example "~Temporal". Every Column or Sheet whose name starts with the character ~, is ignored by I2 Localization and will not be downloaded.

    Said that, if what you are trying to do is release the game, and keep working on it, but don't release the new spreadsheet until everything is ready, I would suggest you a different approach:
    - Make an Spreadsheet and develop your game using it.
    - As soon as you release your game, duplicate that spreadsheet and link it with Unity
    - Keep working in the new Spreadsheet.
    - When everything is ready, copy the terms into the old sheet, and they will get automatically downloaded to all your players.

    Hope that helps,
    Frank
     
  36. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    483
    Hi,

    I wanted to be able to edit the term both from a text field (with the ability to quickly add it to the source in case it wasn't localized yet) and also use the drop-down menu to choose from existing terms. With Frank's help, I ended up with this:

    Code (CSharp):
    1.   public class LocalizedStringTest : ScriptableObject
    2.   {
    3.     public string myTerm;
    4.     public LocalizedString myString;
    5.   }
    And the editor class:

    Code (CSharp):
    1.   [CustomEditor(typeof(LocalizedStringTest))]
    2.   public class LocalizedStringTestEditor : Editor
    3.   {
    4.     LocalizedStringTest myTarget;
    5.     void OnEnable()
    6.     {
    7.       myTarget = (LocalizedStringTest)target;
    8.     }
    9.  
    10.     public override void OnInspectorGUI()
    11.     {
    12.       LocalizationManager.InitializeIfNeeded();
    13.       string previousTerm = myTarget.myTerm;
    14.       DrawDefaultInspector();
    15.       GUILayout.BeginVertical(EditorStyles.textArea, GUILayout.Height(1));
    16.       LocalizationEditor.OnGUI_Keys_Languages(myTarget.myTerm, null);
    17.       GUILayout.EndVertical();
    18.  
    19.       if(GUI.changed)
    20.       {
    21.         if(previousTerm != myTarget.myTerm)
    22.           myTarget.myString.mTerm = myTarget.myTerm;
    23.         else
    24.           myTarget.myTerm = myTarget.myString.mTerm;
    25.       }
    26.     }
    27.   }
    Just in case it might be useful for somebody else.
     
    Last edited: Sep 10, 2018
    Tropobor and Inter-Illusion like this.
  37. JoRangers

    JoRangers

    Joined:
    Nov 7, 2017
    Posts:
    21
    Hi,

    I want to achieve this with your asset :
    - Create multiple prefabs in the Resources folder like I2Languages for differents versions of my app for my clients.

    In editor, all works fine :
    - my text has a "Localize" component with the "Language Source" variable set with my new prefab
    - my buttons to change language have a "Set Language" component with the "Language Source" variable set with my new prefab

    Unfortunately, in build for windows10, my text isn't localized to the correct language.

    The only solution I have found is to modify manually the script "LocalizationManager_Sources.cs" and edit the line 16 to add my new prefab name in the string[] GlobalSources.
    Else by default, the asset only found the default prefab I2Languages.prefab

    I wonder if an automatic or other solution exist to do the same things.

    I use the version 2.8.8 f1

    Thank you
     
  38. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    What you are using, is the correct approach to add more global sources.
    By default, I2L only loads automatically the I2Languages.prefab and any LanguageSource in the scenes.
    If you want to add more sources, you have 2 options:

    1- What you are currently doing: create a copy of I2Langauges.prefab and add its name to the GlobalSources array. That will automatically load that source at startup and use it everywhere.

    2- or you can add that Source to your startup scene. That way it is automatically used as soon as the scene is loaded and is kept in memory while the scene is on. If you want to make accessible everywhere, then you may have to add it to your other scenes or use Additive scenes to have the source in a scene that its always kept loaded.

    Hope that helps,
    Frank
     
  39. nguyenhuuchi

    nguyenhuuchi

    Joined:
    Mar 13, 2016
    Posts:
    1
    Hi!, I just upgraded to unity 2018.3 and the new Prefab Workflow made Gobal languae source not save data term, every time I replace or add new data form csv, the data is not saved. What solution to handle this error? thank you Screenshot_1.png Screenshot_2.png
     
    Last edited: Sep 13, 2018
  40. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    Thanks for reporting this. The 2018.3 beta was just released and I haven't had time to check their new prefab workflow.
    I will do that today and send a fix asap!!
     
  41. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    692
    I did a change for my project in LocalizedString.
    I use that class often to apply a text to some field by using a special method.
    However, sometimes I use the same method to pass raw text (concatinated localization entries and other stuff like dates...). It is no problem because a string can be implicitly converted to LocalizedString. But it becomes null when that string has not been found in the list of terms.

    To allow raw text as well, I changed the last line of the ToString() Method in LocalizedString to
    return translation ?? mTerm;
    .
    Not sure why you rather return null than the term. In my opinion my approach is preferable. But maybe you have a reason. Anyways, I am fine with this approach and would be happy if this would be implemented in the next version, so I do not have to change it again and again...
     
  42. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Version 2.8.9b1 is now in the Beta folder. That beta adds support for Unity 2018.3 new prefab system!

    The reason why LocalizedString returns null, is so that you can know whenever you are querying for a translation that doesn't exist. If the translation exists but its empty, then the LocalizedString returns an empty ("") string.
    That's why null is used to define missing translation so that you can handle it in your own code.

    Said that, instead of null, you make the LocalizedString return other values depending on the option you enable in the LanguageSource. In the Language's tab there is a setting for "On Missing Translation". It can be set to Fallback to another language, return an error string, etc.

    Also, seeing your point about returning the term, I like that idea. So I will add that option to the "On Missing Translations" in the next release.
    Thanks for suggesting that!
     
    Last edited: Sep 19, 2018
    Hosnkobf, nguyenhuuchi and Fuzzy like this.
  43. winxalex

    winxalex

    Joined:
    Jun 29, 2014
    Posts:
    125
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace pettest.ws.winx.unity.attributes {
    4.  
    5.  
    6.     public class LanguageAttribute : PropertyAttribute {
    7.  
    8.     }
    9. }

    Code (CSharp):
    1. using I2.Loc;
    2. using pettest.ws.winx.unity.attributes;
    3. using UnityEditor;
    4.  
    5. namespace ws.winx.editor.drawers {
    6.  
    7.  
    8.     [CustomPropertyDrawer(typeof(LanguageAttribute))]
    9.     public class LanguagePropertyDrawer : PropertyDrawer {
    10.  
    11.         public override void OnGUI(UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) {
    12.  
    13.             string[] Languages;
    14.  
    15.             LocalizationManager.UpdateSources();
    16.             Languages = LocalizationManager.GetAllLanguages().ToArray();
    17.             System.Array.Sort(Languages);
    18.  
    19.  
    20.             int index = System.Array.IndexOf(Languages, property.stringValue);
    21.  
    22.             EditorGUI.BeginChangeCheck();
    23.  
    24.             index = EditorGUI.Popup(position, "Language", index, Languages);
    25.  
    26.             if (EditorGUI.EndChangeCheck())
    27.             {
    28.                 if (index < 0 || index >= Languages.Length)
    29.                     property.stringValue = string.Empty;
    30.                 else
    31.                     property.stringValue = Languages[index];
    32.  
    33.                 if ( LocalizationManager.HasLanguage(property.stringValue))
    34.                 {
    35.                     LocalizationManager.CurrentLanguage = property.stringValue;
    36.                 }
    37.  
    38.  
    39.                 property.serializedObject.ApplyModifiedProperties();
    40.             }
    41.  
    42.  
    43.         }
    44.     }
    45. }

    Now you can use
    Code (CSharp):
    1.   [LanguageAttribute]
    2.     public string defaultLanguage;
    u lazy azzes :)
     
    Inter-Illusion likes this.
  44. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    Sorry, but I'm not understanding your question. Can you please give me a bit more of context?

    What do you mean by "Normal" font? are you meaning that your project only uses ttf fonts, and you are asking if its better to use bitmap fonts, or even TMPro fonts?
    Or are you referring about the Touch/Normal specializations in the older I2 Localization?
    Are you asking about some part of the documentation that is not clear?
     
  45. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    791
    Hi,
    Recently I've been getting some serialization error on build, like this:

    Code (CSharp):
    1. Type '[Assembly-CSharp]I2.Loc.LanguageSource' has an extra field 'NeverDestroy' of type 'System.Boolean' in the player and thus can't be serialized  (expected 'mTerms' of type 'System.Collections.Generic.List`1[I2.Loc.TermData]')
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    It happen randomly and sometimes happen also in the build. I found the reason:
    https://forum.unity.com/threads/cas...player-with-partial-classes-sometimes.466494/
    Is this something that could be fixable? Was partial classes in the code introduced recently or it's some changes in Unity since they are switching to Roslyn?
     
  46. muratmenevse

    muratmenevse

    Joined:
    Feb 16, 2015
    Posts:
    7

    This did not work for me. I get this error this time:

    "The name `ScriptLocalization' does not exist in the current context"
     
  47. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    Hi,
    ScriptLocalization is a script that you generate using the Bake Tool
    http://inter-illusion.com/assets/I2LocalizationManual/BakingTermsintoScriptsforsaferac.html

    It is not included in I2 Localization and is only generated if you need it.

    If you have had I2 Localization and generated that file, be sure to not delete it when you update the plugin. Thats why that script is now created outside of the I2 folder so that deleting the I2 folder when updating don't break your scripts.

    If you were in a very very old version of I2Loc, and was using ScriptLocalization.Get("xx"), you should replace that by LocalizationManager.GetTranslation("xx")

    If none of these applies to you, can you please, give more context on your situation. What Unity version are you using, which I2 Loc? What did you had before?

    Hmm, I have never seen that error before or got any report of that. Partial classes have been in the plugin since it was published 3 years ago, so it may be something related to the new Unity changes.
    Can you please let me know what Unity version and I2 loc are you using? Also what platform are you building when you get the error (Android, IOS, PC, etc).

    I'm going to try reproducing that issue. But if its related to Unity not handling partial classes correctly, then, the only solution would be to merge all variables into a single file.

    Do you have access to the beta? http://inter-illusion.com/forum/i2-localization/37-accessing-early-versions
    If so, I could upload a version with that change so that you try it and see if the problem is fixed that way.
     
  48. muratmenevse

    muratmenevse

    Joined:
    Feb 16, 2015
    Posts:
    7

    Hello again,

    We use Unity 2017.2.3f1 and 2.8.3 for i2. I have replaced the ScriptLocalization.Get("xx"), to LocalizationManager.GetTranslation("xx"). Everything is fine except I have problem with ArabicSupport I get this error:
    The name `ArabicSupport' does not exist in the current context. Any ideas?

    Thanks for the help.
     
  49. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    463
    My suggestion is to update to the latest I2L. (2.8.8 or 2.8.9)
    The ArabicSupport code was removed a few months ago. Now the plugin uses a custom one for fixing RTL and Arabic languages.
     
  50. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    791
    I am using 2018.2.5 and I2 Loc 2.8.8 f1, building for Android.
    I just sent you an email with my invoice for the beta builds.