Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Localization for UI Toolkit?

Discussion in 'UI Toolkit' started by Kichang-Kim, May 3, 2020.

  1. Kichang-Kim


    Oct 19, 2010
    AliAlbarrak likes this.
  2. BinaryCats


    Feb 8, 2016
    I haven't used Unity's localisation; But I am making my own localisation tool so I'm interested in this topic.

    What I think you mean to ask is if the localisation package will work with UI elements, with labels and buttons and what not. I'm sure it would be possible to work with it using C# to grab the required text, and change the text on a element to that acquired text.

    It looks like Localization's are stored as Assets in the project (much like my own). It would be fabulous if Unity's UI Toolkit could like assets into UXML (other than resource loading, I guess).

    I am facing the dilemma now of if I should extend all of Unity's Visual Elements for my own plugin; it feels like I should, but no plan how as of yet.
  3. DonLoquacious


    Feb 24, 2013
    Localization in my experience depends just as much on how you receive and want to process the files from the person/people/agency you hire to do your localization for you, how you want to set up the localization table used in memory, and when/where/how you want the "current language" to be tracked and changed by the user, as it does on what you're applying that data to. In this case (UI Elements), you can query through all labels and get whatever properties you like from them, so you can identify them by name, or make a new tag for "localization-name" or something in order to work as an identifier. You then just replace whatever text is in that label with your localized version.

    Add-ons that extend VisualElement/Label to automate this would simply be wiring into your own localization table (probably a dictionary of strings, dictionary of audio files, dictionary of images), which is really based on how you use assets in your project. I can't imagine a "one size fits all" solution to this- though ScriptableObjects could probably create some kind of a standard, like localization for UGUI does, I probably wouldn't even bother using it since ScriptableObjects wouldn't be how I'd be getting the translated assets from the company I hire for localizing the game.

    Last edited: May 4, 2020
  4. bdovaz


    Dec 10, 2011
    If they develop something it should be extensible enough so that if I want to provide the data I can implement it my way. For example: get the data from one or several *.json, *.csv, ...