数据表 - 通过 JavaScript 更改语言使 UI 元素消失而不是更改语言 [英] Datatables - Language change via JavaScript makes UI elements disappear instead of changing the language
问题描述
我已经使用引导程序样式构建了一个数据表,并希望将 ui 元素的默认语言更改为德语.
https://datatables.net/examples/advanced_init/language_file.html这表明我可以在脚本中加载语言文件.当我尝试这样做时,所有与语言相关的 UI 元素都会消失,而不是以德语显示.结果是没有特征的裸"表.可能是什么问题呢?抱歉缩进不好,我在粘贴时遇到了麻烦.
脚本:
$(document).ready(function() {$('#example').DataTable({语": {"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"}});});
我的整个网站如下所示:
<头><%@ taglib prefix="Tags" uri="WEB-INF/tagXML.tld" %><link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"><link rel="stylesheet" type="text/css" href="css/style.css"><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"><link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.14.0/css/mdb.min.css" rel="stylesheet"><link href="css/addons/datatables.min.css" rel="stylesheet"><title>title</title><风格>身体 {填充顶部:90px;}</风格>头部><body class="站点"><div class="容器"><!--表格--><table id="dtBasicExample" class="table table-hover table-sm"><!--桌头--><头><tr><th>#</th><th>名字</th><th>Last Name</th><th>用户名</th><th>访问</th><th>年龄</th><th>国家</th><th>名字</th><th>Last Name</th><th>用户名</th><th>访问</th><th>年龄</th><th>国家</th></tr></thead><!--桌头--><!--表体--><tr><th scope="row">1</th><td>标记</td><td>奥托</td><td>@mdo</td><td>标记</td><td>奥托</td><td>@mdo</td><td>标记</td><td>奥托</td><td>@mdo</td><td>标记</td><td>奥托</td><td>@mdo</td></tr><tr><th scope="row">2</th><td>雅各</td><td>桑顿</td><td>@fat</td><td>标记</td><td>奥托</td><td>@mdo</td><td>雅各</td><td>桑顿</td><td>@fat</td><td>标记</td><td>奥托</td><td>@mdo</td></tr><tr><th scope="row">3</th><td>拉里</td><td>鸟</td><td>@twitter</td><td>标记</td><td>奥托</td><td>@mdo</td><td>雅各</td><td>桑顿</td><td>@fat</td><td>标记</td><td>奥托</td><td>@mdo</td></tr></tbody><!--表体--><!--表格--></main><脚本>$(document).ready(function () {$('#dtBasicExample').DataTable({bInfo":假语言":{url"://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"}});$('.dataTables_length').addClass('bs-select');});<!-- 可选的 JavaScript --><!-- 首先是 jQuery,然后是 Popper.js,然后是 Bootstrap JS --><script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5Kkn"cross/脚本<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqKaISfwNz4M" crossorigin="anonymous"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4N.;<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script><script type="text/javascript" src="js/addons/datatables.min.js"></script><!-- Material Design Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.14.0/css/mdb.min.css" rel="stylesheet"><!-- 字体真棒--><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"><!-- 谷歌字体--><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap">