Internacionalización para español da error

Internacionalización para español da error

charly77charly77 Posts: 16Questions: 5Answers: 1

Yo tenía esto en mi página:
new DataTable('#myTable',{ language:{ url:'//cdn.datatables.net/plug-ins/2.0.2/i18n/es-ES.json', }, });
Hasta esta mañana me funcionaba bien. Esta tarde vi en los ejemplos del idioma la versión 2.0.6 y lo cambié, pero sigue dando el siguiente error:
"DataTables warning: table id=myTable - i18n file loading error. For more information about this error, please see https://datatables.net/tn/21"

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,188Questions: 26Answers: 4,925
    Answer ✓

    I just tried the URL:
    https://cdn.datatables.net/plug-ins/2.0.2/i18n/es-ES.json

    It is working. You might need to do some network troubleshooting to find the error. See this thread with the same error.

    Kevin

  • charly77charly77 Posts: 16Questions: 5Answers: 1

    Lo que no entiendo es por qué en el navegador Chrome sí que funciona y en Firefox no.

  • kthorngrenkthorngren Posts: 21,188Questions: 26Answers: 4,925

    What I don't understand is why in Chrome browser it works and not in Firefox.

    That's a good question. Could be a browser configuration issue. Have you looked at the browser's console for errors? Use the browser's network inspector tool to see if the response contains an error.

    Kevin

  • charly77charly77 Posts: 16Questions: 5Answers: 1
    edited May 19


    En la consola de Chrome, nada y en Firefox te mando adjunto un pantallazo con el cartel del error y la ventana de Red de la consola, donde aparecen dos errores de Datatables.
    He pensado que podría ser que en Firefox no guardo historial ni cookies, pero he probado al revés y tampoco se arregla.

  • kthorngrenkthorngren Posts: 21,188Questions: 26Answers: 4,925

    n the Chrome console, nothing and in Firefox I am attaching a screenshot with the error sign and the console's Network window, where two Datatables errors appear.
    I thought it might be that in Firefox I don't save history or cookies, but I've tried the other way around and it doesn't fix it either.

    Looks like you are getting the same CORS error as the thread I linked to. Its not a Datatables issue. Maybe this Mozilla doc will help.

    Kevin

  • charly77charly77 Posts: 16Questions: 5Answers: 1

    La solución que propones no me funciona. He buscado por internet y no queda muy claro cual puede ser el origen del problema. Dan algunas soluciones, como insertar en httpd.conf:
    ´´´Header set Access-Control-Allow-Origin 'http://localhost:81/sistema/'´´´
    pero tampoco me sirven. En la consola de Firefox aparecen estos dos errores por cada tabla de Datatables que traduzco al español:

    "Solicitud desde otro origen bloqueada: la política de mismo origen impide leer el recurso remoto en http://cdn.datatables.net/plug-ins/2.0.2/i18n/es-ES.json (razón: falta la cabecera CORS 'Access-Control-Allow-Origin'). Código de estado: 301.

    Solicitud de origen cruzado bloqueada: La misma política de origen no permite la lectura de recursos remotos en http://cdn.datatables.net/plug-ins/2.0.2/i18n/es-ES.json. (Razón: Solicitud CORS sin éxito). Código de estado: (null)."

  • kthorngrenkthorngren Posts: 21,188Questions: 26Answers: 4,925

    There are many things to look at in this SO thread.

    Kevin

  • kthorngrenkthorngren Posts: 21,188Questions: 26Answers: 4,925

    I copied your code into this test case:
    https://live.datatables.net/vagexuma/1

    It works in both Chrome and Firefox on my machine running MacOS. Its a new install of Firefox since I didn't have it. Possibly there is a setting, plugin or untrusted certificate. See the SO thread I previously linked to.

    Kevin

  • charly77charly77 Posts: 16Questions: 5Answers: 1

    He visto tus respuestas, he probado lo que indican y he seguido investigando por la red. Hay mucha información sobre las CORS, pero nada me sirve.
    He llegado a pensar que Datatables entra en conflicto con el resto de elementos que forman mi web, como por ejemplo las peticiones o las cabeceras.

Sign In or Register to comment.