mate-desktop 1.29.2
Library with common API for various MATE modules
Loading...
Searching...
No Matches
mate-languages.c File Reference
View source
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <locale.h>
#include <langinfo.h>
#include <sys/stat.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include "mate-languages.h"
Include dependency graph for mate-languages.c:

Data Structures

struct  _MateLocale
 

Macros

#define MATE_DESKTOP_USE_UNSTABLE_API
 
#define __LC_LAST   13
 
#define ISO_CODES_DATADIR   ISO_CODES_PREFIX "/share/xml/iso-codes"
 
#define ISO_CODES_LOCALESDIR   ISO_CODES_PREFIX "/share/locale"
 

Typedefs

typedef struct _MateLocale MateLocale
 

Functions

static char * construct_language_name (const char *language, const char *territory, const char *codeset, const char *modifier)
 
static void mate_locale_free (MateLocale *locale)
 
static char * normalize_codeset (const char *codeset)
 
gboolean mate_parse_locale (const char *locale, char **language_codep, char **country_codep, char **codesetp, char **modifierp)
 mate_parse_locale: @locale: a locale string @language_codep: (out) (allow-none) (transfer full): location to store the language code, or NULL @country_codep: (out) (allow-none) (transfer full): location to store the country code, or NULL @codesetp: (out) (allow-none) (transfer full): location to store the codeset, or NULL @modifierp: (out) (allow-none) (transfer full): location to store the modifier, or NULL
 
.

mate_normalize_locale: @locale: a locale string

Gets the normalized locale string in the form [language[_country][.codeset][@modifier]] for

Return value: (transfer full): normalized locale string. Caller takes ownership.

Since: 1.22

static gboolean language_name_is_valid (const char *language_name)
 
char * mate_normalize_locale (const char *locale)
 
static void language_name_get_codeset_details (const char *language_name, char **pcodeset, gboolean *is_utf8)
 
static gboolean locale_dir_has_mo_files (const gchar *path)
 

Variables

static GHashTable * mate_languages_map
 
static GHashTable * mate_territories_map
 
static GHashTable * mate_available_locales_map
 
static GHashTable * mate_language_count_map
 
static GHashTable * mate_territory_count_map
 

Macro Definition Documentation

◆ __LC_LAST

#define __LC_LAST   13

◆ ISO_CODES_DATADIR

#define ISO_CODES_DATADIR   ISO_CODES_PREFIX "/share/xml/iso-codes"

◆ ISO_CODES_LOCALESDIR

#define ISO_CODES_LOCALESDIR   ISO_CODES_PREFIX "/share/locale"

◆ MATE_DESKTOP_USE_UNSTABLE_API

#define MATE_DESKTOP_USE_UNSTABLE_API

Typedef Documentation

◆ MateLocale

typedef struct _MateLocale MateLocale

Function Documentation

◆ construct_language_name()

static char * construct_language_name ( const char *  language,
const char *  territory,
const char *  codeset,
const char *  modifier 
)
static

◆ language_name_get_codeset_details()

static void language_name_get_codeset_details ( const char *  language_name,
char **  pcodeset,
gboolean *  is_utf8 
)
static

References normalize_codeset().

Here is the call graph for this function:

◆ language_name_is_valid()

static gboolean language_name_is_valid ( const char *  language_name)
static

Referenced by mate_parse_locale().

◆ locale_dir_has_mo_files()

static gboolean locale_dir_has_mo_files ( const gchar *  path)
static

◆ mate_locale_free()

◆ mate_normalize_locale()

char * mate_normalize_locale ( const char *  locale)

References construct_language_name(), and mate_parse_locale().

Referenced by test_one_locale().

Here is the call graph for this function:

◆ mate_parse_locale()

gboolean mate_parse_locale ( const char *  locale,
char **  language_codep,
char **  country_codep,
char **  codesetp,
char **  modifierp 
)

mate_parse_locale: @locale: a locale string @language_codep: (out) (allow-none) (transfer full): location to store the language code, or NULL @country_codep: (out) (allow-none) (transfer full): location to store the country code, or NULL @codesetp: (out) (allow-none) (transfer full): location to store the codeset, or NULL @modifierp: (out) (allow-none) (transfer full): location to store the modifier, or NULL

Extracts the various components of a locale string of the form [language[_country][.codeset][@modifier]]. See http://en.wikipedia.org/wiki/Locale.

Return value: TRUE if parsing was successful.

Since: 1.22

References construct_language_name(), language_name_is_valid(), and normalize_codeset().

Referenced by mate_normalize_locale(), and test_one_locale().

Here is the call graph for this function:

◆ normalize_codeset()

static char * normalize_codeset ( const char *  codeset)
static

Variable Documentation

◆ mate_available_locales_map

GHashTable* mate_available_locales_map
static

◆ mate_language_count_map

GHashTable* mate_language_count_map
static

◆ mate_languages_map

GHashTable* mate_languages_map
static

◆ mate_territories_map

GHashTable* mate_territories_map
static

◆ mate_territory_count_map

GHashTable* mate_territory_count_map
static