mirror of
https://git.zap.org.au/git/trader.git
synced 2024-12-04 14:46:45 -05:00
Allow TEXTDOMAINDIR to specify the message catalog path
This commit is contained in:
parent
535f4cf965
commit
2cc2dfffd5
4
NEWS
4
NEWS
@ -25,6 +25,10 @@ __ https://www.zap.org.au/
|
|||||||
Version 7.16 (not yet released)
|
Version 7.16 (not yet released)
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
Added code to allow the ``TEXTDOMAINDIR`` environment variable to specify
|
||||||
|
where compiled translations are located. Updated the documentation to
|
||||||
|
mention this new feature.
|
||||||
|
|
||||||
Added an application metadata file that conforms to the AppStream 0.12
|
Added an application metadata file that conforms to the AppStream 0.12
|
||||||
specification. Updated all translations to suit, using parts of existing
|
specification. Updated all translations to suit, using parts of existing
|
||||||
strings.
|
strings.
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
.if \n[.g] .mso www.tmac
|
.if \n[.g] .mso www.tmac
|
||||||
.\"
|
.\"
|
||||||
.\" *********************************************************************
|
.\" *********************************************************************
|
||||||
.TH TRADER 6 "12th January, 2021" "Unix-like systems"
|
.TH TRADER 6 "14th January, 2021" "Unix-like systems"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
trader \- a game of interstellar trading
|
trader \- a game of interstellar trading
|
||||||
.\" *********************************************************************
|
.\" *********************************************************************
|
||||||
@ -183,6 +183,12 @@ using \fBLC_NUMERIC\fP and monetary quantities will use
|
|||||||
or
|
or
|
||||||
.BR setlocale (3)
|
.BR setlocale (3)
|
||||||
manual pages for more details on locale settings.
|
manual pages for more details on locale settings.
|
||||||
|
.TP
|
||||||
|
.B TEXTDOMAINDIR
|
||||||
|
If set, Star Traders will use this path as the base with which to locate
|
||||||
|
its message catalogs instead of the compiled-in path; the relevant
|
||||||
|
\fItrader.mo\fP files should be located in language-code subdirectories
|
||||||
|
(such as \fIen_AU\fP), in \fILC_MESSAGES\fP sub-subdirectories.
|
||||||
.\" *********************************************************************
|
.\" *********************************************************************
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.TP
|
.TP
|
||||||
|
@ -586,6 +586,9 @@ extern int randi (int limit)
|
|||||||
|
|
||||||
extern void init_locale (void)
|
extern void init_locale (void)
|
||||||
{
|
{
|
||||||
|
const char *podir = getenv("TEXTDOMAINDIR");
|
||||||
|
|
||||||
|
|
||||||
// Initialise the current locale
|
// Initialise the current locale
|
||||||
if (setlocale(LC_ALL, "") == NULL) {
|
if (setlocale(LC_ALL, "") == NULL) {
|
||||||
err_exit("could not set locale "
|
err_exit("could not set locale "
|
||||||
@ -593,7 +596,9 @@ extern void init_locale (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use correct message catalogs for the locale
|
// Use correct message catalogs for the locale
|
||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(
|
||||||
|
PACKAGE,
|
||||||
|
(podir != NULL && *podir != '\0') ? podir : LOCALEDIR);
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,10 +235,11 @@ extern int randi (int limit);
|
|||||||
Returns: (nothing)
|
Returns: (nothing)
|
||||||
|
|
||||||
This function initialises the locale and message catalog used by this
|
This function initialises the locale and message catalog used by this
|
||||||
program. The message catalog must reside in the location specified
|
program. If the TEXTDOMAINDIR environment variable is set, the message
|
||||||
during "./configure" via the "--localedir" option; this location is
|
catalog must reside in that location, otherwise it must be in the
|
||||||
passed to this source code file as PREFIXDIR. This function must be
|
location specified during "./configure" via the "--localedir" option.
|
||||||
called before using any locale or Gettext functions.
|
This function must be called before using any locale or Gettext
|
||||||
|
functions.
|
||||||
*/
|
*/
|
||||||
extern void init_locale (void);
|
extern void init_locale (void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user