Message-ID:
<CAEyBR+V17SEUqNxxXTcCNkX2vLE639bNi+q=Wgz6PAiz3e6dtQ at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
If the locale changes, I’d say trigger an event and then just let the
program call SDL_PreferredLocales() again to retrieve the new list
(why do we need a different function?).
The new function was intended as a possible alternative, not as part
of the event proposal.
Actually, coming to think on it, the above would not be thread-safe
since the list is allocated only once globally, meaning that even if
the list didn’t change until the function is called, once it is the
list will change for all threads without them knowing at all… What
should be done about this?
I’d say that’s up to the app’s developer. I consider it roughly the
same as the program trying to use the locale data BEFORE calling
SDL_PreferredLocales. Fortunately SDL already has atomic operations
wrappers, so it shouldn’t be TOO hard to deal with (or at least, no
harder than any other atomic stuff is).
Also, I was figuring that SDL would only update the locale string when
prompted by the program.> Date: Sun, 21 Oct 2012 04:59:35 -0300
From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Date: Sun, 21 Oct 2012 07:52:35 -0400
From: “Ryan C. Gordon”
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID: <0657A41E-E31E-4C6A-881D-B56E384BFD66 at icculus.org>
Content-Type: text/plain; charset=us-ascii
Can you think of a realistic situation where someone says “it’s my turn to
play this game in a foreign language, so I’m going to change a setting in
the system control panel and not restart the app”?
I wasn’t thinking about games when I wrote that, I was thinking about
control panels (and anything else that can be expected to run for
multiple shifts without being turned off). And for that matter, it was
largely a ‘what corner-cases does this have?’ train of thought
anyways. The main reason why I even asked was to generate some
discussion on it (I don’t think I would pay attention to a locale
change, and mostly I would use this system as a installer/first
boot/configuration panel tool).
It’s sort of like the Unix philosophy on utilities: do one thing, and
do it well. If you’re going to do locales, then you might as well do
them well.
It’s a lot of complexity, especially since none of Mac OS X, Linux, or
Windows has an event to notify you of this change, and Unix systems are
checking an environment variable which can’t change.
To be honest, I was assuming that any such event and/or function would
be a placeholder until someone needed it. Because honestly, do people
normally do profiling to figure out what events they actually see, or
do they just deal with the ones that they CARE about?
Also, what about some ‘locale equality’ and 'locale_equivalence’
functions? Especially for programs that store their text (and/or
sound/graphics/etc.) outside of their actual executable, such
functions could be very convenient for choosing between different
versions of resources.
What would we be comparing? To see if “en_GB” and “en_US” are both the same
language, for example?
Equality would check for whether things were identical (“en_GB” and
"en_US" would presumably both be identical to “en”, but NOT to each
other), equivalence would check whether things were ‘close enough’
(“en_GB” and “en_US” WOULD both be equivalent).
For the use case, imagine that you’ve downloaded a demo that only has
"en_GB" resources, and your locale is set to “en_US”. A simple string
comparison would leave you unable to play the game, because it
couldn’t load any of it’s needed resources.
Date: Sun, 21 Oct 2012 13:12:26 -0400
From: “Ryan C. Gordon”
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
Content-Type: text/plain; charset=us-ascii
It’s a lot of complexity, especially since none of Mac OS X, Linux, or
Windows has an event to notify you of this change
Brief followup: it turns out Mac OS X does:
NSCurrentLocaleDidChangeNotification, as of 10.5. But I feel my points still
stand.
–ryan.
So, it’s a one-event or 2-3 function change? I’m not impressed with
the difficulty of that, but I’m not worked up about it one way or
another, do what makes the most sense to you. If someone else really
cares, then they can either chime in, or do something later.
Date: Sun, 21 Oct 2012 15:16:15 -0300
From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<CAEyBR+X19mx4KxBdcx_8AKKc9HY72A_NE6veSu+qaR6VHdx1Yg at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
The problem is that many programs include separate translations
adapted for each locale so if you’re adding this you probably want
them to know the full locale, not just the overall language.
Agreed, that’s why I suggested the equality/equivalence testing
functions. Might as well have such simple and commonly relevant
functions inside SDL (and if it requires a comparison table instead of
simple string comparisons, then that’s even more reason to put it in
SDL).
Date: Sun, 21 Oct 2012 11:26:22 -0700 (PDT)
From: Mason Wheeler
To: sdl at lists.libsdl.org
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<1350843982.87486.BPMail_high_carrier at web122501.mail.ne1.yahoo.com>
Content-Type: text/plain; charset=us-ascii
Why are we talking about locale and SDL?
Because we hate you? Or was it that you hate us? It can be so
difficult to tell when you essentially say that SDL 2 should have
fewer features than SDL 1.2. Most of us aren’t looking for a
multimedia-only library, we’re looking for a ‘thin’ (a.k.a. a simple)
library that doesn’t add layer upon layer of cruft that slows you down
and clouds the waters without providing an improved programming
environment.
And frankly, if I DID want a minimalist library then I would just
IGNORE the rest instead of complaining about it.
What does that have to do with.
SDL’s purpose, which is providing a multimedia development API? Locale is a
standard library-level piece of functionality; it ought to already be
available to developers. Do we really need to reinvent the wheel like
this?
Ultimately, SDL is less a simple media library, and more a simple
cross-platform library. It doesn’t focus on multi-media (in fact, if
it did then SDL_image would probably be built-in, as would a video
decoder, etc.), it focuses on being a simple multi-OS platform.
Sometimes things aren’t 100% cross-platform (DirectX and the hooks for
e.g. iOS), but what CAN be done well is.
Date: Sun, 21 Oct 2012 15:36:06 -0300
From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<CAEyBR+X7XNf2zv5GcjpTKBwC_fD6mdPbKkCQJotRcVtrxR9H8g at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
I don’t recall the standard library ever providing a full list of all
the languages the system supports, sorted by the priority on which the
user wants to use them. Not even in POSIX.
I don’t think that’s what Mason was saying. Mason seems to want SDL to
be extremely minimalist, and as a general rule of thumb is opposed to
anything that isn’t directly related to graphics or audio. To be
honest, I think that if he got his way then SDL would mostly be
ignored by developers, since that’s not all that people need.
Date: Sun, 21 Oct 2012 21:30:32 +0200
From: Marcus von Appen
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID: <20121021193032.GA2140 at medusa.sysfault.org>
Content-Type: text/plain; charset=“us-ascii”
And why do you cut off the extra
information (e.g. encoding)?
- Is the encoding specified with a similar standard document? I
wouldn’t want to deal with specifying it myself.
- Does the encoding need to be specified? SDL doesn’t provide a way
to create text terminals, so if you’re using them you’re dealing with
special stuff anyways.
- As I best recall, SDL’s font rendering library ALWAYS uses UTF-8,
so there’s no real point in asking for what encoding you’ll be using
there.
- Files will be encoded in whichever encoding they use, and if you
support several then you should provide the user with a way to select
the one that gets output.
And the last: setlocale() is a C99 standard function, why is not that
one used in (at least) the POSIX implementation, and ideally in most of
the implemenetations?
Wasn’t POSIX’s first specification released in the early 90’s, or even
the 80’s? And aren’t the later specifications half-way ignored if you
aren’t paying for certification? I’d guess that’s why.
Date: Sun, 21 Oct 2012 15:36:43 -0400
From: “Ryan C. Gordon”
To: SDL Development List
Cc: “sdl at lists.libsdl.org”
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
Content-Type: text/plain; charset=us-ascii
Threading is about equally as standard, should we remove that too?
–ryan.
Mason’s the type to say ‘yes’, so I’m surprised that you asked.
Date: Sun, 21 Oct 2012 16:41:23 -0300
From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<CAEyBR+X=QZFQ3PhOKBdetcZeJG1nQbYEUb923mdzdiBKyvS=Uw at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
That said, can somebody tell me what standard function allows one to
retrieve the list of preferred locales? I don’t know of any such
function.
As has been said, Mason probably wasn’t talking about a standard C
function, but instead OS specific functions or functions from other
libraries. There is a somewhat related function from the C library
(called setlocale), but it can’t be counted on to specify things any
particular way, and is largely intended to alter settings within the C
runtime library.
Mason basically wants SDL to include multimedia support, the stuff
required by that, and nothing else. I don’t think he’s highly rated
here, and if he took over the project for some reason then I think
someone would wind up forking it.
Date: Sun, 21 Oct 2012 12:54:42 -0700 (PDT)
From: Mason Wheeler
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<1350849282.34421.YahooMailNeo at web122503.mail.ne1.yahoo.com>
Content-Type: text/plain; charset=“iso-8859-1”
That’s another one I sort of wonder about.? Why does SDL have its own thread
system?? Or atomic operations, or synchronization primitives?? Those are all
things that ought to be built into the standard library of any modern
language.?
C doesn’t have them yet, and I don’t recall if C++0x includes
synchronization primitives (nor do I know much about it’s atomics).
Besides, what’s in a standard library doesn’t actually matter to SDL
unless it’s in C’s standard library. Also, didn’t this conversation
already happen? I seem to remember Sam posting to the mailinglist that
he disagreed with your vision of SDL a few months ago.
But what do we need all the rest of this stuff for?? Isn’t the point of
using an external library to give you the ability to do new things??
Throwing in a bunch of stuff that we can already do seems kind of
pointless.
Hahaha! SDL isn’t about doing new things, it’s about doing things
easier than you otherwise could. I consider SDL inherently easier than
what I’ve experienced of e.g. Win32, and I dislike both Boost and SFML
(or whatever that was called).
SDL doesn’t do “new”, SDL does “easy”.
Date: Sun, 21 Oct 2012 17:15:43 -0300
From: Sik the hedgehog <sik.the.hedgehog at gmail.com>
To: Mason Wheeler , SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<CAEyBR+UOMEu7Lbv1gc5MTktekdD6nC6tN__g+fjYseSSxhUoWA at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Ironically I see no use for the streaming system, I’d rather use
something like PhysFS for that stuff (though it ended up biting me
back when I needed access outside the sandboxed filesystem…).
If you have the time then you might want to write an in-program
filesystem. I’ve played with doing that and it isn’t a big problem (it
requires a in-program filesystem library, a simple 'resource compiler’
to build a C file, and a simple ‘translating compiler’ to convert data
files into a C array representation). Once you have something like
that, it should be easy to extend it with e.g. external directories
and externally stored edits to “files”.
Date: Sun, 21 Oct 2012 18:03:59 -0400
From: “Ryan C. Gordon”
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID: <5084714F.3010902 at icculus.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 10/21/2012 02:13 PM, Andreas Schiffler wrote:
In my view the focus should be on “language” (ISO 639
http://en.wikipedia.org/wiki/ISO_639 is a standardized nomenclature
used to classify all known languages) rather than locale.
So the API would return “en” for any device that is set to operate
primarily in “English” and drop the US/GB/etc cruft.
It’s not cruft; there are small but important differences between US and
UK English, and trust me, yanks notice when “color” is spelled with a
’u’. When you get into things like Chinese, these differences can be
even more significant.
Here’s another point: US dollars vs. British (or English?) pounds.
Granted, a lot of games do what is called a “FIGS” translation (French,
Italian, German, Spanish), and if you happen to be in Quebec or Paris or
Senegal, French is probably “good enough” … it depends on the game,
really. These games can just take the first two characters (or the
language section, if we split it up into two strings), ignoring the
country code. It’s easy to supply the extra data, and easy to ignore it
if you don’t care, so it’s not worth stripping it out.
Also, you could do an initial release with just the 'generic’
translations, and later do customized translations according to
demand.
Date: Sun, 21 Oct 2012 18:11:37 -0400
From: drawoc
To: SDL Development List
Subject: Re: [SDL] Proposal: SDL_PreferredLocales()
Message-ID:
<CAAgWFh3n7adkuJnw+Pk2D=ab-o5b-e1auyYE_Qv9kQU7jBVEyQ at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
The way we do this on Windows in the GIMP is using
GetUserDefaultUILanguage, and then using a lookup table to convert
that to a locale string.
We then have our own UI to override that locale if the user chooses,
because it’s all such a mess on windows.
Though personally, I’d say the override is a good design even if the
OS does things right.