Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 75 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




       #include <locale.h>


       A  locale  is a set of language and cultural rules.  These
       cover aspects such as  language  for  messages,  different
       character  sets,  lexigraphic conventions, etc.  A program
       needs to be able to determine its locale and  act  accord­
       ingly to be portable to different cultures.

       The  header  <locale.h> declares data types, functions and
       macros which are useful in this task.

       The functions it declares are setlocale() to set the  cur­
       rent  locale,  and  localeconv()  to get information about
       number formatting.

       There are different categories  for  local  information  a
       program  might  need;  they are declared as macros.  Using
       them as the first argument to the setlocale() function, it
       is possible to set one of these to the desired locale:

              This  is  used to change the behaviour of the func­
              tions strcoll() and strxfrm(), which  are  used  to
              compare  strings  in the local alphabet.  For exam­
              ple, the German sharp s is sorted as "ss".

              This changes the behaviour of  the  character  han­
              dling  and  classification functions, such as isup­
              per() and toupper(), and the  multi-byte  character
              functions such as mblen() or wctomb().

              changes  the  information  returned by localeconv()
              which  describes  the  way  numbers   are   usually
              printed,  with details such as decimal point versus
              decimal comma.  This information is internally used
              by the function strfmon().

              changes  the language messages are displayed in and
              how an affirmative or negative answer  looks  like.
              The  GNU  C-library  contains  the gettext(), nget­
              text(), and rpmatch() functions to ease the use  of
              these information.  The GNU gettext family of func­
              tions also obey the environment variable  LANGUAGE.

              changes  the  information  used by the printf() and
              scanf() family of functions, when they are  advised

       1.     If there is a non-null environment variable LC_ALL,
              the value of LC_ALL is used.

       2.     If an environment variable with the  same  name  as
              one of the categories above exists and is non-null,
              its value is used for that category.

       3.     If there is a non-null environment  variable  LANG,
              the value of LANG is used.

       Values about local numeric formatting is made available in
       a struct lconv  returned  by  the  localeconv()  function,
       which has the following declaration:
       struct lconv
         /* Numeric (non-monetary) information.  */

         char *decimal_point;        /* Decimal point character.  */
         char *thousands_sep;        /* Thousands separator.  */
         /* Each element is the number of digits in each group;
            elements with higher indices are farther left.
            An element with value CHAR_MAX means that no further grouping is done.
            An element with value 0 means that the previous element is used
            for all groups farther left.  */
         char *grouping;

         /* Monetary information.  */

         /* First three chars are a currency symbol from ISO 4217.
            Fourth char is the separator.  Fifth char is ' '.  */
         char *int_curr_symbol;
         char *currency_symbol; /* Local currency symbol.  */
         char *mon_decimal_point;    /* Decimal point character.  */
         char *mon_thousands_sep;    /* Thousands separator.  */
         char *mon_grouping;         /* Like `grouping' element (above).  */
         char *positive_sign;        /* Sign for positive values.  */
         char *negative_sign;        /* Sign for negative values.  */
         char int_frac_digits;       /* Int'l fractional digits.  */
         char frac_digits;      /* Local fractional digits.  */
         /* 1 if currency_symbol precedes a positive value, 0 if succeeds.  */
         char p_cs_precedes;
         /* 1 if a space separates currency_symbol from a positive value.  */
         char p_sep_by_space;
         /* 1 if currency_symbol precedes a negative value, 0 if succeeds.  */
         char n_cs_precedes;
         /* 1 if a space separates currency_symbol from a negative value.  */
         char n_sep_by_space;
         /* Positive and negative sign positions:
            0 Parentheses surround the quantity and currency_symbol.
            1 The sign string precedes the quantity and currency_symbol.
            2 The sign string succeeds the quantity and currency_symbol.

Linux                       1993-04-24                  LOCALE(7)
Help us cut cost by not downloading the whole site!
Use of automated download sofware ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and therefore is expressedly prohibited. For more details on this, take a look here



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
The Linux Tutorial can use your help.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.04 Seconds