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. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    175
    Hello! Just wanted to give everyone a heads up on this issue, for those using older versions of Unity with I2Loc.

    I've just updated my project from 2018.2 to latest LTS (2018.4.36f1), and also updated I2Loc to latest (2.8.15 f2).

    However, I then got several compile errors related to string interpolation, which is only available in C# 4.0:


    Assets/I2/Localization/Scripts/Configurables/PersistentStorage.cs(103,48): error CS1644: Feature `interpolated strings' cannot be used because it is not part of the C# 4.0 language specification


    For anyone else with this issue, you can fix it by updating the Scripting Runtime Version to ".NET 4.x Equivalent" in Project Settings

    More info here: https://docs.unity3d.com/2018.4/Documentation/Manual/CSharpCompiler.html
     
  2. Rs

    Rs

    Joined:
    Aug 14, 2012
    Posts:
    72
    Hello, not sure if this has been asked before. Does this asset have a built-in functionality to remember what language was selected the last time the application was used?
    Thanks
     
  3. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    542
    Rs likes this.
  4. Rs

    Rs

    Joined:
    Aug 14, 2012
    Posts:
    72
    Thanks for the quick reply. Another question: how do I pragmatically add a translation to a TermData that is non-text?
    Since I have lots of assets and scenes, I did an Editor script that populates the LanguageSourceAsset for me.
    For text it's easy. Once I created a TermData td I just call `td.SetTranslation(idx: mynewid, translation: myDefaultText);`
    but how do I do this for Sprites, AudioClips, Textures and the other managed types?
    What I want is to reproduce, in C#, the steps I would do when adding a term, setting its type to, say, Texture and then set the Texture value.
    I'm scratching my head because the translation field is always a string, no matter what they eTermType.
     
    Last edited: Aug 25, 2021
  5. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    542
    Hi,
    This is how non-string translations work in I2 Localization:
    http://inter-illusion.com/assets/I2LocalizationManual/AssetsTab.html

    Basically
    - If the object is in a Resources folder, then term's string is the path to that object
    - Otherwise, the object is added to the LanguageSource or the Localize component, and the string becomes the object name.

    To add the object to the LanguageSource, just use:
    Code (csharp):
    1.  
    2. LocalizationManager.Sources[0].Assets.Add( obj );
    3.  
    and then change the TermData to include the obj.Name.

    Hope that helps,
    Frank
     
    ricknexus and Rs like this.
  6. Grumpy-Dot

    Grumpy-Dot

    Joined:
    Feb 29, 2016
    Posts:
    77
    Quick ping on this, any progress on the refactoring of the editor tools?
     
  7. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    542
    Unfortunately I haven't been able to complete that task yet. I have been doing a big refactoring to better handle AssetBundles/Addressables.
    As soon as I release that change, I will continue refactoring the editor to separate those tools.
     
    Falondrian and Grumpy-Dot like this.
  8. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    361
    What do i do if a UI needs a different material on top of a different font asset with text mesh pro?

    For example my new game here has a special material preset
    upload_2021-9-6_18-20-18.png

    But when I change the language it goes to normal.

    upload_2021-9-6_18-20-36.png

    how do I correct this?
     
  9. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    542
    Hi,
    You can change the material in a TMPro text in a couple ways:

    1- Instead of setting the Font as the secondary term, set the Material. When the plugin finds the secondary term is a material it will find the Font associated with that material (as they are named similarly) and then it will set both the material and the name

    or

    2- If your material is named very differently than your font, or you want to use an special material, then you can set the Font as the secondary term and then in your translated text, add the material name like this:
    (e.g. instead of "This is an example", add "[MaterialName]This is an example"
    That way the plugin changes the font (as its the secondary term), and then looks for a material with the name in the tag and sets it.

    Hope that helps,
    Frank
     
  10. Avalin

    Avalin

    Joined:
    Oct 12, 2018
    Posts:
    72
    I'm getting a whole bunch of compiler errors when I import this into my project.
    Am I missing something?
    upload_2021-9-20_22-8-17.png

    Unity version: 2020.3.18f1

    Edit: I tried importing it in a clean project, and that works fine. Something in my project must clash with the asset
     
  11. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    289
    Sometimes in text I want to read a value from code by calling a function with a string parameter, such as "Zombies have {[FUNCTION="STRINGPARAMETER"}] health" How do I call a particular function in C#, passing it a string, from localized text?
     
  12. ricknexus

    ricknexus

    Joined:
    Aug 26, 2021
    Posts:
    1
    Hello,
    I am having a hard time trying to localise images. I created a new term and set it to Texture but whenever I try to drop an image into one of the language slots I get a NullReferenceException and the slot reports the file name in red.

    Full error here:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. I2.Loc.LocalizationEditor.OnGUI_Keys_LanguageTranslations (System.String Key, I2.Loc.Localize localizeCmp, System.Boolean IsPrimaryKey, I2.Loc.TermData& termdata, I2.Loc.LanguageSourceData source) (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Terms_Description.cs:546)
    3. I2.Loc.LocalizationEditor.OnGUI_Keys_Languages (System.String Key, I2.Loc.TermData& termdata, I2.Loc.Localize localizeCmp, System.Boolean IsPrimaryKey, I2.Loc.LanguageSourceData source) (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Terms_Description.cs:238)
    4. I2.Loc.LocalizationEditor.OnGUI_Keys_Languages (System.String Key, I2.Loc.Localize localizeCmp, System.Boolean IsPrimaryKey) (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Terms_Description.cs:229)
    5. I2.Loc.LocalizationEditor.OnGUI_KeyList_ShowKeyDetails () (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Terms_Description.cs:42)
    6. I2.Loc.LocalizationEditor.OnGUI_KeysList (System.Boolean AllowExpandKey, System.Single Height, System.Boolean ShowTools) (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Terms.cs:145)
    7. I2.Loc.LocalizationEditor.OnGUI_Main () (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Localization/LocalizationEditor.cs:81)
    8. I2.Loc.LocalizationEditor.OnInspectorGUI () (at Assets/_ProjectLeo/Plugins/I2/Localization/Scripts/Editor/Inspectors/LocalizationEditor.cs:178)
    9. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:526)
    10. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)
    It really doesn't accept any textures. All of the ones I am trying are set as Default 2D textures. I tried to switch them to Sprites but the result is the same.

    Is it a path issue perhaps? Does the plugin want the full path of the texture in the Assets? Do they absolutely have to be located in the Resources folder? What is causing this??

    Edit: Aha! Perhaps I found out myself that I need to add the images to the Assets using the Assets tab right?
    It would be nice to have a meaningful error when this happens. Feature request?
     
    Last edited: Sep 22, 2021
  13. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    266
    How to make the languages used in my project appear in the store listing as "Supported Languages" when I generate a WSA project.

    I'm having a discussion about it, but I haven't found a solution yet.

    WSA Build - Languages supported by your packages - Unity Forum

    Everything works as expected for iOS and Android.
     
  14. nindim

    nindim

    Joined:
    Jan 22, 2013
    Posts:
    105
    Hi @Inter-Illusion,

    I posted a number of bug reports with Arabic in the I2 Localization forum nearly 4 months ago but there haven't been any replies yet.

    Can you please look to address these issues?

    http://inter-illusion.com/forum/i2-...e-break-bottom-right-aligned-incorrectly#4353

    http://inter-illusion.com/forum/i2-...xt-max-line-length-breaks-rich-text-tags#4352

    http://inter-illusion.com/forum/i2-...adjust-alignment-option-breaks-rich-text-tags

    http://inter-illusion.com/forum/i2-...indnexttag-doesn-t-handle-nested-tags-causing

    I have also emailed the Support email 3 weeks ago to alert you to these unanswered issues but as of yet have received no reply.

    I thought that perhaps this asset had been abandoned as many 1 star Asset Store reviews have gone unanswered and it seems lots of people are struggling to get a response from the developer.

    I really don't want to be pushed into leaving a bad review as the system itself works well, it just has some bugs that need to be addressed.

    Thank you.
     
  15. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    542
    Hi,
    Sorry for not replying earlier.
    Unfortunately, I have had so much spam in the inter-illusion forum and email, that sometimes I have missed valid posts. Please, if you see I haven't replied in a day or two, post in here as Unity forum will warm me and not throw too much spam!
    Regarding the Line Breaks in RTL texts, It seems that TextMeshPro is now requiring the texts to be reversed per line and not entirely reversed as before.
    I have a fix for that issue and is already available for download on the AssetStore. (v2.8.16)
    Hope that helps, and again, sorry for not replying earlier.

    At this moment, the plugin only supports exporting the languages to the store listing for the Android and IOS stores.
    But, I will check on how the WSA handles the store listing and send an update to allow exposing the languages.
     
    wagenheimer likes this.
  16. nindim

    nindim

    Joined:
    Jan 22, 2013
    Posts:
    105
    Hi @Inter-Illusion

    The latest version fixes the issue with manual line breaks vertically flipping the text, thank you for fixing that! (http://inter-illusion.com/forum/i2-...h-line-break-bottom-right-aligned-incorrectly)

    Two other issues I reported are still occurring and mean rich text tags cannot be used for Arabic.
    Can these be looked into, please?

    Thank you!
     
  17. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    542
    Hi
    I'm looking at those two issues, will upload a fix as soon as possible!
     
  18. Falondrian

    Falondrian

    Joined:
    Nov 1, 2017
    Posts:
    25
    Hello,

    I have some questions/requests:

    1. How is the improved LocalizedString editor (that provides the same options as the component) coming along? This would really be a huge convenience feature
    2. It was already suggested previously - I would also like to see a deepl integration for auto translations, its just so much better than google translate, there is no comparison.
    3. I need to be able to provide different translations based on gender and would like to use the same approach you used for plurals - by inserting a [i2p_male] or [i2p_female] tag (one of the two would actually suffice by making the other gender the default). The gender could be provided by the getParam callback via a special keyword like "__GENDER__". I know this isn't optimal for all languages but would absolutely suffice for my use case.

    Now the problem is that it is not possible to globally hook into ApplyLocalizationParams so my only option is to modify I2L source code. I would really like to avoid that for update compability, so it would be great if you could add support for this tag or a global hook that can be used to modify the translation.

    Here a quick implementation (doesnt simultaneously work with the plural tag):

    Code (CSharp):
    1.  
    2.             string gender = getParam("__GENDER__") as string;
    3.             if (gender == null || (gender != "male" && gender != "female" && gender != "neuter"))
    4.             {
    5.                 #if UNITY_EDITOR
    6.                 if (gender != null || translation.Contains("[i2p_male]") || translation.Contains("[i2p_female]") || translation.Contains("[i2p_neuter]"))
    7.                     Debug.LogWarning($"No (valid) gender provided in localization param, defaulting to male. Param: {gender}. Translation: {translation}");
    8.                 #endif
    9.                 gender = "male";
    10.             }
    11.  
    12.             string genderTag = "[i2p_" + gender + "]";
    13.             idx0 = translation.IndexOf(genderTag, StringComparison.OrdinalIgnoreCase);
    14.             if (idx0 < 0)
    15.                 idx0 = 0;
    16.             else
    17.                 idx0 += genderTag.Length;
    18.  
    19.             idx1 = translation.IndexOf("[i2p_", idx0 + 1, StringComparison.OrdinalIgnoreCase);
    20.             if (idx1 < 0)
    21.                 idx1 = translation.Length;
    22.  
    23.             translation = translation.Substring(idx0, idx1 - idx0);
    24.  
     
    Last edited: Oct 13, 2021 at 9:07 PM
  19. BAIZOR

    BAIZOR

    Joined:
    Jul 4, 2013
    Posts:
    91
    I have Term named "continue" and just used Code Generation feature for terms. You may super simply fix it. Just need to add @ at the variable start. It will work! Please do this natively into the plugin! Thanks!
    upload_2021-10-17_0-43-21.png
     
unityunity