方法一在html网页中加载语言包
<script src="bootstrap-table-en-US.js"></script>
<script src="bootstrap-table-zh-CN.js"></script>
在html标签属性中设置语言
<table data-toggle="table" data-locale="en-US">
</table>
或在js中设置语言
$(\'#table\').bootstrapTable({
locale: \'en-US\'
})
方法二自定义语言包
$(\'#table\').bootstrapTable({
//自定义分页字符串显示为中文
formatShowingRows:function(pageFrom, pageTo, totalRows)
{
return "第"+pageFrom+"-"+pageTo+"行,总共"+totalRows+"";
},
//自定义分页字符串显示为中文
formatRecordsPerPage:function(pageNumber)
{
return pageNumber+\'行每页\';
}
});
可自定义的本地化的方法如下
$(\'#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 \'全部\';
}
});
转载请注明:http://www.itxst.com/Bootstrap-Table/QuickStart.html