Unity Localization: Add support for Multiple Languages [1/2]

Поділитися
Вставка
  • Опубліковано 4 лют 2025

КОМЕНТАРІ • 70

  • @RootGames
    @RootGames  2 роки тому +3

    👉 Part 2: ua-cam.com/video/XLv79XcbYXc/v-deo.html

  • @sylwestronio
    @sylwestronio 2 роки тому +5

    Best tutorial on that subject. Period.

  • @krzysztofpaszkiewicz1274
    @krzysztofpaszkiewicz1274 2 роки тому +4

    I was looking for how to change the language using buttons. Thank you, this is really helpful.

  • @yazidelalaouiismaili674
    @yazidelalaouiismaili674 2 роки тому +17

    i have an issue in 2:57 , when trying to select the table , it shows me none , eventho i created a string table and filled it
    edit: I fixed it, I manually downgraded the version of localization package in manifest.json to 1.0.5

    • @junoxii6181
      @junoxii6181 2 роки тому +36

      just found out there is solution without downgrade.
      Go to Edit>Preferences>Localization> then Un-tick String Search Picker. Problem solved

    • @matthewpistella4391
      @matthewpistella4391 2 роки тому +1

      @@junoxii6181 Thanks so much!

    • @ДосталиЕвский
      @ДосталиЕвский Рік тому +1

      @@junoxii6181 Thanks a lot, you saved mu sanity!

    • @alissabrave424
      @alissabrave424 5 місяців тому +1

      @@junoxii6181 Life saver! Thank you so much!

  • @ThiagoPrego
    @ThiagoPrego Рік тому +2

    Thank you so very much. May the Lord bless you always.

  • @jhgfghjfuzrtfchchghgf
    @jhgfghjfuzrtfchchghgf 2 роки тому +1

    cheers mate thank you! your videos taught me exactly what I was looking for. amazing :)

  • @metinbatuhanozucan5358
    @metinbatuhanozucan5358 Рік тому

    Thank you that video helps me so much.

  • @KochalochGames
    @KochalochGames Рік тому

    Awesome Tutorial, Thanks!

  • @x_triff_x
    @x_triff_x 5 місяців тому +1

    If you have, for example, the language buttons (english, spanish, etc.) in the Main Menu scene, will they change the language of the texts in the other scenes of project too?

  • @micktt7
    @micktt7 5 місяців тому

    Thank you for a very useful lesson.
    Here they have already asked about the compatibility of the script between scenes, but I would like to clarify something - I have LocalizationManager on the initial scene, which works, for the main game scene I also need to add an empty object, bind the script to it, and then how to select text objects in the first scene elements for translation?

  • @DonCuche_pausa
    @DonCuche_pausa 3 місяці тому

    amazing video, ty very much

  • @OldschoolGamingAdventure98
    @OldschoolGamingAdventure98 5 місяців тому +1

    Thanks for this video! In russian part of UA-cam methods of localization is very bad:) I hope you will go on

  • @seventeam440
    @seventeam440 2 роки тому +2

    Hello, please tell me why I have such an error in this script (switching the language with buttons)?
    Script\Localozation.cs(21,62): error CS0117: 'LocalizationSettings' does not contain a definition for 'Locales'

  • @PTPlottwist
    @PTPlottwist 18 днів тому

    thanks

  • @casachezdoom2588
    @casachezdoom2588 2 роки тому +2

    Thanks, this was super helpful and straightforward. You explain everything step-by-step.
    One question:
    I notice when you run the app it will first display the English text and flag, and then switch to whichever ID you had selected previously. How would you prevent that from happening and instead display the saved ID straight away?

    • @RootGames
      @RootGames  2 роки тому

      I think that this will not be visible if you use some kind of fade in/out effect. The loading will be done in that time while the screen is black. If that doesn't help you, try to explore if you can change the default language after selecting it. It's just an idea, don't know if it's possible.

    • @casachezdoom2588
      @casachezdoom2588 2 роки тому +3

      @@RootGames That's one way to hide it. I will try to look further into this and reply here if I find another solution. Thanks for your suggestion!

    • @casachezdoom2588
      @casachezdoom2588 2 роки тому

      ​@@RootGames I tried to change the .SelectedLocale to the last saved ID right in the Start() method before calling ChangeLocale() and it still displayed ID 0 at first.
      So what I ended up doing is a variation on what you suggested:
      - First I disabled the Canvas object in the hierarchy so nothing is displayed at first
      - Then I declared a "public GameObject canvas;" so we can access it in the script
      - Then in the IEnumerator, just before the "active = false;", I added "canvas.SetActive(true);" to re-enable the Canvas object and display the buttons, text, and flag.
      - After saving the script, from the hierarchy I dragged the Canvas object into the "Canvas" slot on the LocalizationManager object.
      This way any initialization or switching of IDs is done behind the scenes and once the canvas is set active it only displays the ID that was previously saved to PlayerPrefs.
      I have a feeling Unity either displays ID 0 by default when first displaying the objects, or at the moment the initialization occurs.

    • @ДосталиЕвский
      @ДосталиЕвский Рік тому

      @@casachezdoom2588 Did you find another solution? I used awake instead of Start and it did not help me

  • @Indiecodes
    @Indiecodes 4 місяці тому

    Best Video Ever

  • @prithivirajchandrasekar711
    @prithivirajchandrasekar711 2 роки тому +1

    proud to be ur 1000th sub!

    • @RootGames
      @RootGames  2 роки тому

      Because of that, contact me on Instagram or Twitter to get my Udemy course for free 😊

  • @MrRomainlalire
    @MrRomainlalire Рік тому

    Super tutorial! It helped a lot! But I have a quick question, is it possible to display a default text without having to run the app? It would be helpful to choose the right size/settings of the texts

  • @horiidonuts
    @horiidonuts 10 місяців тому

    Awesome stuff. Just one thing. I'm trying to select the language with dropdown menu instead of buttons. How am I going to do that? I'd be very pleased if you reply. 🙏

    • @RootGames
      @RootGames  10 місяців тому +1

      Check my tutorial about resolutions, there I show how to choose resolution with a dropdown menu. That might give you an idea how to do it.

  • @haarissheikh3187
    @haarissheikh3187 2 роки тому +1

    Hi, amazing video. Best localization video I have seen. I do have 1 question. Might be stupid. But does this work for just 1 scene or multiple scenes. So if I select the language here. How does it configure to the other scenes in my project? Thank you

    • @RootGames
      @RootGames  2 роки тому +1

      I just played with the localization package when it came out to see possibilities, so all my testing was done in one scene. I would assume that settings are applied to all text that is using the package. If you find out more, please share it in the comments :)

    • @haarissheikh3187
      @haarissheikh3187 2 роки тому +1

      Will do 👍

  • @emirhana61
    @emirhana61 4 місяці тому

    I don't want to use a button in this process. For example, if the user's device is English, the language should be English, if it is Spanish, the language should be Spanish automatically. How can I do this?

    • @fratpolat7810
      @fratpolat7810 3 місяці тому

      pasam sen de cok sey ıstıyorsun

    • @cang34
      @cang34 2 місяці тому +3

      LocalizationSettings -> Locale Selectors. Move the 'system locale selector' to first place.

  • @HeroSpiderman
    @HeroSpiderman Рік тому

    Hi, quick question. I've looked all over the web but can't find it.
    How do I request the Active Locale int ?
    I seem to only be able to {get} a string.
    For instance for English the string I get is "English (en)".
    This has helped me so much, thank you!

    • @HeroSpiderman
      @HeroSpiderman Рік тому

      So for reference.
      I need to know which locale id (int) is active, so i can apply a font for Latin / Cyrillic / etc. languages.
      Right now, I've got it to work like so:
      void Awake ()
      {
      for (int i = 0; i < LocalizationSettings.AvailableLocales.Locales.Count; i++)
      {
      if (LocalizationSettings.SelectedLocale == LocalizationSettings.AvailableLocales.Locales[i])
      {
      My_function_which_needs_the_locale_as_an_integer(i);
      break;
      }
      }
      }

  • @ShadowUsurper
    @ShadowUsurper 2 роки тому +2

    Hey, this is an amazing video tutorial. But I still have one question, can you help me?
    If you use a Localized string event, it is updated even if the object is turned off (or rather, it is updated when it is turned on)
    But if you use GameObject Localized, then this does not happen, is there any way to do this?

    • @RootGames
      @RootGames  2 роки тому

      I wouldn't know. It can be a bug. Try to raise an issue on the Unity forum. Unity stuff is really good and responds to possible bugs/solutions.

  • @Joshua123z
    @Joshua123z Рік тому

    This is a great video, but for Chinese TMP seems to be a big problem. Seems that normal text works fine with Chinese. Is there a way to make it use TMP for English and normal text for Chinese?

    • @vistaero
      @vistaero Рік тому +1

      Just use a font that includes chinese characters and make sure you include its Unicode range to the atlas. Look for the subject online.

  • @mythoredofficial
    @mythoredofficial 2 роки тому +2

    hi i m mr red! hope u remember me, i lost my account on discord as well as on udemy! wish if I got this course back lol

  • @Nelsa406
    @Nelsa406 11 місяців тому

    I...... Messed that up in my under-progress Baldi mod.

  • @SPA22Y
    @SPA22Y 5 місяців тому

    is it possible to make a this work with a drop down?

    • @RootGames
      @RootGames  5 місяців тому

      Yes

    • @SPA22Y
      @SPA22Y 5 місяців тому

      @@RootGames can you possibly show how? or answer with a script, Thank you very much

  • @rpmx1399
    @rpmx1399 2 роки тому

    Does anybody have an issue where the English words randomly disappear when playing? If so how do I fix it?

  • @anonym21463
    @anonym21463 Рік тому

    how i can make this with a dropdown menu?

  • @GameDeveloperTR
    @GameDeveloperTR 2 роки тому +1

    Thx bro

  • @ErfanUnity
    @ErfanUnity 7 місяців тому +1

    Good

  • @Esimaxchannel
    @Esimaxchannel Рік тому

    Is there a way to localize UI toolkit?

    • @RootGames
      @RootGames  Рік тому

      When I was making this tutorial, it wasn’t possible. It was in Unity’s plans but don’t know the current situation.

  • @RenanRanciaro30
    @RenanRanciaro30 2 роки тому

    Nice tutorial. But how can i localize an enum value?

    • @RootGames
      @RootGames  2 роки тому

      I never used enums with the localization package. but in the next part, I will show how to localize dynamic text that uses integers for keeping the score. Maybe that will help you to figure out something.

  • @fv4202x
    @fv4202x 2 роки тому +5

    tip: if (active == true) is equal to if (active)

    • @RootGames
      @RootGames  2 роки тому +4

      I know but I write it explicitly so everyone can understand it :)

  • @musabkara1684
    @musabkara1684 2 роки тому +18

    using System.Collections;
    using UnityEngine;
    using UnityEngine.Localization.Settings;
    public class LocaleSelector : MonoBehaviour
    {
    private bool _active = false;
    public void ChangeLocale(int localeID)
    {
    if (_active)
    {
    return;
    }
    StartCoroutine(SetLocale(localeID));
    }
    private IEnumerator SetLocale(int localeID)
    {
    _active = true;
    yield return LocalizationSettings.InitializationOperation;
    LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[localeID];
    _active = false;
    }
    }

  • @vedatmirzaoglu4915
    @vedatmirzaoglu4915 2 роки тому

    part 2?

    • @RootGames
      @RootGames  2 роки тому

      Coming this weekend 😉

  • @KrakenStudiosGames
    @KrakenStudiosGames Рік тому

    Too complicated no thank you. I got lost at minute 3.

    • @RootGames
      @RootGames  Рік тому

      ok 😂

    • @KrakenStudiosGames
      @KrakenStudiosGames Рік тому

      @@RootGames It's simple. Open a google spread sheet, plop in your text. Use Google A.I. to translate to the languages, read the file, have an index for each column. Much easier than click 25 buttons 50 times before you even touch one text. I cant even remember the 3rd click.

  • @Schalkkie
    @Schalkkie 9 місяців тому +1

    Thank you very much, very helpful