Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

I2 Localization ( The most complete Localization solution for Unity )

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

  1. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    422
    Hi there! If user has Tradition Chinese, which string i will get from GetCurrentDeviceLanguage(true) method?
     
  2. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    I would like the ability to trigger a google spreadsheet import programmatically in Edit mode, so it updates the asset file. Currently one has to open the asset file, navigate to the Spreadsheets tab, and click the Import/Replace button.

    During development I am adding / tweaking / changing translations and texts very often, so if I could just call a public static function inside my own editor tools to trigger the updating it would help increase development speed a lot.

    EDIT: Actually, I've been able to do it myself by looking at the I2 inspector source code.
     
    Last edited: Dec 9, 2019
  3. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I'm trying to get a string, which can have plurals, translated only through API calls.
    I can't seem to get this working as I always get the complete string template (0s, 1s and plurals). This is my code:
    Code (CSharp):
    1. starsManager.SetParameterValue("{NR}", Contract.StarsNeed2Unlock.ToString());
    2. string reqStarsString = I2.Loc.LocalizationManager.GetTranslation(".STARS. needed to unlock");
    Do I miss something? Note starsmanager is a Dynamic Parameter component added to the gameobject.
     
  4. ink13

    ink13

    Joined:
    Nov 14, 2013
    Posts:
    37
    Does anyone have any experience with this not working on an apple tv build?
    It seems like after it goes through xcode the translation doesn't work anymore - everything goes to fallback... I've tried changing a few build settings - but curious if anyone has any advice...?
     
  5. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    I just returned from vacations a couple day ago and haven't catch up with the support (when there are big sales, support tends to take longer and with all the emails and message, I may have missed some I thought I already answered, sorry about that).
    Said that, for some reason, the unity forum was not notifying me of replies to the smartedge topic, seems that after some time I have to re-add it to the watches forums or notifications stop.
    Anyway, as soon as I get back home I will check that bug.

    Hope that helps,
    Frank
     
    SugoiDev likes this.
  6. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    637
    Thanks a lot for reply ;) Hope you could fix that cause overall your asset is great, let me know if you need any more info, But I think that exception happends always.
     
  7. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    158
    Hi,

    I have this label that uses 2 strings... the main string is in the localized component but there is that I assign dynamically using LocalizedString, it's a, lets say, ammo counter... the localized string would be "{[ammoCount]} Ammo" but when they don't have it says "NO AMMO" so in this way I do that programmatically.

    Is there a way to tell this LocalizedString to use secondary font for each language? Will it use the one in the component even when using LocalizedString programatically?

    Thanks.
     
  8. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    158
    @Inter-Illusion

    Hi, I'm having a problem when changing languages, the font is not changing to the secondary.

    I made a video for you to check out properly here



    for some reason the font remains the same as the original, maybe I missed a step... but I think I followed everything.
     
  9. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    The problem you are seeing is because the term RegularFont that contains the font for each language, is using Font, but TextMeshPro is using a TMPro font asset not a ttf.

    So, instead of pointing to the ttf you used to generate the Font Asset, you should point to the actual font asset that was generated and which is the one you need for rendering the texts.

    To do it, just change the type of the RegularFont term to TMP font asset and then it will allow you selecting the TMP_FontAsset instead of the ttf.

    Hope that helps,
    Frank
     
    esteban16108 likes this.
  10. francismoy

    francismoy

    Joined:
    Jul 5, 2017
    Posts:
    45
    Hi,

    I have a (possibly stupid) question about the "Force Localize" flag. This is the situation:

    I have a settings panel with several buttons with text. Some of these texts (let's call them the first group) have these components, in this order:

    - Localize
    - TextMeshPro UGUI

    Others (the second group) have these same components, but in a different order, i.e:

    - TextMeshPro UGUI
    - Localize

    When I change the language in the settings, using:

    Code (CSharp):
    1. I2.Loc.LocalizationManager.CurrentLanguage = language;
    2. I2.Loc.LocalizationManager.LocalizeAll(true);
    , only the texts in the first group are translated, unless I add the "Force Localize" flag to the second group, in which case all of them are translated.

    But this weird behavior only occurs on Android builds. It works fine in the editor.

    Am I missing something?

    I'm using version 2.8.12f1
     
  11. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    536
    Hello I have a doubt about how to apply the I2Loc to my project.
    I've made the web service with the spreadsheet and I saw on the tutorials how to apply the Localize Component to the gameobjects with the texts we want translated.
    But I have a considering big amount of game objects generated dynamically and taking its value from ScriptableObjects.
    Im guessing I should add the Localize component dynamically adding it's corresponding term in runtime.
    I also thought if there might be a way of, when reading the scriptableObjects, do the translation in that moment so I would have the translated string during all the app lifetime.

    Im not sure if there's any other approach about this but I would really appreciate your guidance here.

    Thanks a lot.
    pistoleta
     
  12. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    536
    Ok I just added the Localize component without any term and when I instantiate it I add the term by code ; works fine.
    I guess this is the right way to do it, otherwise please let me know.
    Thanks!
     
  13. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Hey @Inter-Illusion . I'm sure you're on the case but just a heads up that there are compile errors in the newly-released Unity 2019.3.

    The GUIText and GUITexture appear to be deprecated now I think??

    LocalizeTarget_UnityStandard_GUIText
    LocalizeTarget_UnityStandard_GUITexture

    My game compiles if I delete these two scripts (which is fine for me since I don't use them).
     
    Shredsauce and yuliyF like this.
  14. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi, the current version of I2 Localization in the Asset Store doesn't include those files.
    If you update to latest, it should be fixed.
    Said that, there are some times that unity doesn't correctly delete all files when updating assets, so, if you still have the files after updating, please, delete the I2 folder and install the plugin again. That will make sure all new files are in, and all old files are deleted.

    Hope that helps and thanks for the heads ups!
    Frank
     
  15. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    My bad! Just updated to the latest and it worked fine. Thanks for the info :)
     
  16. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
    When will be a new version for 2019.3 - ?
     
  17. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    The current assetstore version works with Unity 2019.3.
    Are you having any issues in that version?
     
  18. robal1991

    robal1991

    Joined:
    Mar 31, 2016
    Posts:
    32
    Hi. I have a problem with I2 loc CSV import.

    I have a script that on start imports CSV into I2 languages asset. I have 2 languages there: Polish and English. My line endings in CSV file are currently CRLF (\r\n). After CSV import "carriage return" character (CR) is added to terms in English language and my text is displayed incorrectly (for example when I concat 2 terms from script).

    In LocalizationReader I see that only \n is treated as line ending, shouldn't there also be checking if c == '\r' ?

    What is the correct solution to that? Should I remove \r from my csv file? Is there any other way to fix this?

    I'm using I2 Loc 2.8.13 f2 and Unity 2019.3.
     
    Last edited: Jan 30, 2020
  19. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    637
    @Inter-Illusion Hi I'm tyrying to use

    "
    string tempSubs = I2.Loc.LocalizationManager.GetTermTranslation(text);

    I2.Loc.LocalizationManager.ApplyLocalizationParams(ref tempSubs, null);
    if (tempSubs != null)
    {text = tempSubs;}

    "

    To translate my text and aply parameters but what I see is:
    upload_2020-1-30_13-46-28.png


    I tried to find any api documentation to your product but there is nothing liek that on your webpage so i decided to ask

    I added ApplyLoclizationParams because On gettermtranslation dont change parameters

    EDIT: IT WORKS!

    but only when using I2.Loc.LocalizationManager.ApplyLocalizationParams(ref tempSubs); instead of I2.Loc.LocalizationManager.ApplyLocalizationParams(ref tempSubs, null); Coudl you please explain why? I mean there is really need of some api documentation, Asset is awesome but without full api documentation hard to understand what is going on here.


    Also it works only in playmode is there way to give it a work also in cutscenes when using in editor on enter ?
     
    Last edited: Jan 30, 2020
  20. MikeSz

    MikeSz

    Joined:
    Jul 7, 2014
    Posts:
    27
  21. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
    in LocalizeTarget_UnityStandard_GUIText.cs

    Code (CSharp):
    1. public class LocalizeTarget_UnityStandard_GUIText : LocalizeTarget<Text>
    2. ...
    3. mAlignment_LTR = mAlignment_RTL = mTarget.alignment;
    4. ...
    5. if (cmp.CorrectAlignmentForRTL && mTarget.alignment != TextAlignment.Center)
    6.                     mTarget.alignment = (LocalizationManager.IsRight2Left ? mAlignment_RTL : mAlignment_LTR);
    and LocalizeTarget_UnityStandard_GUITexture.cs : I change GUITexture by Texture

    if run on 2019.3
     
  22. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi, the current version of I2 Localization in the Asset Store doesn't include that file.
    If you update to latest, it should be fixed.
    Said that, there are some times that unity doesn't correctly delete all files when updating assets, so, if you still have the files after updating, please, delete the I2 folder and install the plugin again. That will make sure all new files are in, and all old files are deleted.
     
  23. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    The latest version of I2 Localization is compatible with Unity 2019.3. But I have never tried setting it using the Package Manager.
    Will try that and let you know if I can reproduce the problem.
    BTW, do you also get the same issue if you let the plugin in its default location?
     
  24. mikleas

    mikleas

    Joined:
    Dec 31, 2014
    Posts:
    10
    Hi!
    Is there any way inside Unity-I2 Asset of iterate for each UI text and generate a key file with all the texts available? Also adding a i2 localization to that UI text would be awesome...
    Thanks!
     
  25. bigpants

    bigpants

    Joined:
    Dec 9, 2009
    Posts:
    48
    [SOLVED] unable to access the webservice - error
    (just adding this here in case anyone runs into it)


    Problem
    I installed I2 Localization March 2019.
    Everything has been working perfectly.
    I update the google sheet, and using the Unity 2020 IDE I replace the local version.

    Today (March 1, 2020), when I hit replace I got the error "unable to access the webservice"
    When I hit "Verify", I got the same message.

    Solution
    From what I can discern, Google upgraded the I2 app service code to v8.
    Disable v8 and I2 localization can replace again
    "Select Run > Disable new Apps Script runtime powered by V8."
    developers.google.com/apps-script/guides/v8-runtime
     
  26. parker87tinh

    parker87tinh

    Joined:
    Jun 5, 2015
    Posts:
    8
    Thanks you bro, You save my day :)
     
  27. ReyJoy

    ReyJoy

    Joined:
    Mar 11, 2020
    Posts:
    2
    Still doesnt work for me :(
     
  28. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    I had the "unable to access the webservice" error too. Reinstalling the Google plugin using the Install button next to Verify in the Inspector fixed it for me.
     
  29. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    426
    Is it compatible with the fast enter play mode (no domain reload) feature of unity?
    When and what to expect from the next update of this asset?
     
    Last edited: Mar 15, 2020
  30. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
    How can I update data from google sheet in real time? Now it's updated only after restart game
     
  31. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    To avoid accessing the spreadsheet too often (some players may not have unlimited internet), the plugin only checks the spreadsheets when the game starts.
    If you want from your code to trigger a check and update if there are changes, you can call:

    Code (csharp):
    1. I2.Loc.LocalizationManager.Sources[0].Import_Google(true);
    Hope that helps
    Frank
     
  32. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
    I found answer:
    Code (CSharp):
    1. I2.Loc.LocalizationManager.UpdateSources();
    And now I have a new question: can I load some new data in real time to the spreadsheet? I try this:
    Code (CSharp):
    1. var source = new I2.Loc.LanguageSourceData();
    2. var term = source.AddTerm("newText", I2.Loc.eTermType.Text);
    3. term.SetTranslation(0, "load new text");
    4. I2.Loc.LocalizationManager.AddSource(source);
    It doesn't work
     
  33. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    >> can I load some new data in real time to the spreadsheet?

    No, for security reasons, the plugin doesn't support writing to the Spreadsheet from the built game. It only writes to spreadsheet from the editor. That way the possibility of the game to be hacked and the changes to spread to other players is reduced.

    Said that, you can look at the script to Export_Google and make a copy of that code outside the Editor folder and it should work with just little changes.
     
  34. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    188
    I do it, man, thanks for plugin), the function:
    Code (CSharp):
    1. Export_Google_CreateWWWcall();
    it's help for my editor to be more communicate between developers. Only for developers
    I thinks, it's not a best way to save/update some info, but no time to find something else some REST API
     
  35. KylesDev

    KylesDev

    Joined:
    Nov 16, 2016
    Posts:
    1
    Hi, how can i hide the google spreadsheet key from the assets of my game? Right now anyone who takes a look at the unpacked asset has access to the file with write permissions, just because he can read the spreadsheet key saved in plain text
     
    yuliyF likes this.
  36. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    Thanks for the suggestion, I'm changing that code so that the spreadsheet key will be obfuscated by default and splitted into variables so they don't get in the same memory space and easily readable.

    Said that, they only have read permisions from that key (which is what your game will normally do).
    But for writing permisions, the webService also asks for the password you set in the editor. And that password is an Editor only variable, so it never gets saved into the game build.

    Hope that helps,
    Frank
     
  37. tonyhan

    tonyhan

    Joined:
    Dec 29, 2015
    Posts:
    12
    I add the component "I2Localize" on some prefabs in my project , run the game , then stop the game.I find that some prefabs were changed. I use a diff tool , and find it is caused by the I2Localize.
     
  38. fakegood

    fakegood

    Joined:
    Oct 11, 2013
    Posts:
    31
    Hi, i am writing regarding https://forum.unity.com/threads/i2-...olution-for-unity.231226/page-12#post-3744691

    I've set Auto Update Frequency to Never. However, new sheet data was not built into a live game. I've update the data in Editor, but when users update the app, the localized text was never the latest text.

    1. I cannot make any WWW request for my game.
    2. I cannot possibly ask my existing users to delete the game, that will make them lose their save files as well.

    Can I know is there a way to delete cached localization text?
     
  39. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    If you update the spreadsheet, and then download it from the editor into Unity. The plugin will save all the translation data into the LanguageSource Asset.
    That asset also has the "last modified" date of the spreadsheet. And its included in your game build.

    When players download or update the game, all the location data from the editor is built inside the game. And even if they have already localization data downloaded, given that the "modified date" is newer than the one they downloaded, they will use the one that came inside the game's build.

    Is that not happening to you?
    Be sure that you have modified the spreadsheet before downloading it in the Editor so that it marks it as "new" data.

    Hope that helps,
    Frank
     
  40. fakegood

    fakegood

    Joined:
    Oct 11, 2013
    Posts:
    31
    Yup, I have the updated LanguageSource Asset. It is marked as changed for git.
    However, built version do not seems to be getting the text from the latest LanguageSource.

    This behaviour is consistent among Windows target, macOS target, iOS target, iPadOS target, and tvOS target. And it is only happening on devices not in Editor, Unity Editor is getting the latest text.

    My current workaround is to always duplicate new Google Sheets and download the content. This would update the text, however after the game is deployed, it will be cached again and duplicate actions will need to be repeated to fix the issue.

    To add on, the behaviour in the build is, existing text will not get updated, and new localized entry will return empty strings. Old texts are still localized without issues, just the new changes are not applied into the build.

    My only guess is the game is getting data from previous data instead of the current data. But whether the new data is included or the new data is exported properly into the build, that one I have not verified or being able to verify it. Writing in hoping to get some insights :)
     
    Last edited: Apr 24, 2020
  41. xanaramus

    xanaramus

    Joined:
    Sep 21, 2018
    Posts:
    4
    Hello! Is there any way l2 to track l2 components in prefabs?
     
  42. Caruos

    Caruos

    Joined:
    Dec 30, 2016
    Posts:
    42
    Hello,

    I'm bringing back a post from December 4th 2018 because there have been some big changes on I2 Localization, and the module intended to bridge I2Localization and NodeCanvas doesn't work anymore.

    Here is the code that used to work :

    localizeObject = NodeCanvas.Editor.BBParameterEditor.ParameterField("Localize Object", localizeObject) as BBParameter<Localize>;

    var terms = (!localizeObject.isNull && localizeObject.value.Source != null)
    ? localizeObject.value.Source.mSource.GetTermsList()
    : LocalizationManager.GetTermsList();

    And here are the error messages :
    Assets\NodeCanvas-I2Localization-master (V2)\NodeCanvas-I2Localization-master\unity-project\Assets\NodeCanvas Integrations\I2 Localization\Tasks\Actions\I2SetTerm.cs(55,50): error CS1061: 'ILanguageSource' does not contain a definition for 'mSource' and no accessible extension method 'mSource' accepting a first argument of type 'ILanguageSource' could be found (are you missing a using directive or an assembly reference?)

    It seems like the error comes from the LocalizeInspector.cs component, since the "LanguageSource" object was replaced by "ILanguageSource" with different properties.

    Could you please tell me how to get the terms list with the new ILanguageSource ?
     
  43. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    It seems that the NoteCanvas module was written for an old version of I2 Localization and wasn't updated.
    To fix that issue, just change all the places where the variable mSource is used by SourceData.

    It should look like:
    Code (csharp):
    1.  
    2. var terms = (!localizeObject.isNull && localizeObject.value.Source != null)
    3.                    ? localizeObject.value.Source.SourceData.GetTermsList()
    4.                 : LocalizationManager.GetTermsList();
    5.  
     
    Caruos and Freznosis like this.
  44. Caruos

    Caruos

    Joined:
    Dec 30, 2016
    Posts:
    42
    It solved the error. Thank you !
     
  45. fakegood

    fakegood

    Joined:
    Oct 11, 2013
    Posts:
    31
    Can I know is this issue being looked at or I will have to find out the solution myself?
     
  46. tobiasz90

    tobiasz90

    Joined:
    Sep 10, 2014
    Posts:
    1
    Hi all,
    First of all, many thanks for your great asset! It works fine so far...

    However, I have a following problem when trying to build for Android:
    Code (CSharp):
    1. Assets\I2\Localization\Scripts\Editor\UpgradeManager.cs(68,10): error CS0246: The type or namespace name 'MenuItem' could not be found (are you missing a using directive or an assembly reference?)
    And similar errors for every class in the Assets\I2\Localization\Scripts\Editor\ directory. Moving I2/ directory to the Editor/ doesn't help. I tried with using #if UnityEditor but it doesn't seem to be the right solution.

    Unity version: 20193.3.13f1
    Dependencies: TMPro

    Kind regards,
    Tobiasz
     
  47. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi, have you added an AssemblyDefintion file to your assets folder or to the I2 folder?
    If you have, that could explain why the UpgradeManager is compiling in your game and not just in the editor.

    The solution is to add another AssemblyDefinition file in the Editor folder and mark the Editor as the only platform.

    Hope that helps,
    Frank
     
  48. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,337
    Why you don't answer my email?

    I can't sync google.

    See video plz.

     
  49. Inter-Illusion

    Inter-Illusion

    Joined:
    Jan 5, 2014
    Posts:
    597
    Hi,
    It seems I missed your email.

    When you click Update button (the blue one) in that image, Google shows that it needs permissions, but because this app hasn't been verified by google, it shows a warning.
    I already submitted a request for google to verify it, but it has taken months and it hasn't been verified yet.

    When you click the blue button and select the account to verify the permissions, google shows this (at least in english) with a link to advance (one of the words in your screen is a link, mouse over them to see which one).
    upload_2020-6-23_11-7-58.png

    After clicking advance, it opens this:
    upload_2020-6-23_11-8-21.png

    When you click the Go to ....... (unsafe) it skips the warning and lets you grant the permissions.

    Hope that helps,
    Frank
     
  50. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,337
    But as you can see my video, after the select google account, my error message window does not have advanced nor blue button [Back to safety]. I enlarged the pop up window, but there is none.

    And error message's english translation is, [At this app, google login is stopped to use temporarily, this app does not get google's approval for use google login.]

    So overall, message is similar with yours, but there is no [Advanced] link.