linuxmint / cinnamon-spices-desklets

Desklets for the Cinnamon desktop
http://cinnamon-spices.linuxmint.com
138 stars 156 forks source link

googleCalendar@javahelps.com does not use locale #213

Closed Ilis closed 6 years ago

Ilis commented 6 years ago

@slgobinath

Issue googleCalendar does not use locale

Steps to reproduce Install googleCalendar See dates in English, i. e. "WEDNESDAY, NOVEMBER 01"

Expected behaviour Dates in national format, i. e. "СРЕДА, НОЯБРЬ 01" (for ru_RU)

Other information

slgobinath commented 6 years ago

Hi, I am looking at this issue and try my best to solve it as soon as possible.

Thanks

spacy01 commented 6 years ago

@slgobinath, @Ilis Hi guys! I found sort of solution about days and months localization. The local must be set into /lib/xdate.js You must add few strings in the end of the file. My localization is bulgaria, so my locale is 'bg':

XDate.locales['bg'] = { monthNames: ['Януари','Февруари','Март','Април','Май','Юни','Юли','Август','Септември','Октомври','Ноември','Декември'], // long month names, startet from january monthNamesShort: ['Яну.','Фев.','Мрт','Апр','Май','Юни','Юли.','Авг','Сеп.','Окт.','Ное.','Дек.'], // short month names, startet from january dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'], // long day names, started from sunday dayNamesShort: ['Нед.','Пнд.','Втр.','Срд.','Чет.','Пет.','Сбт.'] // short day names, started from sunday };

XDate.defaultLocale = 'bg'; // set new default locale.

So, this work for me, but i dont know how this shout be applied into desklet and pot files...

NikoKrause commented 6 years ago

I have a solution for this. I'll create a PR.

Ilis commented 6 years ago

@NikoKrause

It didn't work. Months names are still in English.

Maybe .po and .pot have to be updated?

NikoKrause commented 6 years ago

@Ilis Yes .pot has to be updated and the new Strings have to be translated.

slgobinath commented 6 years ago

@NikoKrause please check my new PR https://github.com/linuxmint/cinnamon-spices-desklets/pull/259 in which I have improved your code. (pot file also updated)

This PR also fixes alignment issues.

Ilis commented 6 years ago

I've updated ru_po in #263, but noticed that string for shortened month name May is missed.

slgobinath commented 6 years ago

The problem is in English May is used for both short and long names. I did not think about it. I will fix it soon.

NikoKrause commented 6 years ago

@slgobinath is right. It's the same string for both. How to know, which string to translate how? Not sure if this will work, but there should be something similar for applets: https://stackoverflow.com/questions/10235822/same-string-with-different-translation

NikoKrause commented 6 years ago

https://github.com/search?q=org%3Alinuxmint+pgettext&type=Code

slgobinath commented 6 years ago

Hi @NikoKrause, Is there a way to test desklet locale without changing system locale?

NikoKrause commented 6 years ago

I don't know of any way.

slgobinath commented 6 years ago

Hi, Since I am unable to test, could you please try the solution provided in the Stack Overflow Answer using this method: Gettext.dpgettext

I think we need to replace _("May") in xdate.js by Gettext.dpgettext(UUID, "short", "May") and Gettext.dpgettext(UUID, "long", "May") PO file should be:

msgctxt "short"
msgid "May"
msgstr ""

msgctxt "long"
msgid "May"
msgstr ""

Modified xdate.js is attached here: xdate.js.zip

Ilis commented 6 years ago

May is not a problem in Russian (Май stands both for full and shortened names, as in English)

But e. g. for Ukrainian it is not true:

Месяц Сокр. Translation
1 Січень Сiч. Jan
2 Лютий Лют. Feb
3 Березень Бер. Mar
4 Квітень Квiт. Apr
5 Травень Трав. May
6 Червень Черв. Jun
7 Липень Лип. Jul
8 Серпень Серп. Aug
9 Вересень Вер. Sep
10 Жовтень Жовт. Oct
11 Листопад Лист. Nov
12 Грудень Груд. Dec
NikoKrause commented 5 years ago

I have tried: Gettext.dpgettext(UUID, "short", "May") and Gettext.dpgettext(UUID, "long", "May") and it works

slgobinath commented 5 years ago

Please accept my apologies for the delay.

@NikoKrause thank you very much for testing the solution. This solution has been implemented in https://github.com/linuxmint/cinnamon-spices-desklets/pull/399