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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unable to change locale (build)

Discussion in 'Localization Tools' started by d3cim0, Jun 10, 2022.

  1. d3cim0

    d3cim0

    Joined:
    Jun 6, 2018
    Posts:
    8
    Hi there!

    The code below works as a charm in the editor when I want to change a locale but after creating a build the same code does not change the language selected, so I was wondering if I'm missing something.

    Code (CSharp):
    1. public void SetLanguage(int index)
    2.     {
    3.         SetLocalization(index);
    4.     }
    5.  
    6.     void SetLocale(Locale locale)
    7.     {
    8.         LocalizationSettings.SelectedLocale = locale;
    9.     }
    10.  
    11.     public void SetLocalization(int languageIndex)
    12.     {
    13.         if (languageIndex < LocalizationSettings.AvailableLocales.Locales.Count)
    14.         {
    15.             SetLocale(LocalizationSettings.AvailableLocales.Locales[languageIndex]);
    16.         }
    17.     }
    Thanks in advance!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,876
    Did you build the addressables?
     
  3. d3cim0

    d3cim0

    Joined:
    Jun 6, 2018
    Posts:
    8
    Hi Karl, I'm actually doing so right now and I'm waiting for the build to be created, thanks for the reminder since I forgot to do it at the first attempt. I will let you know if this solves the issue in a few minutes.
     
  4. d3cim0

    d3cim0

    Joined:
    Jun 6, 2018
    Posts:
    8
    That was indeed the reason. So I'm attaching a screenshot to point out where to go in order to fix the issue in case someone else finds the same scenario. Thanks a lot for your help!

    upload_2022-6-10_21-9-46.png
     
    Last edited: Jun 10, 2022
    karl_jones likes this.