D23119: Fix dates being on the wrong locale when setting an application language individually

2019-09-22 Thread Alexander Semke
asemke added a comment.


  In D23119#519676 , @asemke wrote:
  
  > The original problem in LabPlot was reported by a windows user. The 
proposed fix won't fix the problem on windows. I think the only way to get the 
proper strings on Windows is to get the current language of the application, to 
create a QLocale with the proper language and to use QLocale::toString(const 
QDateTime , const QString )... If this is correct, then we're 
are back to my original question I asked on IRC/Matrix - how to determine the 
current application language?
  
  
  @aacid I solved this problem in 7a10577b52504f6466ecaaedefc8db8d84ffc3d9 
. 
This is not really nice but it works and I accept this hack, at least as a 
temporary solution, since we want to do the next release of LabPlot soon...

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-09-14 Thread Alexander Semke
asemke added a comment.


  In D23119#524720 , @aacid wrote:
  
  > In D23119#519676 , @asemke wrote:
  >
  > > The original problem in LabPlot was reported by a windows user. The 
proposed fix won't fix the problem on windows. I think the only way to get the 
proper strings on Windows is to get the current language of the application, to 
create a QLocale with the proper language and to use QLocale::toString(const 
QDateTime , const QString )... If this is correct, then we're 
are back to my original question I asked on IRC/Matrix - how to determine the 
current application language?
  >
  >
  > Are you saying that the old code actually half works on Windows?
  
  
  What works on windows well is switching of the application language in 
general:
  F7349563: labplot_ukrainisch.png 
  
  Here you see the current release candidate running on windows. The windows 
desktop is German, the application language in LabPlot was set to Ukrainian. 
This works well. What doesn't work is the handling of QDate/QDateTime that is 
shown in the menu on this screenshot and marked red. Originally this problem 
was reported to us for the German-English combination (desktop in German, 
application language English).
  
  > I find that surprising since it means that setting the LANGUAGE environment 
variable on Windows does things, which according to a quick internet search 
doesn't seem to be the case
  
  I don't understand the whole mechanism here now but I see that 
kswitchlanguagedialog_p.cpp writes the new language into the new file 
klanguageoverridesrc. The content of this file for the example above is
  
[language]
labplot2=@ByteArray(uk:en_US)
  
  I assume, based on this information, and not on the value of LANGUAGE which 
is not existing on Windows, the i18n-stuff is properly initialized and we show 
the correct strings.
  
  Btw, klanguageoverridesr is put into QStandardPaths::GenericConfigLocation 
which is C:/Users//AppData/Local on Windows.I'd say this is wrong and 
nedds to go into the Roaming folder.

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-09-02 Thread Albert Astals Cid
aacid added a comment.


  In D23119#519676 , @asemke wrote:
  
  > The original problem in LabPlot was reported by a windows user. The 
proposed fix won't fix the problem on windows. I think the only way to get the 
proper strings on Windows is to get the current language of the application, to 
create a QLocale with the proper language and to use QLocale::toString(const 
QDateTime , const QString )... If this is correct, then we're 
are back to my original question I asked on IRC/Matrix - how to determine the 
current application language?
  
  
  Are you saying that the old code actually half works on Windows?
  
  I find that surprising since it means that setting the LANGUAGE environment 
variable on Windows does things, which according to a quick internet search 
doesn't seem to be the case

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-26 Thread Alexander Semke
asemke added a comment.


  The original problem in LabPlot was reported by a windows user. The proposed 
fix won't fix the problem on windows. I think the only way to get the proper 
strings on Windows is to get the current language of the application, to create 
a QLocale with the proper language and to use QLocale::toString(const QDateTime 
, const QString )... If this is correct, then we're are back to 
my original question I asked on IRC/Matrix - how to determine the current 
application language?

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-23 Thread Alexander Semke
asemke added inline comments.

INLINE COMMENTS

> asemke wrote in kxmlgui_unittest.cpp:1089
> This is maybe not Qt but the locale defintion files which are probably distro 
> specific. I just checked on SLES and on openSuse.
> 
> for ukrainian:
> 
>   LC_TIME=uk_UA.UTF-8 locale mon
>   
> січень;лютий;березень;квітень;травень;червень;липень;серпень;вересень;жовтень;листопад;грудень
> 
> for russian:
> 
>   LC_TIME=ru_RU.UTF-8 locale mon
>   
> Январь;Февраль;Март;Апрель;Май;Июнь;Июль;Август;Сентябрь;Октябрь;Ноябрь;Декабрь
> 
> This is, except of capital letters for ru_RU, correct.
> 
> On Mac I get however
> 
>   
> січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня
> 
> and
> 
>   
> января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря
> 
> which is possessive case and is wrong if you reffer to the name of the month 
> itself.
> 
> @aacid on your distribution you'll most probably get the same output as on my 
> Mac. Under the assumption that Qt evaluates the locale definition files, your 
> test will probably fail on other distributions which do this correctly.

@aacid the discussion about declensions in slawic languages is not relevant to 
your patch I'd say. Maybe it's better to use in the test a language like German 
or any other languages where we don't have this additional complication.

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-23 Thread Alexander Semke
asemke added inline comments.

INLINE COMMENTS

> yurchor wrote in kxmlgui_unittest.cpp:1089
> AFAIK this is broken on Qt level. Cf. calendar widget in KOrganizer 
> (Ukrainian)
> 
> F7273188: cal.png 
> 
> https://bugs.kde.org/show_bug.cgi?id=256952
> 
> There are new specifiers for the primary and alternative month names in glibc 
> but Qt does not implement them (must be something like " " instead of 
> " " in formatting). Rafal Luzynski (the author of the glibc patch) in 
> a private message (2018-01-25) promised me to send the patch for Qt but this 
> has not happened yet.

This is maybe not Qt but the locale defintion files which are probably distro 
specific. I just checked on SLES and on openSuse.

for ukrainian:

  LC_TIME=uk_UA.UTF-8 locale mon
  
січень;лютий;березень;квітень;травень;червень;липень;серпень;вересень;жовтень;листопад;грудень

for russian:

  LC_TIME=ru_RU.UTF-8 locale mon
  
Январь;Февраль;Март;Апрель;Май;Июнь;Июль;Август;Сентябрь;Октябрь;Ноябрь;Декабрь

This is, except of capital letters for ru_RU, correct.

On Mac I get however

  
січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня

and

  
января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря

which is possessive case and is wrong if you reffer to the name of the month 
itself.

@aacid on your distribution you'll most probably get the same output as on my 
Mac. Under the assumption that Qt evaluates the locale definition files, your 
test will probably fail on other distributions which do this correctly.

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-23 Thread Yuri Chornoivan
yurchor added inline comments.

INLINE COMMENTS

> asemke wrote in kxmlgui_unittest.cpp:1089
> there is no declension in Russian for the nominative case. The name of the 
> month is январь and not января, but it is первого января (on January 1st) and 
> not первого январь.
> 
> https://doc.qt.io/qt-5/qlocale.html#monthName - QLocale must return the name 
> of the month, meaning the nominative case  and not one of its declensions.

AFAIK this is broken on Qt level. Cf. calendar widget in KOrganizer (Ukrainian)

F7273188: cal.png 

https://bugs.kde.org/show_bug.cgi?id=256952

There are new specifiers for the primary and alternative month names in glibc 
but Qt does not implement them (must be something like " " instead of 
" " in formatting). Rafal Luzynski (the author of the glibc patch) in a 
private message (2018-01-25) promised me to send the patch for Qt but this has 
not happened yet.

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: yurchor, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-23 Thread Alexander Semke
asemke added inline comments.

INLINE COMMENTS

> ltoscano wrote in kxmlgui_unittest.cpp:1089
> Declensions: 
> https://en.wiktionary.org/wiki/%D1%8F%D0%BD%D0%B2%D0%B0%D1%80%D1%8C#Declension

there is no declension in Russian for the nominative case. The name of the 
month is январь and not января, but it is первого января (on January 1st) and 
not первого январь.

https://doc.qt.io/qt-5/qlocale.html#monthName - QLocale must return the name of 
the month, meaning the nominative case  and not one of its declensions.

> aacid wrote in kxmlgui_unittest.cpp:1089
> Yes, it may surprise you, but i did actually run the tests before submitting 
> this code change.

The question was rethoric. I was rather surprised about the validnes of the 
check you did here.

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, ngraham, 
bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-20 Thread Albert Astals Cid
aacid updated this revision to Diff 64176.
aacid edited the summary of this revision.
aacid removed a subscriber: ltoscano.
aacid added a comment.


  update commit log

REPOSITORY
  R263 KXmlGui

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D23119?vs=63633=64176

BRANCH
  arcpatch-D23119

REVISION DETAIL
  https://phabricator.kde.org/D23119

AFFECTED FILES
  autotests/kxmlgui_unittest.cpp
  src/kswitchlanguagedialog_p.cpp

To: aacid
Cc: apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, ngraham, 
bruns, ltoscano


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-20 Thread Luigi Toscano
ltoscano added inline comments.

INLINE COMMENTS

> asemke wrote in kxmlgui_unittest.cpp:1089
> does this test work? The name of the month is "январь" in russian, not 
> "января".

Declensions: 
https://en.wiktionary.org/wiki/%D1%8F%D0%BD%D0%B2%D0%B0%D1%80%D1%8C#Declension

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: ltoscano, apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, 
ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-20 Thread Albert Astals Cid
aacid added inline comments.

INLINE COMMENTS

> asemke wrote in kxmlgui_unittest.cpp:1089
> does this test work? The name of the month is "январь" in russian, not 
> "января".

Yes, it may surprise you, but i did actually run the tests before submitting 
this code change.

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: apol, kde-frameworks-devel, asemke, LeGast00n, GB_2, michaelh, ngraham, 
bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-17 Thread Alexander Semke
asemke added inline comments.

INLINE COMMENTS

> kxmlgui_unittest.cpp:1089
>  QCOMPARE(QLocale::system().language(), QLocale::Russian);
> +QCOMPARE(QLocale::system().monthName(1), QString::fromUtf8("января"));
>  

does this test work? The name of the month is "январь" in russian, not "января".

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: apol, kde-frameworks-devel, asemke, LeGast00n, michaelh, ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-14 Thread Aleix Pol Gonzalez
apol added a comment.


  LGTM +1

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: apol, kde-frameworks-devel, asemke, LeGast00n, michaelh, ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-12 Thread Albert Astals Cid
aacid added a comment.


  hmmm, now that i think about it LC_ALL probably needs a .UTF-8 suffix or 
something to be correct
  
  But OTOH this is working fine for me.
  
  comments?

REPOSITORY
  R263 KXmlGui

REVISION DETAIL
  https://phabricator.kde.org/D23119

To: aacid
Cc: kde-frameworks-devel, asemke, LeGast00n, michaelh, ngraham, bruns


D23119: Fix dates being on the wrong locale when setting an application language individually

2019-08-12 Thread Albert Astals Cid
aacid created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
aacid requested review of this revision.

REVISION SUMMARY
  We were only setting LANGUAGE, but that does not set LC_TIME so the time was 
still
  set to the "system" locale, we now set LC_ALL to switch the application 
completely to that language

REPOSITORY
  R263 KXmlGui

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D23119

AFFECTED FILES
  autotests/kxmlgui_unittest.cpp
  src/kswitchlanguagedialog_p.cpp

To: aacid
Cc: kde-frameworks-devel, asemke, LeGast00n, michaelh, ngraham, bruns