[sword-devel] swlocale question
Jonathan Marsden
jmarsden at fastmail.fm
Fri Sep 4 14:59:07 MST 2009
Matthew Talbert wrote:
> That is, if we have 5 applications, and each has a 1-line way of doing
> this, then that's less code than trying to do this ourselves.
So... how does diatheke do it in one line? :)
>> (2) Rather than only looking at LANG, ...
> Currently, SWORD doesn't try to read any environment variables at all
> to determine locale.
Ah, then I misunderstood your earlier comment about "This is based off
the environment variable LANG". If SWORD just expects the application
to tell it what locale to use, then how the app determines the current
locale is not directly relevant to the SWORD library itself.
>> Lastly, while on this topic: Does SWORD respect the LOCPATH variable
>> when finding locale information? Should it?
> SWORD looks for locales in a couple of places, but primarily in
> $SWORD_PATH/locales.d. What does LOCPATH do and how do you think it
> should apply to this?
It points to a (POSIX) locale database, per the locale (1) man page. So
(for "normal" Unix/Linux apps) you can use it to point all the
locale-related functions to a different set of locale data. Useful for
testing, at least. In part, this question comes to my mind based on a
different recent thread about $SWORD_PATH doing more than just point to
the module data area... I started wondering why, and shouldn't the
locale location be logically distinct from the SWORD module data area,
etc. etc. So it doesn't apply directly to this code, but it could
perhaps apply to how SWORD and SWORD apps determines which set of
(SWORD) locale data to use, as well as which set of system locale data
to use.
But overall I think what SWORD calls a "locale" and what the Unix/POSIX
world calls a "locale" are not exactly the same thing anyway -- system
locales deal with display of financial and date/time info, for example,
but SWORD ones deal primarily (or even only?) with Bible book names and
abbreviations :)
I suspect I am still slightly confused on the relationship between the
two "locale"s. I think a wiki page about SWORD locales and how/whether
they relate to system locales would be a good thing to have, if someone
knows enough about both kinds of locales to write such a page. Any
volunteers? My best guess so far is that in theory we could have:
(1) A default system or OS locale
(2) A session or Desktop environment locale
(3) An application UI locale (could be switched on the fly by the user)
(4) Multiple simultaneous module locales, one per displayed module
How all that fits together, and how SWORD-using apps should fit it all
together, is potentially fairly complex and so IMO worth documenting.
For example, if a SWORD app has 4 modules open, each a bible in a
different language, which set or sets of book abbreviations should each
module window use (a) in its drop down lists and (b) in handling
user-entered verse references?
Jonathan
More information about the sword-devel
mailing list