Version: 0.3 (using KDE 4.2.4) OS: Linux Installed from: Debian testing/unstable Packages On the last page of the "Create Calender" wizard, the year is formatted wrong. Can be fixed by changing line 201 in calwizard.cpp to: wPrintLabel_->setText(i18n("Click Next to start Printing<br/><br/>" "Following months will be printed for year %1:<br/>").arg(year) + printList.join(" - ") + extra);
i don't see anything wrong on the calendar wizard and your patch is already what is wrote on the code. could you provide a screenshot please ? thanks
Created attachment 35091 [details] Screenshot of wrongly formatted "2,009" on last page of calender wizard Locale: LANG="en_US.UTF-8"
I had fixed a similar problem in digikam some time ago: http://websvn.kde.org/?view=rev&revision=893026 http://websvn.kde.org/?view=rev&revision=893030 I guess this should work here, too.
Oh by the way, I can confirm it :-) But for me it looks like this: "2 009" So a whitespace has been added. I will assume to use my patches made to digiKam, if possible. Unfortunately I have no access to the sources at work today, so I can't test it.
Mickael which digikam version do you have ?
2 009 for me too. To be correct it have to be 2009 right ?
I have digikam version 0.10, kipiplugins 0.4, KDE 4.2.4, Qt 4.5.1 Does i18n format numbers locale-aware? I could not find anything on this in the documentation, that's why I suggested to use Qt's .arg, which does locale-aware formatting only if you write "%L1". But Nicolas' suggestion of converting the integer to a string first should have the same effect.
(In reply to comment #6) > 2 009 for me too. To be correct it have to be 2009 right ? Sure ;-)
SVN commit 995464 by nlecureuil: Fix year formating in calendar BUG:196888 M +1 -1 calwizard.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=995464
This patch is not locale aware. As I posted above, we should use KLocale instead. Something like KLocale tmpLocale(*KGlobal::locale()); tmpLocale.setDateFormat("%Y"); QString year = tmpLocale.formatDate(date); would be better.
Ah yes for the local aware part but if i understand correctly, year can't be a QString. i will try to do a patch and post it on the bugzilla
Why not? It is a QString now... :-) QString::number generates a QString object.
i have a pb with : QString year = tmpLocale.formatDate(date); what should be used instead of date ? i tried cSettings_->year() but that doesn't work
Why not use the d object (QDate)?
I'm not sure if QDate is already locale aware, because we set it with KGlobal::locale()->calendar()->setDate(d, cSettings_->year(), 1, 1); before. So you can either try using the QDate object directly: [...] "Following months will be printed for year %1:<br/>", QString::number(d.year())) or use it like that: QString year = tmpLocale.formatDate(d);
ok but when using QString::number(d.year())) how can i see if this is locale-aware ?
No clue :D The best would be just to use the KLocale... code. It doesn't hurt if we really localize this twice: QString year = tmpLocale.formatDate(d);
because of line 184, year have to be an int, so i needed to create a new var. What do you think of: Index: calendar/calwizard.cpp =================================================================== --- calendar/calwizard.cpp (révision 995464) +++ calendar/calwizard.cpp (copie de travail) @@ -188,7 +188,7 @@ } else { - int year = cSettings_->year(); + int year = cSettings_->year(); QString extra; if ((KGlobal::locale()->calendar()->month(QDate::currentDate()) >= 6 && @@ -198,8 +198,12 @@ "calendar for<br/>the current year or a year in the " "past.")+"</b>"; + KLocale tmpLocale(*KGlobal::locale()); + tmpLocale.setDateFormat("%Y"); + QString year_locale = tmpLocale.formatDate(d); + wPrintLabel_->setText(i18n("Click Next to start Printing<br/><br/>" - "Following months will be printed for year %1:<br/>", QString::number(year)) + "Following months will be printed for year %1:<br/>", year_locale) + printList.join(" - ") + extra); wPrintLabel_->setTextFormat(Qt::RichText);
Yes sure, this was what I suggested before :D It should work fine... if not, we can change it again :) Andi
SVN commit 998433 by nlecureuil: make year locale aware CCBUG:196888 M +5 -1 calwizard.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=998433