Hi,

On 05/29/2013 02:59 AM, Pete Batard wrote:
> On 2013.05.28 11:25, Hans de Goede wrote:
>> +int LIBUSB_CALL libusb_set_strerror_locale(const char *locale);
>> +const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode);
>
> Why not go:
> const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode,
> const char *locale);
> ?
>

Most applications do i18n initialization once, and in a different place
then were they would typically call libusb_strerror, so having a
separate call for this seems to make sense, and also matches existing
patterns such as the ubiquitous setlocale function.

> Since it's been removed for so long, we're pretty introducing the call
> at this stage, so we don't care about compatibility with past
> implementation

Well it is and has been part of freebsd for a long time, as well as
of some private libusb forks, so I think we should try to strive for
API compat with those, and I believe that having a separate
libusb_set_strerror_locale is better.

 > (or the not yet release libusb's). To make it intuitive,
> accept NULL as a locale, and make it work the same as "en".
>
> I also really wouldn't bother with trying to figure out whether
> "american" should really mean English,

Well, the idea is that an app which currently calls:

setlocale(LC_ALL, foo);

Can change that to:
setlocale(LC_ALL, foo);
libusb_set_strerror_locale(foo);

And setlocale does accept things like "american", etc.

> IMO, and this is one of the few things that I think Windows did fairly
> well when it comes to NLS (but then again, they seem to have extended
> just a little bit on ISO 639-1), and since this is a libusbx specific
> convenience function (that doesn't have to follow any established set of
> rules as long as we can make it intuitive), what we should really use as
> locale parameter is the Language Culture Name name from
> http://msdn.microsoft.com/en-us/library/ee825488.aspx

Yes that table looks sane, it is the same what POSIX os-es accept for
their setlocale arguments, unfortunately the windows setlocale
function takes (and when used in query mode returns) a much wilder
list of options.

Regards,

Hans

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to