You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.7 KiB
HTML
55 lines
1.7 KiB
HTML
|
|
<h2>Internationalisation with Country's ISOCODE</h2>
|
|
|
|
<p>Once the languages files were named based on its language name, and I needed to be based on the country's ISOCODE, I copied all of them into this new ISO folder and replaced the names with its respectively country's ISOCODE. Hopefully, this may be usefull for more users.</p>
|
|
|
|
<ul>
|
|
<li><a href="#how_to">How to use DataTables internalisation options with ISOCODE</a></li>
|
|
</ul>
|
|
|
|
|
|
<a name="how_to"></a>
|
|
<h3>How to use DataTables internalisation options with Country's ISOCODE</h3>
|
|
|
|
<p>To include internalisation options in DataTables, you just replace the filename you are requesting with the ISOCODE filename</p>
|
|
|
|
<p>So, instead of using this:</p>
|
|
|
|
<pre class="brush: html"><script type="text/javascript" src="jquery.dataTables.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('#example').dataTable( {
|
|
"oLanguage": {
|
|
"sUrl": "Spanish.lang"
|
|
}
|
|
} );
|
|
} );
|
|
</script>
|
|
</pre>
|
|
|
|
<p>You could use this:</p>
|
|
<pre class="brush: html"><script type="text/javascript" src="jquery.dataTables.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('#example').dataTable( {
|
|
"oLanguage": {
|
|
"sUrl": "ISO/es.lang"
|
|
}
|
|
} );
|
|
} );
|
|
</script>
|
|
</pre>
|
|
|
|
<p>Or, if it is correctly set, you can get the filename based on <html> laguage property as the sample below:</p>
|
|
<pre class="brush: html"><script type="text/javascript" src="jquery.dataTables.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var language = $('html').attr('lang');
|
|
$('#example').dataTable( {
|
|
"oLanguage": {
|
|
"sUrl": "ISO/"+language+".lang"
|
|
}
|
|
} );
|
|
} );
|
|
</script>
|
|
</pre> |