using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Localizer : SingletonMonoBehavior<Localizer> {

    public int defaultLang = 1;
    public int currentLang = 1;
    public SimpleJSON.JSONNode[] contentFiles;

    protected override void Awake()
    {
        base.Awake();
        string[] lang = new string[3];
        contentFiles = new SimpleJSON.JSONNode[3];
        lang[0] = "en";
        lang[1] = "fr";
        lang[2] = "es";
        TextAsset file = Resources.Load<TextAsset>("en");
        contentFiles[0] = SimpleJSON.JSON.Parse(file.text);
        file = Resources.Load<TextAsset>("fr");
        contentFiles[1] = SimpleJSON.JSON.Parse(file.text);
        //Debug.Log(contentFiles[1]["text"]["0"]);
        
    }

    public static string getText(string group, int index)
    {
        return instance.contentFiles[instance.currentLang][group]["" + index].Value;
    }

}
