Search code examples
javascriptlocalizationflipclock

dynamically change language on flipclock.js


i'm trying to change the language of the labels on a FlipClock.js clock programatically, when the user selects a language from a dropdown.

i see how to set the language when instantiating the clock (https://github.com/objectivehtml/FlipClock/blob/master/examples/localization.html) and i see the docs here http://flipclockjs.com/api but I'm not sure how to dynamically change the language.

something like:

var clock = $('#flipclock').FlipClock(6000, {
    countdown: true,
    clockFace: 'DailyCounter'
});

clock.loadLanguage("es"); // change language? doesn't work

but that doesn't work. i also tried

clock.language = "es"; 

and that didn't work either. any ideas?


Solution

  • var clock = $('#flipclock').FlipClock(6000, {
        countdown: true,
        clockFace: 'DailyCounter',
        language:'es-es',
    });