var languages = {
    en: {
        "inbox": "Inbox",
        "trash": "Trash",
        "junk": "Junk",
        "spam": "Spam",
        "sent": "Sent",
        "drafts": "Drafts",
        "short_date_fmt": "%d/%m/%y %H:%M"
    },
    es: {
        "Subject": "Asunto",
        "Sender": "Remitente",
        "Subject or Sender": "Asunto o Remitente",
        "For or Cc": "Para o Cc",
        "Body": "Cuerpo del mensaje",
        "Synchronize": "Sincronizar",
        "Mailbox": "Bandeja de correo",
        "Send email": "Enviar email",
        "Send email to ": "Enviar email a ",
        "Settings": "Configurar",
        "Search options": "Opciones de búsqueda",
        "To": "Para",
        "From": "De",
        "Cc": "Cc",
        "Bcc": "Cco",
        "Date": "Fecha",
        "Tags": "Etiquetas",
        "TAGS": "ETIQUETAS",
        "Add": "Añadir",
        "Edit": "Editar",
        "SEND EMAIL": "ENVIAR EMAIL",
        "Cancel": "Cancelar",
        "Send": "Enviar",
        "Warning": "Advertencia",
        "Attachments": "Adjuntos",
        "Attach files": "Adjuntar archivos",
        "SETTINGS": "CONFIGURACIÓN",
        "ADVANCED SETTINGS": "CONFIGURACIÓN AVANZADA",
        "DEFAULT SETTINGS": "CONFIGURACIÓN BÁSICA",
        "Advanced": "Avanzado",
        "Enable advanced settings": "Habilitar la configuración avanzada",
        "Disable advanced settings": "Deshabilitar la configuración avanzada",
        "Save": "Guardar",
        "Error": "Error",
        "Must fill in all form fields": "Deben rellenarse todos los campos del formulario",
        "All email recipients must be valid": "Todos los correos de los destinatarios deben ser válidos",
        "Non secure": "No seguro",
        "Account settings": "Configuración de la cuenta",
        "Account default settings": "Configuración por defecto de la cuenta",
        "Outgoing server": "Servidor de salida",
        "Account": "Cuenta",
        "Host": "Servidor",
        "Port": "Puerto",
        "Protocol": "Protocolo",
        "Connection": "Conexión",
        "Username": "Usuario",
        "Password": "Contraseña",
        "First": "Primero",
        "Back": "Atrás",
        "Next": "Siguiente",
        "Last": "Último",
        "There are some attachment files": "Tiene ficheros adjuntos",
        "Exception": "Excepción",
        "Line": "Línea",
        "Message": "Mensaje",
        "Reply all": "Responder a todos",
        "Reply": "Responder",
        "Forward": "Reenviar",
        "wrote": "escribió",
        "Show details": "Mostrar detalles", 
        "Hide details": "Ocultar detalles",
        "Already added a file with the name": "Ya se ha añadido un fichero con el nombre",
        "The max size for attachment files is": "El tamañano máximo para los ficheros adjuntos es",
        "Delete": "Borrar",
        "Send events": "Enviar eventos",
        "Send all attachment files to Webdav service": "Enviar todos los ficheros adjuntos al servicio Webdav",
        "Name": "Nombre",
        "inbox": "Bandeja de entrada",
        "trash": "Papelera",
        "junk": "Correo basura",
        "spam": "Correo basura",
        "sent": "Enviados",
        "drafts": "Borradores",
        "short_date_fmt": "%d/%m/%y %H:%M",
        "Copy To...": "Copiar a...",
        "Move To...": "Mover a...",
        "Filter": "Filtro",
        "Data extraction pattern": "Patrón de extración de datos",
        "URL template": "Plantilla de URL",
        "Data template": "Plantilla de datos",
        "Action": "Acción",
        "contains": "contiene",
        "doesn't contain": "no contiene",
        "is": "es",
        "isn't": "no es",
        "starts with": "comienza por",
        "doesn't start with": "no compienza por"
    }
};

var language = EzWebAPI.createRGadgetVariable('language', EzWebExt.bind(function(){}, this));

var _ = function(key) {
    var lang = language.get();
    if (languages[lang] && languages[lang][key]) {
        return languages[lang][key];
    }
    else {
        return key;
    }
};
