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

Feedback Add functionality to convert UnityEngine.SystemLanguage to ISO code

Discussion in 'Localization Tools' started by Peter77, Oct 28, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,438
    Please provide functionality to map a SystemLanguage value to an ISO code. For example
    SystemLanguage.English
    to
    "en"
    or
    SystemLanguage.ChineseSimplified
    to
    "zh-hans"
    .

    I'd assume such code exists in the Localization system already.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    We do have support for this. I don't think the direct API is exposed but it can all be done through the LocaleIdentifier struct.

    LocalieIdentifier li = System language.English;
    Li.Code will be "en".
     
    Peter77 likes this.
  3. heiwa-games

    heiwa-games

    Joined:
    Apr 8, 2018
    Posts:
    8
    Hi Karl,

    could you please share in which library/package this 'LocaleIdentifier' is contained? Could not find this class in standard Unity 2020.3.26f1

    Thanks,
    Stefan
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
  5. legoesbenr

    legoesbenr

    Joined:
    Apr 27, 2022
    Posts:
    9
    Are you saying that I need to import an entire package just in order to map from Unity's own proprietary locale type to the representation that is industry standard?