define( function() {

    var fallbackLanguage = "en-us",
        texts = {
    "player": {
        "navigation": {
            "button": {
                "pause": {
                    "et-ee": "Paus",
                    "bg-bg": "Пауза",
                    "cs-cz": "Pøerušení",
                    "da-dk": "Pause",
                    "de-de": "Pause",
                    "en-us": "Pause",
                    "es-es": "Pausa",
                    "es-ar": "Pausa",
                    "fi-fi": "Tauko",
                    "fr-fr": "Pause",
                    "el-gr": "Παύση",
                    "hi-in": "विराम करें",
                    "hr-hr": "Stanka",
                    "hu-hu": "Szünet",
                    "it-it": "Pausa",
                    "ja-jp": "一時停止",
                    "ko-kr": "잠시 멈춤",
                    "lt-lt": "Pauzė",
                    "mk-mk": "Пауза",
                    "mn-mn": "Түр зогсоох",
                    "ms-id": "Jeda",
                    "nl-nl": "Pauze",
                    "no-no": "Pause",
                    "pl-pl": "Pauza",
                    "pt-pt": "Pausa",
                    "pt-br": "Pausa",
                    "ro-ro": "Pauză",
                    "ru-ru": "Пауза",
                    "sk-sk": "Preruši",
                    "sl-si": "Premor",
                    "sr-rs": "Pauza",
                    "sv-se": "Paus",
                    "th-th": "หยุดชั่วคราว",
                    "tr-tr": "Ara",
                    "zh-tw": "暫停",
                    "zh-cn": "暂停",
                    "de-at": "Pause",
                    "de-ch": "Pause",
                    "eo-de": "Pause",
                    "nl-be": "Pauze",
                    "en-ie": "Pause",
                    "en-gb": "Pause",
                    "eo-en": "Pause",
                    "fr-be": "Pause"
                },
                "resume": {
                    "et-ee": "Jätka",
                    "bg-bg": "Продължи",
                    "cs-cz": "Pokračovat",
                    "da-dk": "Blive ved",
                    "de-de": "Fortsetzen",
                    "en-us": "Continue",
                    "es-es": "Continuar",
                    "es-ar": "Continuar",
                    "fi-fi": "Jatkaa",
                    "fr-fr": "Continuer",
                    "el-gr": "Να συνεχίσει",
                    "hi-in": "जारी रखना",
                    "hr-hr": "Nastaviti",
                    "hu-hu": "Folytatni",
                    "it-it": "Continua",
                    "ja-jp": "継続する",
                    "ko-kr": "계속하다",
                    "lt-lt": "Tęsti",
                    "mk-mk": "Продолжи",
                    "mn-mn": "Үргэлжлүүлэх",
                    "ms-id": "Teruskan",
                    "nl-nl": "Doorgaan",
                    "no-no": "Fortsette",
                    "pl-pl": "Kontynuować",
                    "pt-pt": "Continuar",
                    "pt-br": "Continuar",
                    "ro-ro": "Continua",
                    "ru-ru": "Продолжать",
                    "sk-sk": "ďalej",
                    "sl-si": "Nadaljuj",
                    "sr-rs": "Настави",
                    "sv-se": "Fortsätta",
                    "th-th": "ดำเนินการต่อ",
                    "tr-tr": "Devam et",
                    "zh-tw": "繼續",
                    "zh-cn": "继续",
                    "de-at": "Fortsetzen",
                    "de-ch": "Fortsetzen",
                    "eo-de": "Fortsetzen",
                    "nl-be": "Doorgaan",
                    "en-ie": "Continue",
                    "en-gb": "Continue",
                    "eo-en": "Fortsetzen",
                    "fr-be": "Continuer"
                }
            }
        }
    }
};

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