View on GitHub
本地化
Bootstrap Table 的本地化 API。
我们可以导入您需要的所有语言环境文件:
```html
<script src="bootstrap-table-en-US.js"></script>
<script src="bootstrap-table-zh-CN.js"></script>
...
然后使用 JavaScript 切换语言环境:
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US'])
// $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN'])
// ...
或使用数据属性为表格设置语言环境:
<table data-toggle="table" data-locale="en-US">
</table>
或使用 JavaScript 为表格设置语言环境:
$('#table').bootstrapTable({
locale: 'en-US'
})
您可以使用语言环境的短代码:
$('#table').bootstrapTable({
locale: 'en'
})
所有现有翻译及其短代码的列表在 Github
您可以自定义格式本地化,调用语法如下:
$('#table').bootstrapTable({
formatName: function () {
return '格式化消息'
}
})
formatAllRows
-
参数:
undefined
- 默认值:
'全部'
formatClearSearch
-
参数:
undefined
- 默认值:
'清除搜索'
formatColumns
-
参数:
undefined
-
默认值:
'列'
formatColumnsToggleAll
-
参数:
undefined
-
默认值:
'切换全部'
formatDetailPagination
-
参数:
totalRows
-
默认值:
'显示 %s 行'
formatFullscreen
-
参数:
undefined
-
默认值:
'全屏'
formatLoadingMessage
-
参数:
undefined
-
默认值:
'正在加载,请稍候…'
formatNoMatches
-
参数:
undefined
-
默认值:
'未找到匹配的记录'
formatPaginationSwitch
-
参数:
undefined
-
默认值:
'隐藏/显示分页'
formatPaginationSwitchDown
-
参数:
undefined
-
默认值:
'显示分页'
formatPaginationSwitchUp
-
参数:
undefined
-
默认值:
'隐藏分页'
formatRecordsPerPage
-
参数:
pageNumber
-
默认值:
'每页 %s 条记录'
formatRefresh
-
参数:
undefined
-
默认值:
'刷新'
formatSearch
-
参数:
undefined
-
默认值:
'搜索'
formatShowingRows
-
参数:
pageFrom, pageTo, totalRows
-
默认值:
'显示第 %s 到 %s 行,共 %s 行'
formatSRPaginationNextText
-
参数:
undefined
-
默认值:
'下一页'
formatSRPaginationPageText
-
参数:
page
-
默认值:
'转到第 %s 页'
formatSRPaginationPreText
-
参数:
undefined
-
默认值:
'上一页'
formatToggleOff
-
参数:
undefined
-
默认值:
'隐藏卡片视图'
formatToggleOn
-
参数:
undefined
-
默认值:
'显示卡片视图'