Blame docs/reference/glib/html/glib-I18N.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>Internationalization: GLib Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GLib Reference Manual">
Packit ae235b
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
Packit ae235b
<link rel="prev" href="glib-Data-HMACs.html" title="Secure HMAC Digests">
Packit ae235b
<link rel="next" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Internationalization

Packit ae235b

Internationalization — gettext support macros

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
Q_()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
C_()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
N_()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
Packit ae235b
NC_()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_dgettext ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_dcgettext ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_dngettext ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_dpgettext ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_dpgettext2 ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_strip_context ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
const gchar * const *
Packit ae235b
Packit ae235b
Packit ae235b
g_get_language_names ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar **
Packit ae235b
Packit ae235b
Packit ae235b
g_get_locale_variants ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <glib.h>
Packit ae235b
#include <glib/gi18n.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

GLib doesn't force any particular localization method upon its users.

Packit ae235b
But since GLib itself is localized using the gettext() mechanism, it seems
Packit ae235b
natural to offer the de-facto standard gettext() support macros in an
Packit ae235b
easy-to-use form.

Packit ae235b

In order to use these macros in an application, you must include

Packit ae235b
&lt;glib/gi18n.h>. For use in a library, you must include
Packit ae235b
&lt;glib/gi18n-lib.h>
Packit ae235b
after defining the GETTEXT_PACKAGE macro suitably for your library:

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
        
#define GETTEXT_PACKAGE "gtk20"
Packit ae235b
#include <glib/gi18n-lib.h>
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
For an application, note that you also have to call bindtextdomain(),
Packit ae235b
bind_textdomain_codeset(), textdomain() and setlocale() early on in your
Packit ae235b
main() to make gettext() work. For example:

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
3
Packit ae235b
4
Packit ae235b
5
Packit ae235b
6
Packit ae235b
7
Packit ae235b
8
Packit ae235b
9
Packit ae235b
10
Packit ae235b
11
Packit ae235b
12
Packit ae235b
13
Packit ae235b
        
#include <glib/gi18n.h>
Packit ae235b
#include <locale.h>
Packit ae235b
Packit ae235b
int
Packit ae235b
main (int argc, char **argv)
Packit ae235b
{
Packit ae235b
  setlocale (LC_ALL, "");
Packit ae235b
  bindtextdomain (GETTEXT_PACKAGE, DATADIR "/locale");
Packit ae235b
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Packit ae235b
  textdomain (GETTEXT_PACKAGE);
Packit ae235b
Packit ae235b
  // Rest of your application.
Packit ae235b
}
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
where DATADIR is as typically provided by automake.

Packit ae235b

For a library, you only have to call bindtextdomain() and

Packit ae235b
bind_textdomain_codeset() in your initialization function. If your library
Packit ae235b
doesn't have an initialization function, you can call the functions before
Packit ae235b
the first translated message.

Packit ae235b

The

Packit ae235b
gettext manual
Packit ae235b
covers details of how to integrate gettext into a project’s build system and
Packit ae235b
workflow.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

Q_()

Packit ae235b
#define             Q_(String)
Packit ae235b

Like _(), but handles context in message ids. This has the advantage

Packit ae235b
that the string can be adorned with a prefix to guarantee uniqueness
Packit ae235b
and provide context to the translator.

Packit ae235b

One use case given in the gettext manual is GUI translation, where one

Packit ae235b
could e.g. disambiguate two "Open" menu entries as "File|Open" and
Packit ae235b
"Printer|Open". Another use case is the string "Russian" which may
Packit ae235b
have to be translated differently depending on whether it's the name
Packit ae235b
of a character set or a language. This could be solved by using
Packit ae235b
"charset|Russian" and "language|Russian".

Packit ae235b

See the C_() macro for a different way to mark up translatable strings

Packit ae235b
with context.

Packit ae235b

If you are using the Q_() macro, you need to make sure that you pass

Packit ae235b
--keyword=Q_ to xgettext when extracting messages.
Packit ae235b
If you are using GNU gettext >= 0.15, you can also use
Packit ae235b
--keyword=Q_:1g to let xgettext split the context
Packit ae235b
string off into a msgctxt line in the po file.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

String

Packit ae235b

the string to be translated, with a '|'-separated prefix

Packit ae235b
which must not be translated

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the translated message

Packit ae235b
Packit ae235b

Since: 2.4

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

C_()

Packit ae235b
#define             C_(Context,String)
Packit ae235b

Uses gettext to get the translation for String

Packit ae235b
. Context
Packit ae235b
 is
Packit ae235b
used as a context. This is mainly useful for short strings which
Packit ae235b
may need different translations, depending on the context in which
Packit ae235b
they are used.

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
        
label1 = C_("Navigation", "Back");
Packit ae235b
label2 = C_("Body part", "Back");
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b

If you are using the C_() macro, you need to make sure that you pass

Packit ae235b
--keyword=C_:1c,2 to xgettext when extracting messages.
Packit ae235b
Note that this only works with GNU gettext >= 0.15.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Context

Packit ae235b

a message context, must be a string literal

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

String

Packit ae235b

a message id, must be a string literal

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the translated message

Packit ae235b
Packit ae235b

Since: 2.16

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

N_()

Packit ae235b
#define             N_(String)
Packit ae235b

Only marks a string for translation. This is useful in situations

Packit ae235b
where the translated strings can't be directly used, e.g. in string
Packit ae235b
array initializers. To get the translated string, call gettext()
Packit ae235b
at runtime.

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
3
Packit ae235b
4
Packit ae235b
5
Packit ae235b
6
Packit ae235b
7
Packit ae235b
8
Packit ae235b
9
Packit ae235b
10
Packit ae235b
11
Packit ae235b
12
Packit ae235b
13
Packit ae235b
        
{
Packit ae235b
  static const char *messages[] = {
Packit ae235b
    N_("some very meaningful message"),
Packit ae235b
    N_("and another one")
Packit ae235b
  };
Packit ae235b
  const char *string;
Packit ae235b
  ...
Packit ae235b
  string
Packit ae235b
    = index > 1 ? _("a default message") : gettext (messages[index]);
Packit ae235b
Packit ae235b
  fputs (string);
Packit ae235b
  ...
Packit ae235b
}
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

String

Packit ae235b

the string to be translated

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.4

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

NC_()

Packit ae235b
#define             NC_(Context, String)
Packit ae235b

Only marks a string for translation, with context.

Packit ae235b
This is useful in situations where the translated strings can't
Packit ae235b
be directly used, e.g. in string array initializers. To get the
Packit ae235b
translated string, you should call g_dpgettext2() at runtime.

Packit ae235b
Packit ae235b
  
Packit ae235b
    
Packit ae235b
      
Packit ae235b
        
1
Packit ae235b
2
Packit ae235b
3
Packit ae235b
4
Packit ae235b
5
Packit ae235b
6
Packit ae235b
7
Packit ae235b
8
Packit ae235b
9
Packit ae235b
10
Packit ae235b
11
Packit ae235b
12
Packit ae235b
13
Packit ae235b
14
Packit ae235b
        
{
Packit ae235b
  static const char *messages[] = {
Packit ae235b
    NC_("some context", "some very meaningful message"),
Packit ae235b
    NC_("some context", "and another one")
Packit ae235b
  };
Packit ae235b
  const char *string;
Packit ae235b
  ...
Packit ae235b
  string
Packit ae235b
    = index > 1 ? g_dpgettext2 (NULL, "some context", "a default message")
Packit ae235b
                : g_dpgettext2 (NULL, "some context", messages[index]);
Packit ae235b
Packit ae235b
  fputs (string);
Packit ae235b
  ...
Packit ae235b
}
Packit ae235b
      
Packit ae235b
    
Packit ae235b
  
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b

If you are using the NC_() macro, you need to make sure that you pass

Packit ae235b
--keyword=NC_:1c,2 to xgettext when extracting messages.
Packit ae235b
Note that this only works with GNU gettext >= 0.15. Intltool has support
Packit ae235b
for the NC_() macro since version 0.40.1.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Context

Packit ae235b

a message context, must be a string literal

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

String

Packit ae235b

a message id, must be a string literal

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.18

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_dgettext ()

Packit ae235b
const gchar *
Packit ae235b
g_dgettext (const gchar *domain,
Packit ae235b
            const gchar *msgid);
Packit ae235b

This function is a wrapper of dgettext() which does not translate

Packit ae235b
the message if the default domain as set with textdomain() has no
Packit ae235b
translations for the current locale.

Packit ae235b

The advantage of using this function over dgettext() proper is that

Packit ae235b
libraries using this function (like GTK+) will not use translations
Packit ae235b
if the application using the library does not have translations for
Packit ae235b
the current locale.  This results in a consistent English-only
Packit ae235b
interface instead of one having partial translations.  For this
Packit ae235b
feature to work, the call to textdomain() and setlocale() should
Packit ae235b
precede any g_dgettext() invocations.  For GTK+, it means calling
Packit ae235b
textdomain() before gtk_init or its variants.

Packit ae235b

This function disables translations if and only if upon its first

Packit ae235b
call all the following conditions hold:

Packit ae235b
    Packit ae235b
  • domain

  • Packit ae235b
     is not NULL

    Packit ae235b
  • textdomain() has been called to set a default text domain

  • Packit ae235b
  • there is no translations available for the default text domain

  • Packit ae235b
    and the current locale

    Packit ae235b
  • current locale is not "C" or any English locales (those

  • Packit ae235b
    starting with "en_")

    Packit ae235b
    Packit ae235b

    Note that this behavior may not be desired for example if an application

    Packit ae235b
    has its untranslated messages in a language other than English. In those
    Packit ae235b
    cases the application should call textdomain() after initializing GTK+.

    Packit ae235b

    Applications should normally not use this function directly,

    Packit ae235b
    but use the _() macro for translations.

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    domain

    Packit ae235b

    the translation domain to use, or NULL to use

    Packit ae235b
    the domain set with textdomain(). 

    Packit ae235b
    [nullable]
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgid

    Packit ae235b

    message to translate

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    The translated string

    Packit ae235b
    Packit ae235b

    Since: 2.18

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_dcgettext ()

    Packit ae235b
    const gchar *
    Packit ae235b
    g_dcgettext (const gchar *domain,
    Packit ae235b
                 const gchar *msgid,
    Packit ae235b
                 gint category);
    Packit ae235b

    This is a variant of g_dgettext() that allows specifying a locale

    Packit ae235b
    category instead of always using LC_MESSAGES. See g_dgettext() for
    Packit ae235b
    more information about how this functions differs from calling
    Packit ae235b
    dcgettext() directly.

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    domain

    Packit ae235b

    the translation domain to use, or NULL to use

    Packit ae235b
    the domain set with textdomain(). 

    Packit ae235b
    [nullable]
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgid

    Packit ae235b

    message to translate

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    category

    Packit ae235b

    a locale category

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    the translated string for the given locale category

    Packit ae235b
    Packit ae235b

    Since: 2.26

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_dngettext ()

    Packit ae235b
    const gchar *
    Packit ae235b
    g_dngettext (const gchar *domain,
    Packit ae235b
                 const gchar *msgid,
    Packit ae235b
                 const gchar *msgid_plural,
    Packit ae235b
                 gulong n);
    Packit ae235b

    This function is a wrapper of dngettext() which does not translate

    Packit ae235b
    the message if the default domain as set with textdomain() has no
    Packit ae235b
    translations for the current locale.

    Packit ae235b

    See g_dgettext() for details of how this differs from dngettext()

    Packit ae235b
    proper.

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    domain

    Packit ae235b

    the translation domain to use, or NULL to use

    Packit ae235b
    the domain set with textdomain(). 

    Packit ae235b
    [nullable]
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgid

    Packit ae235b

    message to translate

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgid_plural

    Packit ae235b

    plural form of the message

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    n

    Packit ae235b

    the quantity for which translation is needed

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    The translated string

    Packit ae235b
    Packit ae235b

    Since: 2.18

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_dpgettext ()

    Packit ae235b
    const gchar *
    Packit ae235b
    g_dpgettext (const gchar *domain,
    Packit ae235b
                 const gchar *msgctxtid,
    Packit ae235b
                 gsize msgidoffset);
    Packit ae235b

    This function is a variant of g_dgettext() which supports

    Packit ae235b
    a disambiguating message context. GNU gettext uses the
    Packit ae235b
    '\004' character to separate the message context and
    Packit ae235b
    message id in msgctxtid
    Packit ae235b
    .
    Packit ae235b
    If 0 is passed as msgidoffset
    Packit ae235b
    , this function will fall back to
    Packit ae235b
    trying to use the deprecated convention of using "|" as a separation
    Packit ae235b
    character.

    Packit ae235b

    This uses g_dgettext() internally. See that functions for differences

    Packit ae235b
    with dgettext() proper.

    Packit ae235b

    Applications should normally not use this function directly,

    Packit ae235b
    but use the C_() macro for translations with context.

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    domain

    Packit ae235b

    the translation domain to use, or NULL to use

    Packit ae235b
    the domain set with textdomain(). 

    Packit ae235b
    [nullable]
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgctxtid

    Packit ae235b

    a combined message context and message id, separated

    Packit ae235b
    by a \004 character

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgidoffset

    Packit ae235b

    the offset of the message id in msgctxid

    Packit ae235b

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    The translated string

    Packit ae235b
    Packit ae235b

    Since: 2.16

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_dpgettext2 ()

    Packit ae235b
    const gchar *
    Packit ae235b
    g_dpgettext2 (const gchar *domain,
    Packit ae235b
                  const gchar *context,
    Packit ae235b
                  const gchar *msgid);
    Packit ae235b

    This function is a variant of g_dgettext() which supports

    Packit ae235b
    a disambiguating message context. GNU gettext uses the
    Packit ae235b
    '\004' character to separate the message context and
    Packit ae235b
    message id in msgctxtid
    Packit ae235b
    .

    Packit ae235b

    This uses g_dgettext() internally. See that functions for differences

    Packit ae235b
    with dgettext() proper.

    Packit ae235b

    This function differs from C_() in that it is not a macro and

    Packit ae235b
    thus you may use non-string-literals as context and msgid arguments.

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    domain

    Packit ae235b

    the translation domain to use, or NULL to use

    Packit ae235b
    the domain set with textdomain(). 

    Packit ae235b
    [nullable]
    Packit ae235b
    Packit ae235b
    Packit ae235b

    context

    Packit ae235b

    the message context

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgid

    Packit ae235b

    the message

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    The translated string

    Packit ae235b
    Packit ae235b

    Since: 2.18

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_strip_context ()

    Packit ae235b
    const gchar *
    Packit ae235b
    g_strip_context (const gchar *msgid,
    Packit ae235b
                     const gchar *msgval);
    Packit ae235b

    An auxiliary function for gettext() support (see Q_()).

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgid

    Packit ae235b

    a string

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b

    msgval

    Packit ae235b

    another string

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    msgval

    Packit ae235b
    , unless msgval
    Packit ae235b
    is identical to msgid
    Packit ae235b
    and contains a '|' character, in which case a pointer to
    Packit ae235b
    the substring of msgid after the first '|' character is returned.

    Packit ae235b
    Packit ae235b

    Since: 2.4

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_get_language_names ()

    Packit ae235b
    const gchar * const *
    Packit ae235b
    g_get_language_names (void);
    Packit ae235b

    Computes a list of applicable locale names, which can be used to

    Packit ae235b
    e.g. construct locale-dependent filenames or search paths. The returned
    Packit ae235b
    list is sorted from most desirable to least desirable and always contains
    Packit ae235b
    the default locale "C".

    Packit ae235b

    For example, if LANGUAGE=de:en_US, then the returned list is

    Packit ae235b
    "de", "en_US", "en", "C".

    Packit ae235b

    This function consults the environment variables LANGUAGE, LC_ALL,

    Packit ae235b
    LC_MESSAGES and LANG to find the list of locales specified by the
    Packit ae235b
    user.

    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    a NULL-terminated array of strings owned by GLib

    Packit ae235b
    that must not be modified or freed. 

    Packit ae235b

    [array zero-terminated=1][transfer none]

    Packit ae235b
    Packit ae235b

    Since: 2.6

    Packit ae235b
    Packit ae235b

    Packit ae235b
    Packit ae235b

    g_get_locale_variants ()

    Packit ae235b
    gchar **
    Packit ae235b
    g_get_locale_variants (const gchar *locale);
    Packit ae235b

    Returns a list of derived variants of locale

    Packit ae235b
    , which can be used to
    Packit ae235b
    e.g. construct locale-dependent filenames or search paths. The returned
    Packit ae235b
    list is sorted from most desirable to least desirable.
    Packit ae235b
    This function handles territory, charset and extra locale modifiers.

    Packit ae235b

    For example, if locale

    Packit ae235b
     is "fr_BE", then the returned list
    Packit ae235b
    is "fr_BE", "fr".

    Packit ae235b

    If you need the list of variants for the current locale,

    Packit ae235b
    use g_get_language_names().

    Packit ae235b
    Packit ae235b

    Parameters

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    locale

    Packit ae235b

    a locale identifier

    Packit ae235b
     
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Returns

    Packit ae235b

    a newly

    Packit ae235b
    allocated array of newly allocated strings with the locale variants. Free with
    Packit ae235b
    g_strfreev(). 

    Packit ae235b

    [transfer full][array zero-terminated=1][element-type utf8]

    Packit ae235b
    Packit ae235b

    Since: 2.28

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Types and Values

    Packit ae235b
    Packit ae235b
    Packit ae235b

    See Also

    Packit ae235b

    the gettext manual

    Packit ae235b
    Packit ae235b
    Packit ae235b
    Packit ae235b

    Generated by GTK-Doc V1.27
    Packit ae235b
    </body>
    Packit ae235b
    </html>