Issue 99765 - i18npool: isShort test looks a little strange...
Summary: i18npool: isShort test looks a little strange...
Status: CLOSED FIXED
Alias: None
Product: Internationalization
Classification: Code
Component: i18npool (show other issues)
Version: DEV300m42
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: dtardon
QA Contact: issues@l10n
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2009-03-02 09:09 UTC by caolanm
Modified: 2013-08-07 15:02 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
keep as it is (974 bytes, patch)
2009-03-02 09:10 UTC, caolanm
no flags Details | Diff
random change to logic that "reads" better (971 bytes, patch)
2009-03-02 09:11 UTC, caolanm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2009-03-02 09:09:27 UTC
in i18npoo/source/calendar/calendar_gregorian.cxx we have...

sal_Bool isShort = (nCalendarDisplayCode == CalendarDisplayCode::SHORT_YEAR ||
    nCalendarDisplayCode == CalendarDisplayCode::LONG_YEAR) && value >= 100 ||
    nCalendarDisplayCode == CalendarDisplayCode::SHORT_QUARTER ||
    nCalendarDisplayCode == CalendarDisplayCode::LONG_QUARTER;

which looks a little strange, "isShort". Attached is version1 which keeps things
exactly as they are, except adding some brackets to keep new gcc quiet.

But the isShort = (_YEAR && value >= 100) looks kind of odd, is that really what
we want ? Not e.g. isShort == SHORT_YEAR || (LONG_YEAR && value < 100) ?
Comment 1 caolanm 2009-03-02 09:10:46 UTC
Created attachment 60577 [details]
keep as it is
Comment 2 caolanm 2009-03-02 09:11:39 UTC
Created attachment 60578 [details]
random change to logic that "reads" better
Comment 3 ooo 2009-03-02 12:07:44 UTC
This indeed looks a bit strange, but it may be just because of the name
'isShort' of the variable.. the CJK requirements aren't clear to me.

@khong: Karl, was the original logic really intended?
Comment 4 karl.hong 2009-03-02 17:50:53 UTC
Yes, that is intended. What it says is if it is year part, no matter it is LONG
or SHORT, and year is less than 100, it should use another format. 

Example, for Taiwan, current year is ROC 98, it should show as 九十八, not 九八.
While Gregorian 1998 shows as 一九九八 for LONG_YEAR and 九八 for SHORT_YEAR.

First patch is ok, second one is not right, which show 九八 for ROC 98.

I agree the name 'isShort' is misleading. 'keepFormat' may be more suitable. 
Comment 5 caolanm 2009-03-03 09:06:03 UTC
ok, thanks. I'll just commit the first one into cmcfixes55 then to silence the
extra new-gcc warnings
Comment 6 caolanm 2009-03-03 09:06:53 UTC
done in cmcfixes55
Comment 7 caolanm 2009-03-04 11:17:42 UTC
Can you code-review these changes in cmcfixes55 and set each to verified if correct
Comment 8 dtardon 2009-03-07 07:39:49 UTC
Verified in cmcfixes55.
Comment 9 caolanm 2009-03-20 14:23:27 UTC
done m44