Locale-support

Supports setting and getting of process locale (C runtime libraries).

Use it to adapt to different character encodings / environments setings.

Summary
Locale-supportSupports setting and getting of process locale (C runtime libraries).
CopyrightThis program is free software.
Files
C-kern/api/platform/locale.hHeader file of Locale-support.
C-kern/platform/Linux/locale.cLinux specific implementation file Locale-support Linux.
Functions
initonce
initonce_localeCalled from maincontext_t.init_maincontext.
freeonce_localeCalled from maincontext_t.free_maincontext.
query
charencoding_localeReturns the name of the character encoding of the current selected locale.
current_localeReturns the name of the current active locale.
currentmsg_localeReturns the name of the current active locale for system messages.
set
setdefault_localeSets the default locale defined by the program environment.
reset_localeSets the locale of all subsystems to default.
resetmsg_localeSets the locale of system messages subsystem to default.
test
unittest_platform_localeTests all locale functions.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/platform/locale.h

Header file of Locale-support.

C-kern/platform/Linux/locale.c

Linux specific implementation file Locale-support Linux.

Functions

Summary
initonce
initonce_localeCalled from maincontext_t.init_maincontext.
freeonce_localeCalled from maincontext_t.free_maincontext.
query
charencoding_localeReturns the name of the character encoding of the current selected locale.
current_localeReturns the name of the current active locale.
currentmsg_localeReturns the name of the current active locale for system messages.
set
setdefault_localeSets the default locale defined by the program environment.
reset_localeSets the locale of all subsystems to default.
resetmsg_localeSets the locale of system messages subsystem to default.
test
unittest_platform_localeTests all locale functions.

initonce

initonce_locale

int initonce_locale(void)

Called from maincontext_t.init_maincontext.

freeonce_locale

int freeonce_locale(void)

Called from maincontext_t.free_maincontext.

query

charencoding_locale

const char * charencoding_locale(void)

Returns the name of the character encoding of the current selected locale.  For example “UTF-8” for utf-8 multibyte character encoding.

current_locale

const char * current_locale(void)

Returns the name of the current active locale.  “C” is returned for the locale which is set by reset_locale “de_DE@utf8” is returned if the user runs a german locale with utf8 text encoding and after setdefault_locale has been called.

currentmsg_locale

const char * currentmsg_locale(void)

Returns the name of the current active locale for system messages.

set

setdefault_locale

int setdefault_locale(void)

Sets the default locale defined by the program environment.  This sets the program locale normally to the default locale the user has set for itself.

reset_locale

int reset_locale(void)

Sets the locale of all subsystems to default.  The default is the “C” locale (English) a C program uses after it has been started.

resetmsg_locale

int resetmsg_locale(void)

Sets the locale of system messages subsystem to default.  The default is the “C” locale (English) a C program uses after it has been started.

test

unittest_platform_locale

int unittest_platform_locale(void)

Tests all locale functions.

Supports setting and getting of process locale (C runtime libraries).
Implements Locale-support.
int initonce_locale(void)
Called from maincontext_t.init_maincontext.
int init_maincontext(const maincontext_e context_type,
int argc,
const char **argv)
Initializes global program context.
int freeonce_locale(void)
Called from maincontext_t.free_maincontext.
int free_maincontext(void)
Frees global context.
const char * charencoding_locale(void)
Returns the name of the character encoding of the current selected locale.
const char * current_locale(void)
Returns the name of the current active locale.
const char * currentmsg_locale(void)
Returns the name of the current active locale for system messages.
int setdefault_locale(void)
Sets the default locale defined by the program environment.
int reset_locale(void)
Sets the locale of all subsystems to default.
int resetmsg_locale(void)
Sets the locale of system messages subsystem to default.
int unittest_platform_locale(void)
Tests all locale functions.
Close