define( function() {

    var fallbackLanguage = "en-us",
        texts = {
    "player": {
        "navigation": {
            "button": {
                "sitemap": {
                    "et-ee": "Sisu",
                    "bg-bg": "Cъдържание",
                    "cs-cz": "Obsah",
                    "da-dk": "Indhold",
                    "de-de": "Inhalt",
                    "en-us": "Content",
                    "es-es": "Contenido",
                    "es-ar": "Contenido",
                    "fi-fi": "Pitoisuus",
                    "fr-fr": "Plan du site",
                    "el-gr": "περιεχόμενο",
                    "hi-in": "सामग्री",
                    "hr-hr": "Sadržaj",
                    "hu-hu": "Tartalom",
                    "it-it": "Contenuto",
                    "ja-jp": "コンテンツ",
                    "ko-kr": "함유량",
                    "lt-lt": "Turinys",
                    "mk-mk": "Cодржина",
                    "mn-mn": "Aгуулга",
                    "ms-id": "Kandungan",
                    "nl-nl": "Inhoud",
                    "no-no": "Innhold",
                    "pl-pl": "Zawartość",
                    "pt-pt": "Conteúdo",
                    "pt-br": "Conteúdo",
                    "ro-ro": "Conținut",
                    "ru-ru": "Cодержание",
                    "sk-sk": "Obsah",
                    "sl-si": "Vsebina",
                    "sr-rs": "Cадржина",
                    "sv-se": "Innehåll",
                    "th-th": "เนื้อหา",
                    "tr-tr": "Içerik",
                    "zh-tw": "內容",
                    "zh-cn": "内容",
                    "de-at": "Inhalt",
                    "de-ch": "Inhalt",
                    "eo-de": "Inhalt",
                    "nl-be": "Inhoud",
                    "en-ie": "Content",
                    "en-gb": "Content",
                    "eo-en": "Inhalt",
                    "fr-be": "Plan du site"
                }
            }
        }
    }
};

    /**
     * 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;
        }
    }
});