[gnuwin32 - Help] RE: bindtextdomain() and LOCALEDIR in Win32

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.windows.gnu.user
Message-ID <[email protected]>
Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=4908090
By: keithmarshall

I've adopted a variation of Tor's technique, for associating POSIX message
catalogues, (gencat --> catopen/catgets), with applications in the MinGW world.
However, since message catalogues are generally specific to a particular application,
I use the path to the *executable*, rather than the path to any DLL, as the
point of reference.

The logic I've adopted is (roughly) as follows:--

1) Identify the executable path name, using the global _pgmptr variable.
2) Strip off the final file name component from resultant path name.
3) If the new final directory name component is either `bin' or `sbin' (ignoring
case), then also strip that off.
4) Append `/share/locale' to the remaining path name.
5) Select message catalogues identified as `%L/%N' [*], within this directory
tree.

In any case, this logic is encapsulated within my port of `catopen()' itself,
so client applications need only to arrange to install their message catalogues
within a `./share/locale' subdirectory of their own installation tree, to ensure
that they will be found at run time.

I have a great deal of respect for Tor's insight, (he also contributes to discussions
on MinGW mailing lists), and I note his comments about the use of
GetModuleFileNameW(), to correctly handle Unicode path names.  It may well be
that my use of _pgmptr in (1) isn't sufficient.  I'd certainly welcome feed
back, and more so patches, should this be the case; the MinGW implementation
of catgets can be found in the MinGW Project CVS, on SourceForge:
http://mingw.cvs.sourceforge.net/mingw/catgets/

Regards,
Keith.

* Per POSIX specification, my port of catopen() uses the LC_MESSAGES or LANG
environment variables to resolve the %L component of the effective NLSPATH.
Since Win32 users will not typically have either of these set, I use the function
call `win32_iso639_default( "LANG" )', (an implementation may be found
at http://mingw.cvs.sourceforge.net/mingw/man/src/win32/winlang.c?revision=1.1&v
iew=markup), in each of my applications, conditional on _WIN32, (a #define in
compat.h effectively makes `win32_iso639_default( anything )' a no-op for other
platforms), *before* calling catopen().

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=74807

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.