using System;
using UnityEngine;
using UnityEngine.UI;

[RequireComponent(typeof(InputField))]
public class InputFieldLocalization : MonoBehaviour
{
    public string key;

    void Start() {
        // Get the string value from localization manager from key 
        // and set the text component text value to the  returned string value 
        string text = LocalizationManager.Instance.GetText(key);
        text = text.Replace("\\n", Environment.NewLine);
        GetComponent < InputField > ().placeholder.GetComponent<Text>().text = text;
    }

    internal void UpdateText() {
        string text = LocalizationManager.Instance.GetText(key);
        text = text.Replace("\\n", Environment.NewLine);
        GetComponent<InputField>().placeholder.GetComponent<Text>().text = text;
    }
}
