简体   繁体   English

在react-table中是否有用于本地化的API?

[英]Is there an API for localization in react-table?

I have a reactjs app and I'm using react-table in it. 我有一个reactjs应用程序,我正在使用react-table The text of the table buttons ("Next", "Page x of y", etc) is in English and I did not see any option to localize it. 表格按钮的文本(“下一页”,“Page x of y”等)是英文的,我没有看到任何本地化选项。 Is there an API for this? 这有API吗? Or should I hook the elements and implement it myself? 或者我应该挂钩元素并自己实现它?

In the documentation you can find the list of strings that can be customized, and you can create an object of your custom translations: 在文档中,您可以找到可自定义的字符串列表,您可以创建自定义翻译的对象:

const translations = {previousText: 'PREV', nextText: 'NEXT', loadingText: 'LOADING...'};

Next, just pass this object to your React Table jsx: 接下来,只需将此对象传递给React Table jsx:

<ReactTable {...translations} />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM