Your own locale in gentoo
Although I am French, I'd rather have my desktop environment in English. The worry is that the dates and monetary data are also presented in an american format. Especially, amounts are displayed with a '$' in Gnucash, and with a dot as decimal separator.
I wish to have a mostly english locale (based on en_US), with some elements from a french locale (fr_FR). Fortunately, it's quite easy to define a new locale, using existing locales: we will 'import' some elements from an other locale, thanks tot he 'copy' directive in locale files.
First, in /usr/share/i18n/locales, create a new file from an existing one.
root@silver locales # cp en_US en_BV
I choose BV after my name. BV is the ISO code for Bouvet Island; so in the settings of my desktop environment, the locale will appear as "English (Bouvet Island)".
If you want to display amounts with euro sign and french formatting, remove LC_MONETARY and LC_NUMERIC sections and remplace them with:
LC_MONETARY copy "fr_FR" END LC_MONETARY LC_NUMERIC copy "fr_FR" END LC_NUMERIC
Pretty easy, no ? But that's not the end. In order to be used, the locale must be generated and set as new system default locale.
First, edit /etc/locale.gen. Mine looks like this:
en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 en_BV.UTF-8 UTF-8
Then ask the system to rebuild locale with locale-gen.
root@silver ~ # locale-gen * Generating 3 locales (this might take a while) with 1 jobs * (1/3) Generating en_US.UTF-8 ... [ ok ] * (2/3) Generating fr_FR.UTF-8 ... [ ok ] * (3/3) Generating en_BV.UTF-8 ... [ ok ] * Generation complete root@silver ~ #
And finally set the en_BV locale as new default.
root@silver ~ # eselect locale list Available targets for the LANG variable: [1] C [2] en_BV.utf8 [3] en_US.utf8 * [4] fr_FR.utf8 [5] POSIX [ ] (free form) root@silver ~ # eselect locale set 2 Setting LANG to en_BV.utf8 ... Run ". /etc/profile" to update the variable in your shell. root@silver ~ # source /etc/profile root@silver ~ #
And that's it.
For the curious, here's the full en_BV locale:
escape_char / comment_char % % Brahici locale, mixes en_US and fr_FR LC_IDENTIFICATION title "Brahici locale, mixes en_US and fr_FR" source "BVI" address "" contact "Brice V." tel "" fax "" language "Brahici" territory "France" revision "0.0" date "2012-05-07" % category "en_BV:2000";LC_IDENTIFICATION category "en_BV:2000";LC_CTYPE category "en_BV:2000";LC_COLLATE category "en_BV:2000";LC_TIME category "en_BV:2000";LC_NUMERIC category "en_BV:2000";LC_MONETARY category "en_BV:2000";LC_MESSAGES category "en_BV:2000";LC_PAPER category "en_BV:2000";LC_NAME category "en_BV:2000";LC_ADDRESS category "en_BV:2000";LC_TELEPHONE END LC_IDENTIFICATION LC_CTYPE copy "en_GB" END LC_CTYPE LC_COLLATE % Copy the template from ISO/IEC 14651 copy "iso14651_t1" END LC_COLLATE LC_MONETARY copy "fr_FR" END LC_MONETARY LC_NUMERIC copy "fr_FR" END LC_NUMERIC LC_TIME abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/ "<U0053><U0061><U0074>" day "<U0053><U0075><U006E><U0064><U0061><U0079>";/ "<U004D><U006F><U006E><U0064><U0061><U0079>";/ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/ "<U0046><U0072><U0069><U0064><U0061><U0079>";/ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>" week 7;19971130;4 first_weekday 2 first_workday 2 abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>" mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/ "<U004D><U0061><U0072><U0063><U0068>";/ "<U0041><U0070><U0072><U0069><U006C>";/ "<U004D><U0061><U0079>";/ "<U004A><U0075><U006E><U0065>";/ "<U004A><U0075><U006C><U0079>";/ "<U0041><U0075><U0067><U0075><U0073><U0074>";/ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>" % Appropriate date and time representation (%c) % "%a %d %b %Y %r %Z" d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059>/ <U0020><U0025><U0072><U0020><U0025><U005A>" % % Appropriate date representation (%x) % "%d/%m/%Y" d_fmt "<U0025><U0064><U002F><U0025><U006d><U002F><U0025><U0059>" % % Appropriate time representation (%X) % "%r" t_fmt "<U0025><U0072>" % % Appropriate AM/PM time representation (%r) % "%I:%M:%S %p" t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/ <U0025><U0070>" % % Strings for AM/PM % am_pm "<U0041><U004D>";"<U0050><U004D>" % % Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y" date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/ <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/ <U0025><U005A><U0020><U0025><U0059>" END LC_TIME LC_MESSAGES yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>" noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>" yesstr "<U0059><U0065><U0073>" nostr "<U004E><U006F>" END LC_MESSAGES LC_PAPER copy "fr_FR" END LC_PAPER LC_NAME name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/ <U0025><U006D><U0025><U0074><U0025><U0066>" name_miss "<U004D><U0069><U0073><U0073><U002E>" name_mr "<U004D><U0072><U002E>" name_mrs "<U004D><U0072><U0073><U002E>" name_ms "<U004D><U0073><U002E>" END LC_NAME LC_ADDRESS copy "fr_FR" END LC_ADDRESS LC_TELEPHONE copy "fr_FR" END LC_TELEPHONE LC_MEASUREMENT measurement 1 END LC_MEASUREMENT