Difference between pages "Repository Configuration" and "Funtoo Linux Localization"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
(moving from old config)
 
 
Line 1: Line 1:
{{Warning|This article is a work-in-progress referring to a future Portage version. It does not apply to the current Funtoo Portage version. Please do not update your configuration yet.}}
== Set Default Language ==


Starting with Portage-2.3.8, a switch to a new repository configuration framework is complete and users may want to update their configuration files. This document aims to describe the goals for the new framework and how to use it.
On Funtoo, there are two configuration files responsible for your language settings: <code>/etc/locale.gen</code> and <code>/etc/env.d/00basic</code>. First file has only en_US.UTF-8 locale enabled. Last one is a default shipped file comes from stage3 and responsible for en_US.UTF-8 locale system-wide. Not recommended to edit.
The following steps will guide you through the process of setting up the default system language, using French Canadian as an example.
First you will need to edit <code>/etc/locale.gen</code>:
<console>
# ##i##nano -w /etc/locale.gen
</console>
Specify your preferred locale with the accompanying character format (you will mostly want UTF-8):
{{fancynote|It is recommended to keep the preconfigured en_US.UTF-8 locale as a fallback.}}
{{file|name=/etc/locale.gen|body=
en_US.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8
}}
To determine an appropriate locale for your system, you should take a look into <code>/usr/share/i18n/SUPPORTED</code> for the default list of supported combinations or check the <code>/usr/share/i18n/locales/</code> directory for a list of valid values.
{{fancywarning|You are strongly advised to use ''at least one'' UTF-8 locale since some applications may require it.}}
 
Now, those locales need to be generated:
<console>
# ##i##locale-gen
##g##*##!g## Generating 2 locales (this might take a while) with 1 jobs
*  (1/2) Generating en_US.UTF-8 ... [ ok ]
*  (2/2) Generating fr_CA.UTF-8 ... [ ok ]
##g##*##!g## Generation complete
</console>
 
Once done, you can apply your locale settings system-wide. First display all available options:
<console>
$ ##i##eselect locale list
##b####g##Available targets for the LANG variable:
  ##b##[1]##!b##  C
  ##b##[2]##!b##  POSIX
  ##b##[3]##!b##  fr_CA.utf8
  ##b##[4]##!b##  en_US.utf8 ##bl##*
  ##b##[ ]##!b##  (free form)
</console>
The blue star indicates the current default system locale. You can now change it according your wishes:
<console>
# ##i##eselect locale set 3
Setting LANG to fr_CA.utf8 ...
Run ". /etc/profile" to update the variable in your shell.
</console>
Alternatively, you can set the default locale manually. This file should be created first with your prefered editor:
{{file|name=/etc/env.d/02locale|body=LANG="fr_CA.utf8"}}
You can verify your actions using:
<console>
$ ##i##eselect locale show
##b####g##LANG variable in profile:
  ##b##fr_CA.utf8
</console>
 
For an immediate effect it is required to reload the environment:
<console>
# ##i##env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
</console>
Congratulations! You have successfully set up your default language on Funtoo.
 
== Portage Settings ==
 
Portage uses a special variable <code>LINGUAS</code> that defines what localizations/translations get installed by default. By default, <code>LINGUAS</code> in unset, which will result in ''all'' available localizations being installed by Portage.
 
It is possible to customize the setting of <code>LINGUAS</code> by setting it in <code>/etc/make.conf</code>:
 
<console>
# ##i##LINGUAS="en_US zh_CN"
</console>
 
The <code>LINGUAS</code> variable should use spaces between each localization name.
 
After setting the LINGUAS USE flag you may need to re-emerge some packages:


== Multiple repository layout ==
<console>
One of the most important changes is the switch from the old ''overlay'' layout to a new cleaner ''repository'' system. The new layout is more flexible and more predictable. For example, repositories can now use resources (eclasses, for example) provided by other repositories.
# emerge --ask --newuse --deep --with-bdeps=y @world
</console>


The old layout was based on the concept of one ''main tree'' and optionally a number of overlays. The main tree provided base system ebuilds, eclasses, profiles, while overlays mostly were able to provide their own ebuilds. The ebuild provided by overlays overrode the ebuilds in main tree to the extend of making it impossible to install the main tree version. Overlays could also provide eclasses for their own ebuilds and package.* entries that applied to all overlays and to the main tree. The Package Manager is responsible for updating the main tree, while overlays are managed externally.
== Read Your Language ==


The new layout is based on the concept of one or more configurable repositories. Each repository can either be stand-alone or depend upon other repositories. The distribution provides a repository called ''funtoo'' (a drop-in replacement for Gentoo's ''gentoo'' repository). Users can install more repositories at they will, the repositories providing their own ebuilds, eclasses and profiles as necessary and/or using them from other repositories. Users can explicitly choose the repository they want to install packages from. The Package Manager can update all repositories.
A newly installed Funtoo Linux does not able to read all the languages. You want to read the stuff, say, in Mozilla Firefox. You need to install fonts - A good sign that you have not installed the proper fonts is that the following characters appear as boxes with numbers inside: 日本語フォント


== Portage configuration ==
Check if you have your language installed (Chinese) by using the <tt>fc-list</tt> command from the <tt>media-libs/fontconfig</tt> ebuild:
=== New repository layout ===
The repository configuration should be stored in <code>/etc/portage/repos.conf</code>. It can be either a single file or a directory containing one or more ''.conf'' files.


The default configuration is installed as <code>/usr/share/portage/config/repos.conf</code>. This file is internal configuration file installed with portage ebuild and should '''not''' be modified. Instead, the configuration in <code>/etc/portage/repos.conf</code> can override the defaults specified there.
<console>
# ##i##fc-list :lang=zh
</console>


The configuration uses format similar to Windows .ini files. Each section heading (repository name in square brackets) signifies a single repository, followed by one or more key-value option pairs. For example, the following file copies default configuration for Funtoo repository:
If you are lucky, the right font will be installed, and your apps will also be able to use Chinese as the default language. But in case you not have the right font installed in this way, you need to install them manually.


{{file|name=/etc/portage/repos.conf/funtoo.conf|desc=Example configuration override for Funtoo repository to move it to non-standard location|body=
For Japanese:
[funtoo]
 
# moved to non-standard location!
<console>
location = /var/db/repos/funtoo
# ##i##emerge media-fonts/kochi-substitute
sync-type = git
</console>
sync-uri = git://github.com/funtoo/ports-2015.git
auto-sync = yes
}}


The most useful repository configuration options are listed below:
For Chinese:
;location: ''Obligatory.'' Specifies the directory where repository is/will be stored. If Portage knows how to sync the repository and the location does not exist, it will be created on next ''emerge --sync''. Otherwise, the directory must exist.
<console>
;priority: Specifies the priority used for ordering ebuilds from different repositories. If two repositories provide an ebuild with matching versions, the repository with higher priority will be used.
# ##i##emerge media-fonts/arphicfonts
;auto-sync: Specifies whether ''emerge --sync'' should update the repository. Defaults to ''yes'' if ''sync-type'' is specified, ''no'' otherwise.
</console>
;sync-depth: Specifies ''--depth'' for git clone. Used only on initial sync. Defaults to 1. Can be set to 0 to force full clone (not pass ''--depth'' at all).
;sync-type: Specifies syncing/update method. Can be one of: ''cvs'', ''git'', ''rsync'', ''svn''.
;sync-umask: Specifies the umask used when updating/syncing the repository.
;sync-uri: Specifies remote URI from which the repository will be cloned/synced. Can use any syntax valid for a particular syncing method.
;sync-user: Specifies the user[:group] used to update/sync the repository. If ''FEATURES=usersync'' is used, defaults to the credentials of directory owner.


Additionally a <code>[DEFAULT]</code> section may be specified. Options in this section are used as defaults for all repositories.
For Korean:


=== Migrating existing configurations ===
<console>
The new configuration format provides replacement for existing configuration done through <code>/etc/portage/make.conf</code> and environment variables. While the variables are still supported for backwards compatibility, users are recommended to move to the new configuration scheme.
# ##i##emerge media-fonts/baekmuk-fonts
</console>


The following replacements are provided for existing variables:
== Keymap ==
;PORTDIR: Used to specify main tree location. Replaced by ''location'' key in the section corresponding to the default repository (<code>[funtoo]</code> by default).
;PORTDIR_OVERLAY: Used to specify locations of overlays. Each of the paths needs to be replaced with a separate repository section, with the path placed in ''location'' key.
;SYNC: Used to specify URI for syncing the main repository, also implied a protocol for doing that. Replaced by the ''sync-uri'' and ''sync-type'' keys in the default repository section.
;SYNC_UMASK: Used to specify umask for syncing repositories. Replaced by ''sync-umask'' key in repository configuration. Can be specified in <code>[DEFAULT]</code> section to apply to all repositories.
;SYNC_USER: Used to specify user credentials for syncing repositories. Replaced by ''sync-user'' key in repository configuration. Can be specified in <code>[DEFAULT]</code> section to apply to all repositories.


{{file|name=/etc/portage/make.conf|desc=Example old make.conf file|body=
Funtoo Linux defaults to a US English keyboard. If you are using another type of keyboard, edit <tt>/etc/conf.d/keymaps</tt> and set keymap to your keyboard model. For example, cf for French Canadian keyboard, fr for French Azerty.
# user changed PORTDIR location
PORTDIR="/var/db/repos/funtoo"
PORTDIR_OVERLAY="/var/db/repos/foo /var/db/repos/bar"


SYNC="git://github.com/funtoo/ports-2015.git"
<console>
SYNC_USER="oleg"
# ##i##nano -w /etc/conf.d/keymaps
SYNC_UMASK="022"
</console>
}}


{{file|name=/etc/portage/repos.conf|desc=Replacement repos.conf file|body=
== Input Method ==
[DEFAULT]
sync-user = oleg
sync-umask = 022


[funtoo]
ibus is an Intelligent Input Bus for Linux.
location = /var/db/repos/funtoo
sync-type = git
sync-uri = git://github.com/funtoo/ports-2015.git


[foo]
<console>
location = /var/db/repos/foo
# ##i##emerge -av ibus
</console>


[bar]
You also need to install language table for ibus (Chinese)
location = /var/db/repos/bar
}}


The <code>repos.conf</code> configuration can be further extended with ''sync-type'' and ''sync-uri'' for overlays to get ''emerge --sync'' updating them automatically.
<console>
# ##i##emerge -av ibus-table-chinese
</console>


[[Category:Portage]]
[[Category:Install|Localization]]

Revision as of 17:48, February 14, 2015

Set Default Language

On Funtoo, there are two configuration files responsible for your language settings: /etc/locale.gen and /etc/env.d/00basic. First file has only en_US.UTF-8 locale enabled. Last one is a default shipped file comes from stage3 and responsible for en_US.UTF-8 locale system-wide. Not recommended to edit. The following steps will guide you through the process of setting up the default system language, using French Canadian as an example. First you will need to edit /etc/locale.gen:

root # nano -w /etc/locale.gen

Specify your preferred locale with the accompanying character format (you will mostly want UTF-8):

   Note

It is recommended to keep the preconfigured en_US.UTF-8 locale as a fallback.

   /etc/locale.gen
en_US.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8

To determine an appropriate locale for your system, you should take a look into /usr/share/i18n/SUPPORTED for the default list of supported combinations or check the /usr/share/i18n/locales/ directory for a list of valid values.

   Warning

You are strongly advised to use at least one UTF-8 locale since some applications may require it.

Now, those locales need to be generated:

root # locale-gen
 * Generating 2 locales (this might take a while) with 1 jobs
 *  (1/2) Generating en_US.UTF-8 ... [ ok ]
 *  (2/2) Generating fr_CA.UTF-8 ... [ ok ]
 * Generation complete

Once done, you can apply your locale settings system-wide. First display all available options:

user $ eselect locale list
root ##b##Available targets for the LANG variable:
  [1]   C
  [2]   POSIX
  [3]   fr_CA.utf8
  [4]   en_US.utf8 *
  [ ]   (free form)

The blue star indicates the current default system locale. You can now change it according your wishes:

root # eselect locale set 3
Setting LANG to fr_CA.utf8 ...
Run ". /etc/profile" to update the variable in your shell.

Alternatively, you can set the default locale manually. This file should be created first with your prefered editor:

   /etc/env.d/02locale
LANG="fr_CA.utf8"

You can verify your actions using:

user $ eselect locale show
root ##b##LANG variable in profile:
  fr_CA.utf8

For an immediate effect it is required to reload the environment:

root # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...

Congratulations! You have successfully set up your default language on Funtoo.

Portage Settings

Portage uses a special variable LINGUAS that defines what localizations/translations get installed by default. By default, LINGUAS in unset, which will result in all available localizations being installed by Portage.

It is possible to customize the setting of LINGUAS by setting it in /etc/make.conf:

root # LINGUAS="en_US zh_CN"

The LINGUAS variable should use spaces between each localization name.

After setting the LINGUAS USE flag you may need to re-emerge some packages:

root # emerge --ask --newuse --deep --with-bdeps=y @world

Read Your Language

A newly installed Funtoo Linux does not able to read all the languages. You want to read the stuff, say, in Mozilla Firefox. You need to install fonts - A good sign that you have not installed the proper fonts is that the following characters appear as boxes with numbers inside: 日本語フォント

Check if you have your language installed (Chinese) by using the fc-list command from the media-libs/fontconfig ebuild:

root # fc-list :lang=zh

If you are lucky, the right font will be installed, and your apps will also be able to use Chinese as the default language. But in case you not have the right font installed in this way, you need to install them manually.

For Japanese:

root # emerge media-fonts/kochi-substitute

For Chinese:

root # emerge media-fonts/arphicfonts

For Korean:

root # emerge media-fonts/baekmuk-fonts

Keymap

Funtoo Linux defaults to a US English keyboard. If you are using another type of keyboard, edit /etc/conf.d/keymaps and set keymap to your keyboard model. For example, cf for French Canadian keyboard, fr for French Azerty.

root # nano -w /etc/conf.d/keymaps

Input Method

ibus is an Intelligent Input Bus for Linux.

root # emerge -av ibus

You also need to install language table for ibus (Chinese)

root # emerge -av ibus-table-chinese