NLS(7)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’– 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 information
  • LC_CTYPE β€” character classification, case conversion, and other character attributes
  • LC_MESSAGES β€” the format for affirmative and negative responses
  • LC_MONETARY β€” rules and symbols for formatting monetary numeric information
  • LC_NUMERIC β€” rules and symbols for formatting nonmonetary numeric information
  • LC_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:

  1. If the LC_ALL environment variable is set, all six categories use the locale it specifies.
  2. If the LC_ALL environment variable is not set, each individual category uses the locale specified by its corresponding environment variable.
  3. If the LC_ALL environment variable is not set, and a value for a particular LC_* environment variable is not set, the value of the LANG environment variable specifies the default locale for all categories.
πŸ’‘ and here's the tip, bestie: only the LANG environment variable should be set in /etc/profile, since it makes it most easy for the user to override the system default using the individual LC_* variables. that's the whole point. don't overthink it. 🫢
  • If LC_ALL is not set, a value for a particular LC_* environment variable is not set, and the value of the LANG environment variable is not set, the locale for that specific category defaults to the C locale. The C or POSIX locale 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 specifies 128 Roman characters and control codes, encoded in a 7-bit character encoding scheme. tiny but mighty ✨
  • ISO 8859 family β€” Industry-standard character sets specified by the ISO/IEC 8859 standard. The standard is divided into 15 numbered parts, with each part specifying broad script similarities. Examples include Western European, Central European, Arabic, Cyrillic, Hebrew, Greek, and Turkish. The character sets use an 8-bit character encoding scheme which is compatible with the ASCII character 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 with ISO 8859-1 (Western European) and ASCII. Many character encoding schemes are available for Unicode, including UTF-8, UTF-16 and UTF-32. These encoding schemes are multi-byte encodings. The UTF-8 encoding scheme uses 8-bit, variable-width encodings which is compatible with ASCII. The UTF-16 encoding scheme uses 16-bit, variable-width encodings. The UTF-32 encoding scheme uses 32-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:


🌈 SEE ALSO 🌈

The supporting cast, please stan:

πŸ’€ 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