zoukankan      html  css  js  c++  java
  • bootstrap中文设置

    方法一在html网页中加载语言包

    1
    2
    <script src="bootstrap-table-en-US.js"></script>
    <script src="bootstrap-table-zh-CN.js"></script>

    在html标签属性中设置语言

    1
    2
    <table data-toggle="table" data-locale="en-US">
     </table>

    或在js中设置语言

    1
    2
    3
    $('#table').bootstrapTable({ 
     locale: 'en-US'
      })

    方法二自定义语言包

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    $('#table').bootstrapTable({
              //自定义分页字符串显示为中文
              formatShowingRows:function(pageFrom, pageTo, totalRows)
              {
                return "第"+pageFrom+"-"+pageTo+"行,总共"+totalRows+"";
              },
               //自定义分页字符串显示为中文
              formatRecordsPerPage:function(pageNumber)
              {
                return pageNumber+'行每页';
              }
      });

    可自定义的本地化的方法如下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    $('#table').bootstrapTable({
     //加载数据时提示
    formatLoadingMessage:function()
    {
    return "数据加载中...";
    },
    //每页显示
    formatRecordsPerPage:function(pageNumber)
    {
         return pageNumber+'行每页';
      },
    //页码
      formatShowingRows:function(pageFrom, pageTo, totalRows)
              {
                return "第"+pageFrom+"-"+pageTo+"行,总共"+totalRows+"";
       },
     
    formatSRPaginationPreText :function(){
    return '上一页';
    },
     
    formatSRPaginationPageText:function(page){
    return '跳转至'+page;
    },
     formatSRPaginationNextText:function(){
    return '下一页';
    },
      
     formatDetailPagination:function(totalRows)
     {
     return "总计:"+totalRows;
     }
    ,
    formatSearch:function()
    {
    return  "搜索";
    }
    ,
    formatClearSearch:function()
    {
    return  "清除搜索";
    }
     ,
    formatNoMatches:function()
    {
    return  "未查询到相关记录";
    } ,
      formatPaginationSwitch:function()
      {
      return "隐藏显示分页";
      }
    ,
    formatPaginationSwitchDown:function()
      {
      return "显示分页";
      },
    formatPaginationSwitchUp:function()
      {
      return "隐藏分页";
      } ,
    formatRefresh:function()
      {
      return "刷新";
      }  ,
    formatToggle:function()
      {
      return "展开";
      }  ,
    formatToggleOn:function()
      {
      return "显示卡片视图";
      } , 
      formatToggleOff :function()
      {
      return "隐藏卡片视图";
      },
    formatColumns:function(){
    return "列视图";
    }
    ,
    formatColumnsToggleAll:function()
    {
    return 'Toggle all';
    }
     ,
    formatFullscreen:function()
    {
    return '全屏';
    } ,
    formatAllRows function()
    {
    return '全部';
    }
     
    });
  • 相关阅读:
    php mysql与mysqli 区别
    让IT工作者过度劳累的12个坏习惯
    HR不懂爱,他的问题答不上来
    励志小故事
    php中如何把一个数字字符串作为一个变量
    新手应该具备的基本素质
    邮件中的缩写
    强大的网页性能测试工具Speed Tracer
    Windows环境下EditPlus运行Perl程序
    ActionScript3检测当前下载资源的速度
  • 原文地址:https://www.cnblogs.com/qiu18359243869/p/14474651.html
Copyright © 2011-2022 走看看