Little explanation
jqPlot uses jsDate internally: http://sandbox.kendsnyder.com/date2/
jsDate has built-in support for localization and locale. However, this feature is limited by several pre-configured languages ββin the internal regional table (see 2. ).
1. For the happy
Since in my version of jqPlot (v1.0.4) French is included in this table (perhaps a gift from the authors), all you have to do is just set the lang
attribute in the <html>
:
<html lang="fr">
Et voilΓ ...
2. Foreigners
If you want to add your own missing language at run time, you can use the following instructions:
$(document).ready(function(){ // Add a new localization $.jsDate.regional['it'] = { monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'], dayNames: ['Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato'], dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], formatString: '%d-%m-%Y %H:%M:%S' }; // Do not forget to call $.jsDate.regional.getLocale(); });
Remember to call $.jsDate.regional.getLocale()
to update the internal settings and set the <html>
accordingly.
My looks like:
<html lang="it">
What all...
If you cannot control the markup for the html
tag, you can set it with
document.documentElement.setAttribute('lang', 'it');
The lang
setting of an intermediate element, such as the surrounding div
, does not work.