如何更改数据表的语言 [英] how to change language for DataTable
问题描述
我将用户想要翻译的语言存储在会话变量中,但我不知道将其传递给 DataTables
I store, in a session variable, which language does user wants to translate but I don't know to pass it DataTables
我在数据表网站上找到了这个解释 但这并没有真正的帮助,我在哪里设置语言参数 ?
I found this explanation on the datatables website but that didn't really help, where do I set language param ?
推荐答案
您必须创建一个语言文件,然后使用 :
You have to either create a language file and then set it using :
"oLanguage": {
"sUrl": "media/language/your_file.txt"
}
我不确定您使用的是哪种服务器语言,但类似这样的东西可以在 PHP 中使用:
Im not sure what server language you are using but something like this would work in PHP :
"oLanguage": {
"sUrl": "media/language/custom_lang_<?php echo $language ?>.txt"
}
其中 language
匹配特定语言的文件名.
Where language
matches the file name for a specific language.
或更改个人设置:
"oLanguage": {
"sLengthMenu": "Display _MENU_ records per page",
"sZeroRecords": "Nothing found - sorry",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
"sInfoEmpty": "Showing 0 to 0 of 0 records",
"sInfoFiltered": "(filtered from _MAX_ total records)"
}
欲了解更多详情,请阅读:http://datatables.net/plug-ins/i18n
For more details read this : http://datatables.net/plug-ins/i18n
这篇关于如何更改数据表的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!