Our powerful JS Calendar component


Post by evgenia »

Hello everyone. I am developing a calendar for users from Ukraine, I need the interface to be in Ukrainian. As I understand it, there is no support for this language, so I created such a js file (I took an example from custom.locale.De.js) and write phrases in Ukrainian directly.

code.PNG
code.PNG (39.87 KiB) Viewed 912 times

But I have a problem with the fact that months and weeks remain the same in English. How can I translate it to Ukrainian?

Снимок.PNG
Снимок.PNG (51.18 KiB) Viewed 912 times

Post by alex.l »

Hi evgenia,

For dates you should localize DateHelper.locale property. Please check if you did?

Example for Russian language


    DateHelper : {
        locale         : 'ru',
        weekStartDay   : 1,
        // Non-working days which match weekends by default, but can be changed according to schedule needs
        nonWorkingDays : {
            0 : true,
            6 : true
        },
        // Days considered as weekends by the selected country, but could be working days in the schedule
        weekends : {
            0 : true,
            6 : true
        },
        unitNames : [
            { single : 'миллисек', plural : 'миллисек', abbrev : 'мс' },
            { single : 'секунда', plural : 'секунд', abbrev : 'с' },
            { single : 'минута', plural : 'минут', abbrev : 'мин' },
            { single : 'час', plural : 'часов', abbrev : 'ч' },
            { single : 'день', plural : 'дней', abbrev : 'д' },
            { single : 'неделя', plural : 'недели', abbrev : 'нед' },
            { single : 'месяц', plural : 'месяцев', abbrev : 'мес' },
            { single : 'квартал', plural : 'кварталов', abbrev : 'квар' },
            { single : 'год', plural : 'лет', abbrev : 'г' },
            { single : 'десятилетие', plural : 'десятилетия', abbrev : 'дес' }
        ],
        // Used to build a RegExp for parsing time units.
        // The full names from above are added into the generated Regexp.
        // So you may type "2 н" or "2 нед" or "2 неделя" or "2 недели" into a DurationField.
        // When generating its display value though, it uses the full localized names above.
        unitAbbreviations : [
            ['мс', 'мил'],
            ['с', 'сек'],
            ['м', 'мин'],
            ['ч'],
            ['д', 'ден', 'дне'],
            ['н', 'нед'],
            ['мес'],
            ['к', 'квар', 'квр'],
            ['г'],
            ['дес']
        ],
        parsers : {
            L  : 'DD.MM.YYYY',
            LT : 'HH:mm'
        },
        ordinalSuffix : number => `${number}-й`
    },

All the best,
Alex


Post by evgenia »

Will it change month name and day of week name?


Post by alex.l »

Yes, it will change date formats that you asked about. Did you check and it doesn't work for you?

All the best,
Alex


Post by evgenia »

I need to change name of the months and the name of the weeks

Снимок.PNG
Снимок.PNG (57.66 KiB) Viewed 905 times

For example, at the top it should be written "Тиждень 50, Грудень 2021" instead of "Тиждень 50, December2021" and instead "sun" most be "нед"


Post by alex.l »

Hi evgenia,

Did you try the code that I suggested? You should add that configuration into your locale file. According to standards https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

you should use "UA" or "uk" for DateHelper.locale property.

locale     = {
    // ...
    DateHelper : {
        locale : 'UA',
        // ...
    }
       
}

More about date formatting is here https://bryntum.com/docs/calendar/guide/Calendar/customization/localization#change-date-formats

If it doesn't work for you, could you please share your code with us, we will take a look and help you out.

All the best,
Alex


Post by evgenia »

I had the same code as you did in the example above

locale     = {
    // ...
    DateHelper : {
        locale : 'UA',
        // ...
    }       
}

I changed UA to uk and it worked

locale     = {
    // ...
    DateHelper : {
        locale : 'uk',
        // ...
    }       
}

Thanks a lot!


Post Reply