32 lines
766 B
C#
32 lines
766 B
C#
using I2.Loc;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LanguageItem : MonoBehaviour
|
|
{
|
|
[SerializeField] private Image flagImage;
|
|
[SerializeField] private Text text;
|
|
|
|
private string term;
|
|
|
|
private void Start()
|
|
{
|
|
term = text.text;
|
|
SetTextFromTerm(term);
|
|
SetFlagTerm(term);
|
|
}
|
|
|
|
private void SetTextFromTerm(string term)
|
|
{
|
|
text.text = LocalizationManager.GetTranslation(term);
|
|
|
|
SetFlagTerm(term);
|
|
}
|
|
|
|
private void SetFlagTerm(string term)
|
|
{
|
|
if (LocalizationManager.TryGetTranslation("FlagSprite", out string translation, true, 0, true, false, null, term, false))
|
|
flagImage.sprite = LocalizationManager.GetTranslatedObject<Sprite>(translation);
|
|
}
|
|
}
|