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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Automatically set Hindi language

Discussion in 'Scripting' started by BravenBitSoftware, Feb 5, 2019.

  1. BravenBitSoftware

    BravenBitSoftware

    Joined:
    Feb 26, 2014
    Posts:
    56
    As you all know it's possible to use
    SystemLanguage
    to detect the default language of the device running the game. When my game opens, i use it to automatically set the default language for users.

    Problem is,
    SystemLanguage
    doesn't support Hindi or any of the official languages from India, and India is the second most populated country in the world. That is a huge flaw! How would i go about detecting if the system's default language is in Hindi?
     
  2. Riddik

    Riddik

    Joined:
    Jun 16, 2017
    Posts:
    20
  3. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,077
    You should also be able to use .NET to get the current culture instead:

    Code (CSharp):
    1.         using System;
    2.         using System.Globalization;
    3.         using System.Threading;
    4.    
    5.         CultureInfo myCulture = Thread.CurrentThread.CurrentCulture;
    6.      
    7.  
    8.         // You can then use all these member variables
    9.         myCulture.DisplayName
    10.         myCulture.EnglishName
    11.         myCulture.Name (e.g. es-ES / en-GB)
    12.         myCulture.Parent (e.g. es / en)
    13.         myCulture.ThreeLetterISOLanguageName (e.g. spa/eng/hin)
    14.         myCulture.TwoLetterISOLanguageName (e.g. es/en/hi)
    15.  
    Here's a selection of the Indian 3 and 2 letter ISO codes (see attached jpg)
     

    Attached Files:

    DmitryKanunnikoff likes this.
  4. BravenBitSoftware

    BravenBitSoftware

    Joined:
    Feb 26, 2014
    Posts:
    56
    Thank you both!