Closed
Bug 233631
(osxtime)
Opened 21 years ago
Closed 20 years ago
GetApplicationLocale should not be used with FormatTime methods in order to support user's customisation (OS X is affected)
Categories
(Core :: Internationalization, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.7beta
People
(Reporter: cnst+bmo, Assigned: cnst+bmo)
References
Details
(Keywords: intl)
Attachments
(4 files, 1 obsolete file)
228.01 KB,
image/jpeg
|
Details | |
34.26 KB,
image/png
|
Details | |
1.35 KB,
patch
|
mscott
:
review+
roc
:
superreview+
chofmann
:
approval1.7b+
|
Details | Diff | Splinter Review |
3.35 KB,
patch
|
jshin1987
:
review+
roc
:
superreview+
chofmann
:
approval1.7b+
|
Details | Diff | Splinter Review |
User-Agent: Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-GB; rv:1.6) Gecko/20040113 Mozilla does not honour the long date and time format, defined by the OS X. In the test case, I tried to set the Date format to the one used in any other country, and on the screenshot I used French with some modifications. The OS X itself is en-US and version is 10.2.6. Reproducible: Always Steps to Reproduce: 1. Open System Prefs, choose International, change Date format to French (just as an example, and assuming that your default locale is not French). Change Time format to French as well. 2. One Page Info in Mozilla. Actual Results: One sees the wrong format of the long date (in Page Info, for example). Expected Results: One sees the right format of the long date (in Page Info, for example).
Assignee | ||
Comment 1•21 years ago
|
||
Sorry for JPEG, the PNG file was too large...
Assignee | ||
Updated•21 years ago
|
Blocks: dateandtime
Assignee | ||
Updated•21 years ago
|
Comment 2•21 years ago
|
||
This is an interesting bug. Modern OS' offer a way to customize date and time format (among others) regardless of the locale. Mozilla needs to obtain that informaion from the OS. I'm wondering what mozilla has to do in the following case: 1. the os locale is set to en-US 2. 'fr-CA' language/region pack is active 3. the data time format configured in the OS is Japanese Which should take the highest priority?
Assignee: smontagu → jshin
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 3•21 years ago
|
||
(In reply to comment #2) > This is an interesting bug. Modern OS' offer a way to customize date and time > format (among others) regardless of the locale. Mozilla needs to obtain that ... > Which should take the highest priority? I think the customisation must have the highest priority. For instance, I am Russian, I live in the US, I use en-GB locale, and I like the ISO time notation. :-) Weird, huh? BTW, not only OS X has problems with long date and time format --- apparently, UNIX builds do not have any kind of long date and time. Moreover, the short one is based on the locale, rather than the user settings of the desktop (KDE, as example).
Alias: osxtime
Comment 4•21 years ago
|
||
Mozilla doesn't have any support for KDE interoperability at the moment although it has some for Gnome2. Anyway, that has to be a separate bug.
Comment 5•21 years ago
|
||
See bug 231280 comment 21
Assignee | ||
Comment 6•21 years ago
|
||
As you can see, Camino still honours the long date and time customisation (I only found one window with the long date and time in Camino so far), while Mozilla does not (as far as the windows I have found are concerned). This is probably related to the previous Comment 5, i.e. we should not pass the locale pointer to the FormatTime/FormatPRTime on Mac OS X. In my search for the use of these functions, I found the code that might create problems similar to the ones described in the previous comment: http://lxr.mozilla.org/mozilla/source/intl/locale/src/nsScriptableDateFormat.cpp#94
Assignee | ||
Comment 7•20 years ago
|
||
This clean-up patch should fix the problem. In the original code, we were trying to get the application's locale and pass it to the dateTimeFormat methods. This is incorrect --- we should use the user's customisation regardless of the locale (i.e. we should pass nsnull as a locale for FormatTime method). One way or the other, Mac-specific code (including nsDateTimeFormatMac.cpp) IS correct (!), but the use of the dateTimeFormat methods outside of their class is not. This patch should fix the problem on Mac and leave all other OS' behaviour as it is of today.
Assignee: jshin → cnst.bmo
Status: NEW → ASSIGNED
Assignee | ||
Updated•20 years ago
|
Attachment #142657 -
Flags: superreview?(roc)
Attachment #142657 -
Flags: review?(jshin)
Comment 8•20 years ago
|
||
Comment on attachment 142657 [details] [diff] [review] clean-up patch for /intl/locale/src/nsScriptableDateFormat.cpp >- if (localeName.IsEmpty()) >- localeService->GetApplicationLocale(getter_AddRefs(locale)); You should keep this. Otherwise, locale would be left uninitialized.
Attachment #142657 -
Flags: review?(jshin) → review-
Assignee | ||
Comment 9•20 years ago
|
||
(In reply to comment #8) > (From update of attachment 142657 [details] [diff] [review]) > > >- if (localeName.IsEmpty()) > >- localeService->GetApplicationLocale(getter_AddRefs(locale)); > > You should keep this. Otherwise, locale would be left uninitialized. No, we should not keep this. This bug is about removing exactly that code! See my comment #7. I intended to use nsnull as locale, unless !localeName.IsEmpty(). As a reference, take a look at bug #231280, which is resolved with a similar patch.
Assignee | ||
Comment 10•20 years ago
|
||
I think this is the last misuse of locale for Date and Time formatting. Again, the idea of the patch is the same as of the ones before --- we leave locale set to nsnull by default.
Assignee | ||
Updated•20 years ago
|
Attachment #142690 -
Flags: review?(jshin)
Assignee | ||
Updated•20 years ago
|
Attachment #142657 -
Attachment description: clean-up patch → clean-up patch for /intl/locale/src/nsScriptableDateFormat.cpp
Attachment #142657 -
Attachment filename: nsdiff → nsScriptableDateFormat.cpp.patch
Attachment #142657 -
Flags: review- → review?(jshin)
Assignee | ||
Updated•20 years ago
|
Summary: Long Date format is incorrect (OS X) → GetApplicationLocale should not be used with FormatTime methods in order to support user
Assignee | ||
Updated•20 years ago
|
Blocks: 231280
Summary: GetApplicationLocale should not be used with FormatTime methods in order to support user → GetApplicationLocale should not be used with FormatTime methods in order to support user's customisation (OS X is affected)
Target Milestone: --- → mozilla1.7beta
Attachment #142657 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Updated•20 years ago
|
Attachment #142690 -
Flags: superreview?(roc)
Attachment #142690 -
Flags: superreview?(roc) → superreview+
Comment 11•20 years ago
|
||
Comment on attachment 142657 [details] [diff] [review] clean-up patch for /intl/locale/src/nsScriptableDateFormat.cpp >- if (!locale) >- return NS_ERROR_NOT_AVAILABLE; >+ NS_ENSURE_TRUE(locale, NS_ERROR_FAILURE); Please, use NS_ERROR_NOT_AVAILABLE. It might be better to keep |if (!locale) return ....| unless you think it's 'assertion-worthy'. >- if (!dateTimeFormat) >- return NS_ERROR_NOT_AVAILABLE; >+ NS_ENSURE_TRUE(dateTimeFormat, NS_ERROR_FAILURE); ditto. With that, r=jshin
Attachment #142657 -
Flags: review?(jshin) → review+
Assignee | ||
Comment 12•20 years ago
|
||
This patch addresses jshin comments. We are now using the real 'rv' value.
Attachment #142657 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #143768 -
Flags: superreview?(roc)
Attachment #143768 -
Flags: review?(jshin)
Attachment #143768 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Updated•20 years ago
|
Flags: blocking1.7b?
Comment 13•20 years ago
|
||
Comment on attachment 143768 [details] [diff] [review] clean-up patch v.2 for intl/locale/src/nsScriptableDateFormat.cpp r=jshin (if you insist...)
Attachment #143768 -
Flags: review?(jshin) → review+
Assignee | ||
Updated•20 years ago
|
Attachment #143768 -
Flags: approval1.7b?
Comment 14•20 years ago
|
||
Comment on attachment 143768 [details] [diff] [review] clean-up patch v.2 for intl/locale/src/nsScriptableDateFormat.cpp a=chofmann for 1.7b
Attachment #143768 -
Flags: approval1.7b? → approval1.7b+
Assignee | ||
Updated•20 years ago
|
Attachment #142690 -
Flags: approval1.7b?
Comment 15•20 years ago
|
||
Comment on attachment 142690 [details] [diff] [review] patch for /mailnews/compose/src/nsMsgCompose.cpp a=chofmann for 1.7b
Attachment #142690 -
Flags: approval1.7b? → approval1.7b+
Updated•20 years ago
|
Attachment #142690 -
Flags: review?(jshin) → review+
Comment 16•20 years ago
|
||
both patches checked in Checking in intl/locale/src/nsScriptableDateFormat.cpp; /cvsroot/mozilla/intl/locale/src/nsScriptableDateFormat.cpp,v <-- nsScriptableDateFormat.cpp new revision: 1.24; previous revision: 1.23 done Checking in mailnews/compose/src/nsMsgCompose.cpp; /cvsroot/mozilla/mailnews/compose/src/nsMsgCompose.cpp,v <-- nsMsgCompose.cpp new revision: 1.422; previous revision: 1.421 done
Assignee | ||
Comment 17•20 years ago
|
||
Both patches were checked in by biesi on 2004-03-16 13:55 PST. Mozilla App Suite 1.7b and later will contain the fix.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Flags: blocking1.7b?
Comment 18•20 years ago
|
||
I think this check-in caused Bug 239535.
Assignee | ||
Comment 19•20 years ago
|
||
(In reply to comment #18) > I think this check-in caused Bug 239535. What makes you think this way? Have you tried to reproduce it before and after the patch was applied? I think the nightlies are still around... The patch is simple and does not look to contain any errors. If the bug exists, it must be elsewhere. The code of this patch is platform-independent.
Assignee | ||
Comment 20•20 years ago
|
||
Sorry, I see the description of your bug now. This patch might have activated some other bug in FormatTime.
You need to log in
before you can comment on or make changes to this bug.
Description
•