Welcome to the Tiny Core Linux Wiki at tinycorelinux.net!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dcore:locale_in_ub-dcore [2016/05/18 02:26]
nitram [Package Selection Comment]
dcore:locale_in_ub-dcore [2017/11/18 13:14] (current)
sm8ps [Preparation] LANGUAGE +export
Line 3: Line 3:
 In Ubuntu, locales are created based on language packs. Proper locale files are generated by ''locale-gen''. Since these files are large, making them persistent is best done by creating a locale extension. In Ubuntu, locales are created based on language packs. Proper locale files are generated by ''locale-gen''. Since these files are large, making them persistent is best done by creating a locale extension.
  
-=====Preparation=====+These instructions have been tested on ... 
 +  * dCore-trusty --- //[[sm8ps-tcl1@yahoo.com|sm8ps]] 2015// 
 +  * dCore-xenial --- //[[sm8ps-tcl1@yahoo.com|sm8ps]] 2017/09/23 08:49//
  
-Import and load the //locales// package, review '/usr/share/i18n/SUPPORTED' for a list of available locales to determine the desired locale code.+=====Preparation=====
  
-Comment out the line in '~/.profilethat hard codes the LANG to "en_US.UTF-8" and have it set through the boot code //lang// (eg. ''lang=de_CH.UTF-8'' for Swiss German locale).+Import and load the //locales// packageReview '/usr/share/i18n/SUPPORTED' for a list of locales to determine the desired locale code, ignoring the second string.
  
 +Either use the //lang// boot code for the desired locale (eg. ''lang=de_CH.UTF-8'' for Swiss German) and comment out the line in '~/.profile' that hard codes LANG to "en_US.UTF-8" ...
 <code> <code>
-~/.profile: 
 #LANG=en_US.UTF-8 #LANG=en_US.UTF-8
 </code> </code>
 +or change that line to the desired locale directly.
 +
 For a first test ''locale'' will complain that it cannot set some LC_ variables but will then list where all but LANGUAGE and LC_ALL are set to the chosen locale code. For a first test ''locale'' will complain that it cannot set some LC_ variables but will then list where all but LANGUAGE and LC_ALL are set to the chosen locale code.
  
 === Fallback Locales === === Fallback Locales ===
-International users may want US English as a fallback to be stored in LANGUAGE (source: [[https://wiki.archlinux.org/index.php/Locale#LANGUAGE:_fallback_locales|Archlinux-wiki]]). If soadd the following to '~/.profile':+International users may want US English as a fallback to be stored in LANGUAGE (source: [[https://wiki.archlinux.org/index.php/Locale#LANGUAGE:_fallback_locales|Archlinux-wiki]]). 
 + 
 +If so add the following to '~/.profile':
 <code> <code>
 ~/.profile: ~/.profile:
-LANGUAGE=$LANG:en_US.UTF-8:en+export LANGUAGE=$LANG:en_US:en
 </code> </code>
  
 =====Generating Locale Files===== =====Generating Locale Files=====
  
-Create a temporary working directory (eg. ~/temp/). Create a list of packages in './mylocale.lst' with all desired language choices, this example uses English and German:+Create a temporary working directory (eg. ~/temp/).
  
 +Create a package list there (eg. ./mylocale.lst) with all desired language choices (eg. English and German):
 <code> <code>
 ./mylocale.lst: ./mylocale.lst:
Line 35: Line 42:
 </code> </code>
  
-Import the package list using ''sce-import -n -l ./mylocale.lst'' and load them. +Import the package list using ''sce-import -n -l ./mylocale.lst'' and load the extensionBe aware that this may take quite a while.
- +
-Run ''sudo locale-gen --archive'' (double dash before 'archive') to produce '/usr/lib/locale/locale-archive' containing all locales specified in the language packs. +
- +
-====Testing==== +
- +
-''locale'' will show the same list as before without errors. Furthermore ''date +%A'' will print the week-day in the local language.+
  
 +Run ''sudo locale-gen ''''-''''-''''archive'' to produce '/usr/lib/locale/locale-archive' containing all locales specified in the language packs. Again, this will take a while.
  
 ===Package Selection=== ===Package Selection===
  
 The language packs depend on the //locale// package, which provides the command ''locale-gen''. This is a Bash script which uses the core-utilities plus 'localedef' which is not included in //locale// but rather in //libc-bin//. The language packs depend on the //locale// package, which provides the command ''locale-gen''. This is a Bash script which uses the core-utilities plus 'localedef' which is not included in //locale// but rather in //libc-bin//.
 +
 +===Testing===
 +
 +''locale'' will show the same list as before without errors. Furthermore ''date +%A'' will print the week-day in the local language.
  
 =====Create a Locales Extension===== =====Create a Locales Extension=====
Line 60: Line 66:
 sudo mv /usr/lib/locale/locale-archive ./mylocale/usr/lib/locale/ sudo mv /usr/lib/locale/locale-archive ./mylocale/usr/lib/locale/
 </code> </code>
-The directory is packed into a SquashFS-file, that is an extension. That extension is then put in the right place.+The directory is packed into a SquashFS-file, an extension that is. That extension is then put in the right place.
  
 <code Bash> <code Bash>
Line 74: Line 80:
  
 Optionally, the extension is included into 'sceboot.lst' so as to have it automatically loaded at boot. Optionally, the extension is included into 'sceboot.lst' so as to have it automatically loaded at boot.
-====Testing====+===Testing===
  
-After a re-boot, ''locale'' should list all LC-variables set to the chosen locale-code.+After rebooting ''locale'' should list all LC-variables set to the chosen locale code.
  
-==== Cleanup ==== +=== Cleanup === 
-The extensions //locales// as well //mylocale.lst// can be removed together with the temporary directory.+The extensions //locales// and //mylocale.lst// (but not //mylocale//!) can be removed together with the temporary directory.
  
 **[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore Wiki Welcome page]]** **[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore Wiki Welcome page]]**
Print/export