Example #1
0
    private string LoadScriptFile(string lang)
    {
        var countrycode = LanguageHelper.Get2LetterISOCodeFromSystemLanguage();

        if (!string.IsNullOrEmpty(lang))
        {
            countrycode = lang;
        }

        var codes = new string[] { countrycode, defaultlanguage };

        foreach (var code in codes)
        {
            string scriptFileName = resourceFile + "." + code;
            var    textAsset      = Resources.Load <TextAsset>(scriptFileName);
            if (textAsset != null)
            {
                return(textAsset.text);
            }
        }
        return("");
    }