Closed
Bug 333938
Opened 19 years ago
Closed 6 years ago
Needs access to locale info
Categories
(Core :: Internationalization, defect)
Core
Internationalization
Tracking
()
RESOLVED
FIXED
People
(Reporter: surkov, Assigned: smontagu)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
7.57 KB,
patch
|
smontagu
:
review-
|
Details | Diff | Splinter Review |
Win API has function getLocaleInfo() to get info about locale. F.x. it allows to get first day of the week. The first day of the week can be usefull for calendar widget realization. The bug about "first day of the week" supporting is bug 164495.
Probably nsILocale/nsILocaleService can be extended to provide additional information about locale. Probably nsIDateTimeFormat can be extended to support "first day of the week" feature. What do you think about the additional functionality?
Reporter | ||
Comment 1•19 years ago
|
||
If the idea doesn't contradict with nsILocale interface purposes then we can extend a list of supported categories and add to nsILocale the method like getInfo(in category string).
Though I don't know what kind of locale info does other platforms (not Windows) provide.
Reporter | ||
Comment 2•19 years ago
|
||
*** Bug 345042 has been marked as a duplicate of this bug. ***
Reporter | ||
Updated•19 years ago
|
Assignee: kairo → surkov.alexander
Status: UNCONFIRMED → NEW
Component: Localization → Internationalization
Ever confirmed: true
Reporter | ||
Comment 3•19 years ago
|
||
Some thoughts after talk with smontagu on irc:
We should extend nsILocale interface for "first day of week" getting by following way:
interface nsILocale : nsISupports {
// existing methods
const long FIRST_DAY_OF_WEEK = 0x1;
string GetLocaleInfo(in long aInfoType);
}
Assignee | ||
Comment 4•19 years ago
|
||
We can also extend this mechanism for bug 252039 and friends.
Blocks: numbers
Reporter | ||
Comment 5•19 years ago
|
||
Simon, what do you think about the following scenario?
1) Extend nsI<OSName>Locale interfaces to GetLocaleInfo() method
2) Implement this method for nsI<OSName>LocaleImpl classes
3) Add GetLocaleInfo() method to nsILocale interface
4) Add member of nsI<OSName>Locale type to nsLocale class (member type should be depended on platform by using ifdefs instruction)
5) Redirect calls of GetLocaleInfo() method of nsLocale to ns<OSName>LocaleImpl.
The approach should be not difficult to implement but I guess it's not so fine to like it a lot.
Reporter | ||
Comment 6•19 years ago
|
||
Probably we can add new interface for GetLocaleInfo() method and then nsILocale and nsI<OSName>Locale interface can be inherited from it. It allows to simplify calls redirection.
Reporter | ||
Comment 7•18 years ago
|
||
Attachment #253647 -
Flags: review?(smontagu)
Reporter | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Comment 8•18 years ago
|
||
Comment on attachment 253647 [details] [diff] [review]
patch
>Index: intl/locale/src/windows/nsIWin32LocaleImpl.cpp
>+ // Get OS version
>+ OSVERSIONINFO os;
>+ os.dwOSVersionInfoSize = sizeof(os);
>+ ::GetVersionEx(&os);
>+ PRBool isWAPI = VER_PLATFORM_WIN32_NT == os.dwPlatformId &&
>+ os.dwMajorVersion >= 4;
>+
>+#ifndef WINCE // Always use wide APIs on Win CE.
>+ if (isWAPI) {
>+#endif
>+ PRUnichar dataBuffer[80];
>+ len = GetLocaleInfoW(lcid, info, (LPWSTR) dataBuffer, 80);
>+ data = dataBuffer;
>+#ifndef WINCE // Always use wide APIs on Win CE.
>+ } else {
>+ char dataBuffer[80];
>+ len = GetLocaleInfoA(lcid, info, (LPSTR) dataBuffer, 80);
>+
>+ // convert result to unicode
>+ if (len > 0) {
>+ len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (LPCSTR) dataBuffer,
>+ len, (LPWSTR) data, 80);
>+ }
>+ }
>+#endif
Please, just use 'W' APIs directly. We don't support Win 9x/ME any more.
See bug 359808. I'll try to land the patch there today or tomorrow once I
set up my machine back up.
Comment 9•18 years ago
|
||
Where SUS is supported, we can use nl_langinfo.
http://www.opengroup.org/onlinepubs/009695399/basedefs/langinfo.h.html
Reporter | ||
Comment 10•18 years ago
|
||
(In reply to comment #8)
> Please, just use 'W' APIs directly. We don't support Win 9x/ME any more.
> See bug 359808. I'll try to land the patch there today or tomorrow once I
> set up my machine back up.
>
Ok, I'll remove in new patch after next comments :)
(In reply to comment #9)
> Where SUS is supported, we can use nl_langinfo.
> http://www.opengroup.org/onlinepubs/009695399/basedefs/langinfo.h.html
>
Can you give me more information about SUS and mozilla?
Comment 11•17 years ago
|
||
Don't forget to document how to interpret the return value of GetLocaleInfo(FIRST_DAY_OF_WEEK). Apparently Windows uses 0=Monday, 6=Sunday, while nl_langinfo uses 1=Sunday, 7=Saturday.
Updated•15 years ago
|
QA Contact: mmx_bugzilla → i18n
Assignee | ||
Updated•15 years ago
|
Attachment #253647 -
Flags: review?(smontagu) → review-
Assignee | ||
Comment 12•15 years ago
|
||
Comment on attachment 253647 [details] [diff] [review]
patch
r- per comments 9 and 10
Reporter | ||
Comment 13•15 years ago
|
||
I don't think I would have time in nearest future to get back to this patch. So reassign to default assignee for now.
Assignee: surkov.alexander → smontagu
Status: ASSIGNED → NEW
Comment 14•6 years ago
|
||
This is now supplied by mozIntl - https://firefox-source-docs.mozilla.org/intl/dataintl.html#mozintl-getcalendarinfo-locale
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Comment hidden (advocacy) |
You need to log in
before you can comment on or make changes to this bug.
Description
•