Paul-DS / bootstrap-year-calendar

[DEPRECATED] A fully customizable year calendar widget, for boostrap !
Apache License 2.0
293 stars 243 forks source link

Use UTF-8 encoding for languages #144

Open Zasch opened 7 years ago

Zasch commented 7 years ago

Hey,

I noticed that, if you use german language, there's a problem with the umlauts. I added a 'charset=utf-8' to the script tag, but that didn't work. So I digged a little deeper and found, that the language files had been encoded differently:

./bootstrap-year-calendar.ca.js: UTF-8 Unicode text ./bootstrap-year-calendar.cs.js: UTF-8 Unicode text ./bootstrap-year-calendar.de.js: ISO-8859 text ./bootstrap-year-calendar.es.js: ISO-8859 text ./bootstrap-year-calendar.fr.js: UTF-8 Unicode text ./bootstrap-year-calendar.hr.js: UTF-8 Unicode text ./bootstrap-year-calendar.id.js: ASCII text ./bootstrap-year-calendar.is.js: UTF-8 Unicode text ./bootstrap-year-calendar.it.js: ISO-8859 text ./bootstrap-year-calendar.ja.js: UTF-8 Unicode text ./bootstrap-year-calendar.lt.js: UTF-8 Unicode (with BOM) text ./bootstrap-year-calendar.nl.js: ASCII text ./bootstrap-year-calendar.pl.js: UTF-8 Unicode text ./bootstrap-year-calendar.pt.js: ISO-8859 text ./bootstrap-year-calendar.ru.js: UTF-8 Unicode text ./bootstrap-year-calendar.tr.js: UTF-8 Unicode text ./bootstrap-year-calendar.ua.js: UTF-8 Unicode text, with CRLF line terminators ./bootstrap-year-calendar.uk.js: UTF-8 Unicode text

It would be much appreciated if you could encode all language files in UTF-8 for the next release.

tdeuling commented 7 years ago

I've fixed it locally by using this:

jQuery(document).ready(function() {
    // Fixing encoding issue
    $.fn.calendar.dates['de'] = {
        days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
        daysShort: ['Son', 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam'],
        daysMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
        months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
        monthsShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
        weekShort: 'W',
        weekStart: 1
    };
    Calendars.initialize();
});

Just overwrite the language definition before initializing the calendar.