Search Unity

[Solved] Unable to add Available Locales

Discussion in 'Localization Tools' started by Caio_Lib, Jan 4, 2019.

  1. Caio_Lib

    Caio_Lib

    Joined:
    Mar 4, 2014
    Posts:
    83
    Hi!
    First of all, thanks for Localization Tools!

    I'm unable to add Available Locales in my project ( it doesn't show me any error or console message ). The Available Locales' grid is always empty.
    Steps to reproduce:
    1 - Create an empty project.
    2 - Added "com.unity.localization": "0.2.2-preview" to manifest.json
    3 - Edit > Project Settings > Localization > Create > Save
    4 - In Localization > expand Available Locales > Locale Generator > add English, Spanish and Portuguese ( Brazil ) > Generate and Add Locales
    4.1 - Add shows me all Locales generated but doesn't add them to the grid.
    4.2 - Add All doesn't add them.

    More info:
    Unity: 2018.3.0f2
    Mac: 10.14.2

    Thank you!
     
    karl_jones likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    Hey thanks for trying out the Localization package!

    By default we don't automatically add them to the Localization Settings however Add All should work. When you added the Locales where did you save the Locale asset files to? Was it in the Assets folder?
    Did it actually create the Locale asset files?
     
  3. Caio_Lib

    Caio_Lib

    Joined:
    Mar 4, 2014
    Posts:
    83
    Thanks for the quick response karl_jones!

    1 - Yes. The Localization Settings/Locales is in Assets' root folder.
    2 - Yes. All Locales assets have been generated.

    Image after clicking Add All:



    Image after clicking Add:




    Thank you!
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    Thanks. I think it may be an issue with the Addressables not having a settings file, it should be created automaically. Ill take a closer look. Thanks for reporting the bug.
     
    Caio_Lib likes this.
  5. Caio_Lib

    Caio_Lib

    Joined:
    Mar 4, 2014
    Posts:
    83
    Thank you karl_jones!!

    When clicking Addressable checkbox in Localization Settings file it worked!
    After that I clicked Add All and all Locales files have been added.

    I don't know about Addressables yet but it's working now!
     
    karl_jones likes this.
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    Thanks. That Addressable checkbox is completely unrelated to localisation but I guess it forced the settings file to be created ;)
    We just need to do the same with the add all button. Thanks
     
    Caio_Lib likes this.
  7. Eco-Editor

    Eco-Editor

    Joined:
    Jun 29, 2016
    Posts:
    71
    Hello @karl_jones
    I'm having an issue adding "available locales" to the localization settings.
    I already did what this thread suggested: https://forum.unity.com/threads/loc...not-in-a-compiled-build.1055630/#post-6828803
    It didn't work for me.

    The console shows there's a null reference in the Locales Provider script.
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Localization.Settings.LocalesProvider.ResetState () (at Library/PackageCache/com.unity.localization@1.0.3/Runtime/Settings/LocalesProvider.cs:139)

    My steps:
    1. Create Localization Settings Asset
    2. Press "Local Generator" button
    3. Choose the desired languages in "Local Generator" window and press "generate locales"
    4. Save generated locals assets in a folder under "Assets/Game/Localization/Locales"
    5. Open Addressables group window -> Choose "Localization - Locales" (it's greyed out) -> chose for "Bundle Naming Mode": Append Hash to File Name" -> in Build: Clean build -> build default -> success message in console appeared.
    6. Back to Localization Settings Asset -> Available Locales list is empty, it only has a "-" and I cannot add any locales, as if there's no available locales in the project.
    7. Pressing the "Add all" button in the setting -> gives the error mentioned above (my list is empty and thus probably the null ref.)

    Question: How come my project doesn't "See" the locales I've generated?
    Question 2: Why there's no "+" sign to add locales, is it automatically added?
    View attachment 933718

    Thank you!
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    What version of unity are you using?
     
  9. Eco-Editor

    Eco-Editor

    Joined:
    Jun 29, 2016
    Posts:
    71
    Hi, I'm using version 2019.4.12f
     
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    Could you please try updating to the latest 2019.4?
     
  11. Eco-Editor

    Eco-Editor

    Joined:
    Jun 29, 2016
    Posts:
    71
    Not sure this is related.
    I opened a new project just for Localization tools and downloaded the Example content -
    in the Localization Settings Asses the Available locales were in the list, "greyed" - so I understand it is automatically set.

    it was in Unity 2019.4.12f version.
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    The reason for your error is that there is an old bug with SerializeReference that would cause some classes internal variables to become null. That is the null ref exception you are seeing. If you update to the latest 2019.4 the bug is fixed.
     
  13. Eco-Editor

    Eco-Editor

    Joined:
    Jun 29, 2016
    Posts:
    71
    @karl_jones upgrading to Version 2019.4.31f solved my issue.
    Thank you!
     
    karl_jones likes this.