timer.jquery icon indicating copy to clipboard operation
timer.jquery copied to clipboard

Changing the language of the timer

Open ck2000 opened this issue 5 years ago • 6 comments

Currently the timer is showing the time in englisch e.g. 25 sec. How can I change this to another language?

ck2000 avatar Feb 06 '20 13:02 ck2000

That s a very good question! However currently the plugin just shows up in English. Some fundamental changes will have to be made for this feature. It will require some localization too.

walmik avatar Feb 07 '20 19:02 walmik

Please feel free to add this feature.. PRs are welcome :)

walmik avatar Feb 07 '20 19:02 walmik

You can use the format option to customize. See https://github.com/walmik/timer.jquery#format-syntax.

Example:

$("#div-id").timer({
  seconds: 10,
  format:  '%s segundos' // 'seconds' in spanish
});

shantanuthatte avatar Feb 12 '20 10:02 shantanuthatte

I had forgotten about the format syntax! Damn neat @shantanuthatte

walmik avatar Feb 12 '20 23:02 walmik

If you are using some i18n library you can theoretically do:

$("#div-id").timer({
  seconds: 10,
  format:  '%s ' + i18n.get('seconds', user.lang) // Or however you use i18n
});

shantanuthatte avatar Feb 13 '20 00:02 shantanuthatte

Perfect - Thank you for your helpful hints!

ck2000 avatar Feb 13 '20 06:02 ck2000