Search Unity

How to get TableEntry by Locales

Discussion in 'Scripting' started by diccuric, Feb 12, 2021.

  1. diccuric

    diccuric

    Joined:
    Jan 23, 2015
    Posts:
    6
    I want to get TableEntry from Locale. (com.unity.localization)


    Code (CSharp):
    1.  
    2.  
    3. using UnityEngine.Localization.Settings;
    4. using UnityEngine.Localization.Tables;
    5.  
    6. public class Test : MonoBehaviour
    7. {
    8.     public LocalizedString reference;
    9.  
    10.     private void Start()
    11.     {
    12.         for(int i = 0; i < LocalizationSettings.AvailableLocales.Locales.Count; ++i)
    13.         {
    14.             var locale = LocalizationSettings.AvailableLocales.Locales[i];
    15.             var s = GetString(locale, reference.TableEntryReference);
    16.             Debug.Log(s);
    17.         }
    18.     }
    19.  
    20.     public string GetString(Locale locale, TableEntryReference reference)
    21.     {
    22.         return ???;
    23.     }
    24. }
     
unityunity