コード例 #1
0
    public override string Get(string id)
    {
        string currentLanguage = "en";

        if (OverrideLanguage != null)
        {
            currentLanguage = OverrideLanguage;              //Use specific language if defined
        }
        else if (platform != null)
        {
            currentLanguage = platform.GetLanguageIso6391();              //Else use system language if defined
        }
        for (int i = 0; i < stringsCount; i++)
        {
            if (strings[i] == null)
            {
                continue;
            }
            if (strings[i].id == id && strings[i].language == currentLanguage)
            {
                return(strings[i].translated);
            }
        }
        // fallback to english
        for (int i = 0; i < stringsCount; i++)
        {
            if (strings[i] == null)
            {
                continue;
            }
            if (strings[i].id == id && strings[i].language == "en")
            {
                return(strings[i].translated);
            }
        }
        // not found
        return(id);
    }