define( function() {

    var fallbackLanguage = "en-us",
        texts = {
    "player": {
        "navigation": {
            "button": {
                "back_to_overall_evaluation": {
                    "et-ee": "Tagasi üldise hindamise juurde",
                    "bg-bg": "Обратно към цялостната оценка",
                    "cs-cz": "Zpět na celkové hodnocení",
                    "da-dk": "Tilbage til den samlede evaluering",
                    "de-de": "Zurück zur Gesamtauswertung",
                    "en-us": "Back to overall evaluation",
                    "es-es": "Volver a la evaluación general",
                    "es-ar": "Volver a la evaluación general",
                    "fi-fi": "Takaisin yleisarviointiin",
                    "fr-fr": "Retour à l'évaluation globale",
                    "el-gr": "Επιστροφή στη συνολική αξιολόγηση",
                    "hi-in": "समग्र मूल्यांकन पर वापस",
                    "hr-hr": "Povratak na cjelokupnu ocjenu",
                    "hu-hu": "Vissza az átfogó értékeléshez",
                    "it-it": "Torna alla valutazione complessiva",
                    "ja-jp": "全体的な評価に戻る",
                    "ko-kr": "전체 평가로 돌아 가기",
                    "lt-lt": "Grįžti prie bendro vertinimo",
                    "mk-mk": "Назад на целокупната проценка",
                    "mn-mn": "Ерөнхий үнэлгээ рүү буцах",
                    "ms-id": "Kembali ke evaluasi keseluruhan",
                    "nl-nl": "Terug naar de algemene evaluatie",
                    "no-no": "Tilbake til totalevaluering",
                    "pl-pl": "Powrót do ogólnej oceny",
                    "pt-pt": "Voltar para avaliação geral",
                    "pt-br": "Voltar para avaliação geral",
                    "ro-ro": "Înapoi la evaluarea generală",
                    "ru-ru": "Вернуться к общей оценке",
                    "sk-sk": "Späť k celkovému hodnoteniu",
                    "sl-si": "Nazaj na splošno oceno",
                    "sr-rs": "Повратак на укупну процену",
                    "sv-se": "Tillbaka till övergripande utvärdering",
                    "th-th": "กลับไปที่การประเมินโดยรวม",
                    "tr-tr": "Genel değerlendirmeye dön",
                    "zh-tw": "返回整體評價",
                    "zh-cn": "返回整体评价",
                    "de-at": "Zurück zur Gesamtauswertung",
                    "de-ch": "Zurück zur Gesamtauswertung",
                    "eo-de": "Zurück zur Gesamtauswertung",
                    "nl-be": "Terug naar de algemene evaluatie",
                    "en-ie": "Back to overall evaluation",
                    "en-gb": "Back to overall evaluation",
                    "eo-en": "Zurück zur Gesamtauswertung",
                    "fr-be": "Retour à l'évaluation globale"
                }
            }
        }
    }
};

    /**
     * Gets data from a nested object
     *
     * @private
     * @param {string} key - a dot separated representation of the objectstructure e.g.("cmi.core.lesson_status")
     * @param {object|string} data - the data object where the value should be got from
     */
    function getData( key, data ) {

        var parts = key.split("."),
            i = 0,
            parent = data;

        for(; i < parts.length; ++i) {
            if (!parent[parts[i]]) {
                return null;
            }
            parent = parent[parts[i]];
        }

        return parent;
    }

    // revealing public API
    return {

        /**
         * Gets a text in a given language
         * If the text is not defined in the given language, the text in teh fallback "en-us" is used, otherwise "null".
         *
         * @public
         * @param {string} key - a dot separated representation of the resource e.g.("quiz.evaluate")
         * @param {string} [language] - the language for the text e.g.("en-us")
         */
        get : function( key, language ){

            var text = getData( key, texts );
            if( text ){
                return getData( language, text ) || getData( fallbackLanguage, text );
            }

            return null;
        }
    }
});