예제 #1
0
    public static void UpdateI18N(List <List <string> > data)
    {
        I18nData i18nFile = ScriptableObject.CreateInstance <I18nData>();

        i18nFile.name     = "I18n Data";
        i18nFile.i18nData = new List <I18nTextSave>();
        foreach (List <string> l in data)
        {
            i18nFile.i18nData.Add(
                new I18nTextSave()
            {
                key = l[0],
                fr  = l[1],
                en  = l[2]
            }
                );
        }

        if (!AssetDatabase.IsValidFolder("Assets/Resources"))
        {
            AssetDatabase.CreateFolder("Assets", "Resources");
        }
        if (!AssetDatabase.IsValidFolder("Assets/Resources/i18n"))
        {
            AssetDatabase.CreateFolder("Assets/Resources", "i18n");
        }
        AssetDatabase.CreateAsset(i18nFile, "Assets/Resources/i18n/Data.asset");

        I18N.LoadText();

        if (TextUpdated != null)
        {
            TextUpdated();
        }
    }