NLS(7)
π NLS(7) β Native Language Support Overview π
okay so this is the NLS(7) page from the Miscellaneous Information Manual (section 7, bestie, we're in the miscellaneous section and it's lowkey iconic) and it's literally all about how your system speaks every language at once. buckle up π
β¨ NAME β¨
NLS β Native Language Support Overview. that's it, that's the name, but the vibe is "your computer is a polyglot and it ate". π
πΈ DESCRIPTION πΈ
so Native Language Support (NLS) gives you commands for a single worldwide operating system base. meaning: one OS, everywhere, no cap. an internationalized system has no built-in assumptions or dependencies on language-specific or cultural-specific conventions, like:
- Character classifications
- Character comparison rules
- Character collation order
- Numeric and monetary formatting
- Date and time formatting
- Message-text language
- Character sets
all the info about cultural conventions and language gets grabbed at program run time. no hardcoding, we don't do that here π¦
βInternationalizationβ (often abbreviated βi18nβ) β that's the operation where system software is developed to support multiple cultural-specific and language-specific conventions. it's a generalization process, where the system gets untied from only calling English strings or other English-specific conventions. untied!! free!! ποΈ
βLocalizationβ (often abbreviated βl10nβ) β that's the operations where the user environment gets customized to handle its input and output appropriately for specific language and cultural conventions. a specialization process, where generic methods already implemented in an internationalized system get used in specific ways.
and the formal description of cultural conventions for some country β plus all the associated translations targeted at the native language β is called the βlocaleβ. that's the word. remember it. it's the main character of this entire page π
NetBSD provides extensive support to programmers and system developers so internationalized software can actually be developed. NetBSD also supplies a large variety of locales for system localization. slay β¨
π¦ Localization of Information π¦
all locale information is accessible to programs at run time, so data gets processed and displayed correctly for specific cultural conventions and language. yes bestie, correctly.
a locale is divided into categories. a category is a group of language-specific and culture-specific conventions, as outlined in that list up above βοΈ
ISO C specifies the following six standard categories supported by NetBSD:
LC_COLLATEβ string-collation order informationLC_CTYPEβ character classification, case conversion, and other character attributesLC_MESSAGESβ the format for affirmative and negative responsesLC_MONETARYβ rules and symbols for formatting monetary numeric informationLC_NUMERICβ rules and symbols for formatting nonmonetary numeric informationLC_TIMEβ rules and symbols for formatting time and date information
six of them. all accounted for. no skipping π
localization of the system is achieved by setting the appropriate values in environment variables to identify which locale should be used. and the environment variables have the same names as their respective locale categories. cute, right?
additionally, the LANG, LC_ALL, and NLSPATH environment variables are used. the NLSPATH environment variable specifies a colon-separated list of directory names where the message catalog files of the NLS database are located. and the LC_ALL and LANG environment variables also determine the current locale. okay so they're all pulling weight πͺ
the values of these environment variables contain a string format as:
language[_territory][.codeset][@modifier]
valid values for the language field come from the ISO639 standard, which defines two-character codes for many languages. some common language codes are:
- ABKHAZIAN β
ABβ IBERO-CAUCASIAN - AFAN (OROMO) β
OMβ HAMITIC - AFAR β
AAβ HAMITIC - AFRIKAANS β
AFβ GERMANIC - ALBANIAN β
SQβ INDO-EUROPEAN (OTHER) - AMHARIC β
AMβ SEMITIC - ARABIC β
ARβ SEMITIC - ARMENIAN β
HYβ INDO-EUROPEAN (OTHER) - ASSAMESE β
ASβ INDIAN - AYMARA β
AYβ AMERINDIAN - AZERBAIJANI β
AZβ TURKIC/ALTAIC - BASHKIR β
BAβ TURKIC/ALTAIC - BASQUE β
EUβ BASQUE - BENGALI β
BNβ INDIAN - BHUTANI β
DZβ ASIAN - BIHARI β
BHβ INDIAN - BISLAMA β
BI - BRETON β
BRβ CELTIC - BULGARIAN β
BGβ SLAVIC - BURMESE β
MYβ ASIAN - BYELORUSSIAN β
BEβ SLAVIC - CAMBODIAN β
KMβ ASIAN - CATALAN β
CAβ ROMANCE - CHINESE β
ZHβ ASIAN - CORSICAN β
COβ ROMANCE - CROATIAN β
HRβ SLAVIC - CZECH β
CSβ SLAVIC - DANISH β
DAβ GERMANIC - DUTCH β
NLβ GERMANIC - ENGLISH β
ENβ GERMANIC - ESPERANTO β
EOβ INTERNATIONAL AUX. - ESTONIAN β
ETβ FINNO-UGRIC - FAROESE β
FOβ GERMANIC - FIJI β
FJβ OCEANIC/INDONESIAN - FINNISH β
FIβ FINNO-UGRIC - FRENCH β
FRβ ROMANCE - FRISIAN β
FYβ GERMANIC - GALICIAN β
GLβ ROMANCE - GEORGIAN β
KAβ IBERO-CAUCASIAN - GERMAN β
DEβ GERMANIC - GREEK β
ELβ LATIN/GREEK - GREENLANDIC β
KLβ ESKIMO - GUARANI β
GNβ AMERINDIAN - GUJARATI β
GUβ INDIAN - HAUSA β
HAβ NEGRO-AFRICAN - HEBREW β
HEβ SEMITIC - HINDI β
HIβ INDIAN - HUNGARIAN β
HUβ FINNO-UGRIC - ICELANDIC β
ISβ GERMANIC - INDONESIAN β
IDβ OCEANIC/INDONESIAN - INTERLINGUA β
IAβ INTERNATIONAL AUX. - INTERLINGUE β
IEβ INTERNATIONAL AUX. - INUKTITUT β
IU - INUPIAK β
IKβ ESKIMO - IRISH β
GAβ CELTIC - ITALIAN β
ITβ ROMANCE - JAPANESE β
JAβ ASIAN - JAVANESE β
JVβ OCEANIC/INDONESIAN - KANNADA β
KNβ DRAVIDIAN - KASHMIRI β
KSβ INDIAN - KAZAKH β
KKβ TURKIC/ALTAIC - KINYARWANDA β
RWβ NEGRO-AFRICAN - KIRGHIZ β
KYβ TURKIC/ALTAIC - KURUNDI β
RNβ NEGRO-AFRICAN - KOREAN β
KOβ ASIAN - KURDISH β
KUβ IRANIAN - LAOTHIAN β
LOβ ASIAN - LATIN β
LAβ LATIN/GREEK - LATVIAN β
LVβ BALTIC - LINGALA β
LNβ NEGRO-AFRICAN - LITHUANIAN β
LTβ BALTIC - MACEDONIAN β
MKβ SLAVIC - MALAGASY β
MGβ OCEANIC/INDONESIAN - MALAY β
MSβ OCEANIC/INDONESIAN - MALAYALAM β
MLβ DRAVIDIAN - MALTESE β
MTβ SEMITIC - MAORI β
MIβ OCEANIC/INDONESIAN - MARATHI β
MRβ INDIAN - MOLDAVIAN β
MOβ ROMANCE - MONGOLIAN β
MN - NAURU β
NA - NEPALI β
NEβ INDIAN - NORWEGIAN β
NOβ GERMANIC - OCCITAN β
OCβ ROMANCE - ORIYA β
ORβ INDIAN - PASHTO β
PSβ IRANIAN - PERSIAN (farsi) β
FAβ IRANIAN - POLISH β
PLβ SLAVIC - PORTUGUESE β
PTβ ROMANCE - PUNJABI β
PAβ INDIAN - QUECHUA β
QUβ AMERINDIAN - RHAETO-ROMANCE β
RMβ ROMANCE - ROMANIAN β
ROβ ROMANCE - RUSSIAN β
RUβ SLAVIC - SAMOAN β
SMβ OCEANIC/INDONESIAN - SANGHO β
SGβ NEGRO-AFRICAN - SANSKRIT β
SAβ INDIAN - SCOTS GAELIC β
GDβ CELTIC - SERBIAN β
SRβ SLAVIC - SERBO-CROATIAN β
SHβ SLAVIC - SESOTHO β
STβ NEGRO-AFRICAN - SETSWANA β
TNβ NEGRO-AFRICAN - SHONA β
SNβ NEGRO-AFRICAN - SINDHI β
SDβ INDIAN - SINGHALESE β
SIβ INDIAN - SISWATI β
SSβ NEGRO-AFRICAN - SLOVAK β
SKβ SLAVIC - SLOVENIAN β
SLβ SLAVIC - SOMALI β
SOβ HAMITIC - SPANISH β
ESβ ROMANCE - SUNDANESE β
SUβ OCEANIC/INDONESIAN - SWAHILI β
SWβ NEGRO-AFRICAN - SWEDISH β
SVβ GERMANIC - TAGALOG β
TLβ OCEANIC/INDONESIAN - TAJIK β
TGβ IRANIAN - TAMIL β
TAβ DRAVIDIAN - TATAR β
TTβ TURKIC/ALTAIC - TELUGU β
TEβ DRAVIDIAN - THAI β
THβ ASIAN - TIBETAN β
BOβ ASIAN - TIGRINYA β
TIβ SEMITIC - TONGA β
TOβ OCEANIC/INDONESIAN - TSONGA β
TSβ NEGRO-AFRICAN - TURKISH β
TRβ TURKIC/ALTAIC - TURKMEN β
TKβ TURKIC/ALTAIC - TWI β
TWβ NEGRO-AFRICAN - UIGUR β
UG - UKRAINIAN β
UKβ SLAVIC - URDU β
URβ INDIAN - UZBEK β
UZβ TURKIC/ALTAIC - VIETNAMESE β
VIβ ASIAN - VOLAPUK β
VOβ INTERNATIONAL AUX. - WELSH β
CYβ CELTIC - WOLOF β
WOβ NEGRO-AFRICAN - XHOSA β
XHβ NEGRO-AFRICAN - YIDDISH β
YIβ GERMANIC - YORUBA β
YOβ NEGRO-AFRICAN - ZHUANG β
ZA - ZULU β
ZUβ NEGRO-AFRICAN
look at all of them. gorgeous. π
for example, the locale for the Danish language spoken in Denmark using the ISO 8859-1 character set is da_DK.ISO8859-1. the da stands for the Danish language and the DK stands for Denmark. and the short form da_DK is sufficient to indicate this locale. short queen behavior β¨
π§ How the priority works π§
the environment variable settings are queried by their priority level in the following manner:
- If the
LC_ALLenvironment variable is set, all six categories use the locale it specifies. - If the
LC_ALLenvironment variable is not set, each individual category uses the locale specified by its corresponding environment variable. - If the
LC_ALLenvironment variable is not set, and a value for a particularLC_*environment variable is not set, the value of theLANGenvironment variable specifies the default locale for all categories.
π‘ and here's the tip, bestie: only theLANGenvironment variable should be set in/etc/profile, since it makes it most easy for the user to override the system default using the individualLC_*variables. that's the whole point. don't overthink it. π«Ά
- If
LC_ALLis not set, a value for a particularLC_*environment variable is not set, and the value of theLANGenvironment variable is not set, the locale for that specific category defaults to theClocale. TheCorPOSIXlocale assumes the ASCII character set and defines information for the six categories. fallback behavior, but make it iconic π
π CHARACTER SETS π
A character is literally any symbol used for the organization, control, or representation of data. A group of such symbols used to describe a particular language make up a character set. It is the encoding values in a character set that provide the interface between the system and its input and output devices.
The following character sets are supported in NetBSD:
ASCIIβ The American Standard Code for Information Exchange (ASCII) standard specifies128Roman characters and control codes, encoded in a7-bitcharacter encoding scheme. tiny but mighty β¨ISO 8859 familyβ Industry-standard character sets specified by theISO/IEC 8859standard. The standard is divided into15numbered parts, with each part specifying broad script similarities. Examples include Western European, Central European, Arabic, Cyrillic, Hebrew, Greek, and Turkish. The character sets use an8-bitcharacter encoding scheme which is compatible with theASCIIcharacter set. so many scripts, so little time π«ΆUnicodeβ The Unicode character set is the full set of known abstract characters of all real-world scripts. It can be used in environments where multiple scripts must be processed simultaneously. Unicode is compatible withISO 8859-1(Western European) andASCII. Many character encoding schemes are available for Unicode, includingUTF-8,UTF-16andUTF-32. These encoding schemes are multi-byte encodings. TheUTF-8encoding scheme uses8-bit, variable-width encodings which is compatible withASCII. TheUTF-16encoding scheme uses16-bit, variable-width encodings. TheUTF-32encoding scheme uses32-bit, fixed-width encodings. Unicode ate, no crumbs π
π¦ FONT SETS π¦
A font set contains the glyphs to be displayed on the screen for a corresponding character in a character set. A display must support a suitable font to display a character set. If suitable fonts are available to the X server, then X clients can include support for different character sets. xterm(1) includes support for Unicode with UTF-8 encoding. xfd(1) is useful for displaying all the characters in an X font.
The NetBSD wscons(4) console provides support for loading fonts using the wsfontload(8) utility. Currently, only fonts for the ISO8859-1 family of character sets are supported. font loading era β¨
πΈ INTERNATIONALIZATION FOR PROGRAMMERS πΈ
To facilitate translations of messages into various languages and to make the translated messages available to the program based on a user's locale, it is necessary to keep messages separate from the programs and provide them in the form of message catalogs that a program can access at run time.
Access to locale information is provided through the setlocale(3) and nl_langinfo(3) interfaces. See their respective man pages for further information. go read them, bestie, they're the lore π
Message source files containing application messages are created by the programmer and converted to message catalogs. These catalogs are used by the application to retrieve and display messages, as needed.
NetBSD supports two message catalog interfaces: the X/Open catgets(3) interface and the Uniforum gettext(3) interface. The catgets(3) interface has the advantage that it belongs to a standard which is well supported. Unfortunately the interface is complicated to use and maintenance of the catalogs is difficult. The implementation also doesn't support different character sets. The gettext(3) interface has not been standardized yet, however it is being supported by an increasing number of systems. It also provides many additional tools which make programming and catalog maintenance much easier. gettext is lowkey the glow-up here π
π§ SUPPORT FOR MULTI-BYTE ENCODINGS π§
Some character sets with multi-byte encodings may be difficult to decode, or may contain state (i.e., adjacent characters are dependent). ISO C specifies a set of functions using 'wide characters' which can handle multi-byte encodings properly. The behaviour of these functions is affected by the LC_CTYPE category of the current locale.
A wide character is specified in ISO C as being a fixed number of bits wide and is stateless. There are two types for wide characters: wchar_t and wint_t. wchar_t is a type which can contain one wide character and operates like 'char' type does for one character. wint_t can contain one wide character or WEOF (wide EOF). state? we don't know her π
There are functions that operate on wchar_t, and substitute for functions operating on 'char'. See wmemchr(3) and towlower(3) for details. There are some additional functions that operate on wchar_t. See wctype(3) and wctrans(3) for details.
Wide characters should be used for all I/O processing which may rely on locale-specific strings. The two primary issues requiring special use of wide characters are:
- All I/O is performed using multibyte characters. Input data is converted into wide characters immediately after reading and data for output is converted from wide characters to multi-byte encoding immediately before writing. Conversion is controlled by
mbstowcs(3),mbsrtowcs(3),wcstombs(3),wcsrtombs(3),mblen(3),mbrlen(3), andmbsinit(3). - Wide characters are used directly for I/O, using
getwchar(3),fgetwc(3),getwc(3),ungetwc(3),fgetws(3),putwchar(3),fputwc(3),putwc(3), andfputws(3). They are also used for formatted I/O functions for wide characters such asfwscanf(3),wscanf(3),swscanf(3),fwprintf(3),wprintf(3),swprintf(3),vfwprintf(3),vwprintf(3), andvswprintf(3), and wide character identifier of%lc,%C,%ls,%Sfor conventional formatted I/O functions. wide-char I/O supremacy fr fr π₯
π SEE ALSO π
The supporting cast, please stan:
gencat(1)xfd(1)xterm(1)catgets(3)gettext(3)nl_langinfo(3)setlocale(3)wsfontload(8)
π BUGS π
This man page is incomplete. that's the whole bug, bestie π no cap
Source/version: Debian. Date: February 21, 2007. Page: NLS(7). Mwah, love u! ππ
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2003 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms