数据表国际化(俄语本地化)

时间:2014-11-26 07:25:47

标签: php codeigniter localization internationalization datatables

你好所有天才用户的堆栈溢出, 首先,我要感谢你们所有人的帮助。

现在这是我的问题

enter image description here您可以在图片中看到,我正在使用数据表在管理面板(CMS)中列出。

我能够将按钮和搜索标签转换成俄语。

但除此之外,那些“Show Rows”,“show / hide columns”,“显示1到1个条目”和分页“First Previous Next Last”标签无法用俄语翻译为那些标签来自数据库JS库。

我已经在datatables网站上找到了解决方案,链接如下:

http://datatables.net/plug-ins/i18n/

http://www.datatables.net/plug-ins/i18n/Russian#top

https://github.com/DataTables/Plugins/

问题是,我找不到如何将它集成到我的代码中。 我搜索了很多,但无法获得实施它的指示。

function getdatatable(deleteadr, paginate, aoculumn, aoColumnDefs) {

  oTable = $('#datatable').dataTable({
    "sPaginationType": "bs_full",
    "bJQueryUI": true,
    sDom: "<'row'<'dataTables_header  clearfix'<'col-md-4'lC><'col-md-8'TRf>r>>t<'row'<'dataTables_footer clearfix'<'col-md-6'i><'col-md-6'p>>> ",
    "bStateSave": true,
    oTableTools: {
      "sRowSelect": "multi",
      "aButtons": [{
          "sExtends": "copy",
          "sButtonText": "copy",
          "mColumns": "visible"
        }, {
          "sExtends": "print",
          "sButtonText": "print",
          "mColumns": "visible"
        }, {
          "sExtends": "csv",
          "sButtonText": "csv",
          "mColumns": "visible"
        }, {
          "sExtends": "xls",
          "sButtonText": "xls",
          "mColumns": "visible"
        }, {
          "sExtends": "pdf",
          "sButtonText": "pdf",
          "mColumns": "visible"
        }, {
          "sExtends": "text",
          "sButtonText": "Delete",
          "fnClick": function(nButton, oConfig, oFlash) {
            deleteerows(deleteadr);
          }
        },
        "select_all", "select_none"
      ],

      sSwfPath: BASEURL + "js/datatables/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
    },
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": BASEURL + paginate,
    "sServerMethod": "POST",
    "aoColumns": aoculumn,
    "aoColumnDefs": aoColumnDefs,

    "oLanguage": {
      "sSearch": "Search:"
    },
    "bSortCellsTop": true
  });
}

 $this - > javascripts = array(
   "modernizrjs" => "js/jquery/jquery-2.0.3.min.js",
   "bootstrap" => "js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js",
   "jqueryjs" => "bootstrap-dist/js/bootstrap.min.js",
   "datatable" => "js/datatables/media/js/jquery.dataTables.min.js",
   "assetsdatatable" => "js/datatables/media/assets/js/datatables.min.js",
   "celsdlreorder" => "js/datatables/extras/ColReorder/media/js/ColReorderwithresize.js",
   "colvis" => "js/datatables/extras/ColVis/media/js/ColVis.js",
   "masdoment" => "js/bootstrap-daterangepicker/moment.min.js",
   "timeag" => "js/timeago/jquery.timeago.min.js",
   // "date"           =>  "js/bootstrap-daterangepicker/daterangepicker.min.js",
   "slimscroll" => "js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js",
   "slimscrollhorizontal" => "js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js",
   "block" => "js/jQuery-BlockUI/jquery.blockUI.min.js",
   "tabletool" => "js/datatables/extras/TableTools/media/js/TableTools.min.js",
   "clipboard" => "js/datatables/extras/TableTools/media/js/ZeroClipboard.min.js",
   "cellreorder" => "js/datatables/extras/FixedHeader/js/FixedHeader.min.js",
   "cookie" => "js/jQuery-Cookie/jquery.cookie.min.js",
   "griter" => "js/gritter/js/jquery.gritter.min.js",
   "script" => "js/script.js",
   "main" => "js/main.js",
   "isotope" => "js/isotope/jquery.isotope.min.js",
   "imagesloaded" => "js/isotope/imagesloaded.pkgd.min.min.js",
   "blockUI" => "js/jQuery-BlockUI/jquery.blockUI.min.js"
 );

请帮帮我。

谢谢。 :)

2 个答案:

答案 0 :(得分:0)

通常,您必须在您的库文件后面的HTML标题中包含特定于语言的Javascript文件。

对于此插件,请尝试更改初始化代码:

oTable = $('#datatable').dataTable({
    // insert this section
    "language": {
        "url": "http://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Russian.json"
    },
    // continue your code

答案 1 :(得分:0)

Утебяошибкавтомчтовинициализациитаблицыужебыл:

(对于你在初始化表中的错误已经是:)

    "oLanguage": {
     "sSearch": "Search:"
    },

удалиилизаменисвойoLanguageнапримерниже:

(带走或替换上面的sSearch示例:)

    "oLanguage": {
     "url": "http://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Russian.json"
    },