Difference between revisions of "Locale Settings"

From GnuCash
Jump to: navigation, search
m (GnuCash 2.4.0 or newer: some highlighting)
m (LANG vs LANGUAGE: Biingual language names)
 
(77 intermediate revisions by 7 users not shown)
Line 1: Line 1:
While Gnucash was written in american english, there are many translations available. This page shows, how to select them.
+
While Gnucash was written in American English, there are many localizations available like:
 +
;Language:
 +
;Region specific formats: Number and currency, date and time, paper size.
 +
This page shows how to select them. An additional source is [https://www.gnu.org/software/gettext/manual/gettext.html#Users The User’s View in the Gettext manual].
 +
[[Category:Customization‏‎|Locale Settings]][[Category:L10N|Locale Settings]]
  
 
== System settings ==
 
== System settings ==
In general GnuCash uses the system settings of your computer. So the '''control center for system settings''' of your desktop environment or operating system should be your ''first choice'' to adjust them.
+
In general, GnuCash uses the system settings of your computer. So the '''control center for system settings''' of your operating system, distribution or desktop environment should be your ''first choice'' to adjust them:
 +
;Linux:
 +
:; ''Distro dependent'': If one exists, the '''configuration tool''' of your distribution (like Yast in openSUSE) might be your first choice, because it might apply the settings to ''all environments and for all users''. Additionally it will install the respective language packages, if they are missing.
 +
:;[[Flatpak]]: Also Flatpak uses the system setting.
 +
::Only if you changed your systems locale after your first Flatpak installation it is necessary to
 +
::# make the respective locale available in the <tt>org.gnucash.GnuCash.Locale</tt> package. For example, if one chooses the German locale "de_DE" the first step is to execute: <Syntaxhighlight lang="sh">
 +
flatpak update (--user|--system) --subpath=de org.gnucash.GnuCash.Locale</Syntaxhighlight> [https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-update Flatpak Command Reference: flatpak-update]
 +
::#set it as default: <Syntaxhighlight lang="sh">flatpak override (--user|--system) --env "LANG=de_DE" --env "LANGUAGE=de_DE" org.gnucash.GnuCash</Syntaxhighlight> [https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-override Flatpak Command Reference: flatpak-override]
 +
::That ensures not only the necessary environment variables are set, but also that the respective locale subdirectory is available. Otherwise GnuCash will start with the old default locale.
 +
:;Gnome: <tt>Computer->[System->]Controlcenter->[System->]Language</tt>
 +
:;KDE: <tt>Start->System settings->Regional</tt>
 +
:;''shell'':
 +
::;csh: <Syntaxhighlight lang="csh" inline>setenv LANG de_DE</Syntaxhighlight>
 +
::;sh: <Syntaxhighlight lang="sh" inline>export LANG; LANG=de_DE</Syntaxhighlight>
 +
::;bash, ksh: <Syntaxhighlight lang="sh" inline>export LANG=de_DE</Syntaxhighlight>
 +
:: This can be set for your system from your <tt>.login</tt>, <tt>.profile</tt> or <tt>.bashrc</tt> file.
 +
::; Note: By default bash uses <tt>.login</tt> for remote logins and <tt>.bashrc</tt> for interactive shell, but some distibutions like openSUSE source <tt>.bashrc</tt> in login. Then it has only to be done in <tt>.bashrc</tt>.
  
But there are some cases, e.g. as a [[Translation|translator]] or [[FAQ#Q:_What_should_I_obey_as_a_beginner_in_bug_reporting.2C_enhacement_requesting_....3F|bug hunter]], where you wish to tweak them. Usually this is done by setting the [http://en.wikipedia.org/wiki/Locale locale][http://en.wikipedia.org/wiki/Environment_variable environment variables] with proper [[#IETF language tags]], but the ''How'' depends on your operating system.
+
;{{Mac}}:
 +
:;Mavericks (10.9) and newer: <tt>System Settings>Language and Region</tt>
 +
:;Snow Leopard (10.6) … Mountain Lion (10.8): <tt>System Settings>Languages and Text</tt>
  
== IETF language tags ==
+
;Windows:
The [http://en.wikipedia.org/wiki/Internet_Engineering_Task_Force Internet Engineering Task Force] (IETF) defined the language tags in [http://en.wikipedia.org/wiki/BCP_47 BCP 47]. In short commonly they are of the form:
+
:;10: Right click the <tt>Start</tt> icon in the task bar and select <tt>Settings</tt> -> <tt>Time & Language</tt> -> <Region>.
  <language>[_<region>[.<charset>]]
+
::Changing the <tt>Regional Format</tt> will select both the UI language and the number and date formats. There's no need to log in, but if GnuCash is running you'll have to quit and relaunch it.
 +
:;7:
 +
::;To change the UI ''language'': <tt>Start->Control Panel->[Clock, Language and Region->]Change display language</tt>.
 +
::;To change number and date ''formats'': <tt>Start -> Control Panel -> [Clock, Language and Region] Change format locale</tt>.
 +
:;Vista:
 +
:;Since <tt>DOS</tt> incl. <tt>OS/2</tt>:
 +
:: At the '''shell''' prompts of <code>COMMAND.COM</code> and <code>cmd.exe</code>: <Syntaxhighlight lang="bat" inline>SET LANG=de_DE</Syntaxhighlight>
 +
(Feel free to complete and correct this list)
 +
 
 +
Usually you must then restart your session - re-login.
 +
 
 +
But there are some cases, e.g. as a [[Translation|translator]] or [[FAQ#Q:_What_should_I_obey_as_a_beginner_in_bug_reporting.2C_enhacement_requesting_....3F|bug hunter]], where you wish to tweak them. Usually this is done by setting the [https://en.wikipedia.org/wiki/Locale_(computer_software)#POSIX_platforms locale] [https://en.wikipedia.org/wiki/Environment_variable environment variables] with proper [[#IETF language tags]], but the ''How'' depends on your operating system.
 +
 
 +
== Basics ==
 +
Here are a few basic points to consider.
 +
 
 +
=== Language tags ===
 +
There are at least 2 slightly different definitions of language tags:
 +
The [https://en.wikipedia.org/wiki/Internet_Engineering_Task_Force Internet Engineering Task Force] (IETF) defined the language tags in [https://en.wikipedia.org/wiki/BCP_47 BCP 47], the [https://en.wikipedia.org/wiki/Institute_of_Electrical_and_Electronics_Engineers Institute of Electrical and Electronics Engineers] in [http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_02 IEEE Std 1003.1] (aka POSIX). In short, commonly they are of the form:
 +
  <language>[_<region>][.<charset>]
 
where usually
 
where usually
* <language> is a 2 letter abbreviation taken from the [http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes List of ISO 639-1 codes] and
+
* <'''language'''> is a 2 letter ''lowercase'' abbreviation taken from the [https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes List of ISO 639-1 codes]
* <region> from [http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2]
+
*: or a 3 letter code for [https://www.gnu.org/software/gettext/manual/html_node/Rare-Language-Codes.html#Rare-Language-Codes Rare Language Codes] and
Under Linux
+
* <'''region'''> in ''uppercase'' from [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2] to differentiate e.g. <tt>pt_PT</tt> vs. <tt>pt_BR</tt>.
locale -a
+
 
gives you a list of the on your system ''installed locales'' and  
+
The POSIX standard includes an additional modifier:
locale -m
+
[language[_territory][.codeset][@modifier]]
of the charmaps.
+
The '''@modifier''' will be used if e.g. different scripts are available like <tt>cyrillic</tt> vs. <tt>latin</tt>. The '''Codes for the representation of names of scripts''' are defined in [https://en.wikipedia.org/wiki/ISO_15924 ISO 15924].
 +
 
 +
The preferred '''charset''' is ''UTF-8'', which has enough space for all known scripts, but Windows might wish another codepage. In some Linux distributions (like Fedora 21), at least as long as the language is not installed system wide, the default is ''@euro'', a shortcut for ''ISO-8859-15'', which is different from UTF-8. If the program crashes as described in [{{BugURL}}/show_bug.cgi?id=628710 Bug 628710 - Crash when calling "New File" with a charset <> utf8 in LANG] or showing a line like <tt>Invalid UTF-8 string passed to pango_layout_set_text()</tt> on the command line or in the [[Tracefile|log file]], you should explicitly set the charset to utf-8.
 +
 
 +
;POSIX (Linux, {{Mac}}, *BSD): <SyntaxHighlight lang="sh" inline>localectl</SyntaxHighlight> shows your ''current setting'' and ''keyboard selection'',
 +
:<SyntaxHighlight lang="sh" inline>locale</SyntaxHighlight> shows ''all categories'' of your current settings.
 +
:<SyntaxHighlight lang="sh" inline>locale -c[k] <category></SyntaxHighlight> shows the current '''''content''' of a category''. <code>k</code> will add the keyword names.
 +
:<SyntaxHighlight lang="sh" inline>locale -k <keyword></SyntaxHighlight> shows the current ''value of a keyword''.
 +
:<SyntaxHighlight lang="sh" inline>locale -a</SyntaxHighlight> gives you a list of the ''installed locales'' on your system and  
 +
:<SyntaxHighlight lang="sh" inline>locale -m</SyntaxHighlight> of the available ''charmaps''.
 +
:If the list is too long you can filter it, e.g.
 +
:<SyntaxHighlight lang="sh" inline>
 +
locale -a | grep de_
 +
</SyntaxHighlight> to see available combinations for German (de) or
 +
:<SyntaxHighlight lang="sh" inline>
 +
locale -a | grep _DE
 +
</SyntaxHighlight> to see available combinations for Germany (DE).
 +
 
 +
:See <SyntaxHighlight lang="console">
 +
$ man locale
 +
Man: find all matching manual pages (set MAN_POSIXLY_CORRECT to avoid this)
 +
* locale (5)
 +
  locale (7)
 +
  locale (1p)                                                                             
 +
Man: What manual page do you want?
 +
Man: 1p
 +
</SyntaxHighlight> for further details.
 +
 
 +
;Windows: has—at least for programmers–similar tools and APIs, see [https://docs.microsoft.com/en-us/windows/win32/intl/international-support Internationalization for Windows Applications]
  
 
If your desired language or charset is missing you should install them using the tools of your operating system.
 
If your desired language or charset is missing you should install them using the tools of your operating system.
  
The prefered '''charset''' is ''UTF-8'', but Windows might wish another codepage. If the program crashes as described in [https://bugzilla.gnome.org/show_bug.cgi?id=628710 Bug 628710 - Crash when calling "New File" with a charset <> utf8 in LANG] you should explicitly set the charset to utf-8.
+
=== LANG vs LANGUAGE ===
 +
'''LANG''' is the ''important'' variable. It sets a whole bunch of ''LC_'' variables, which you can always check, at least under Linux, by running <tt>locale</tt> on the command line. This setting affects things like
 +
* the default currency;
 +
* formats of date and numbers;
 +
* sort order of language specific letters like á, à, â, ä …, if in the locale defined = a, else behind z;
 +
* in GnuCash available account templates and tax reports.
  
== LANG vs LANGUAGE ==
+
'''LANGUAGE''' is usually ''not required''. If <tt>LANGUAGE</tt> should be the same as <tt>LANG</tt>, there is no need to set it. It can contain, like in your browser settings, a ''priority list of languages'' to be used by the program surface. You can set it to a colon separated ''list of language codes'', which you prefer over US English - the fallback if your languages are not found.
It may be that both variables are not always required. It depends on the system. It does no harm to set both of them and this ensures that the language is really set.
+
;Example 1: <SyntaxHighlight lang="ini">
 +
LANG=fy_NL
 +
LANGUAGE=fy:nl
 +
</SyntaxHighlight> if you are a westfrisian who prefers Frysk (Frisian) and understands Nederlands (Dutch) better than English. But as long as nobody has submited frisian account templates and a frisian translation, better use <tt>LANG=nl_NL</tt> to get the dutch instead of the US-american templates.
  
'''LANGUAGE''' sets the language of the program surface.
+
;Example 2: If you understand Spanish better than English, but wish to create an US tax report, you can run <SyntaxHighlight lang="sh">
 +
LANGUAGE=es LANG=en_US gnucash
 +
</SyntaxHighlight>
  
'''LANG''' sets a whole bunch of other ''LC_'' variables, which you can always check, at least under Linux, by running <tt>locale</tt>. This setting affects also beneath others
+
;See also: [{{URL:Gnu}}software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable gettext manual: The LANGUAGE variable]
* the default currency, 
 
* available account templates.
 
  
So if you understand spanish better than english, but wish to create an US tax report, you can run
+
Again, at least under Linux, you can simply unset LANGUAGE and only use LANG. Please report here, which are required for other OSes.
LANGUAGE=es LANG=en_US gnucash
 
  
== Changing the Language on Linux ==
+
== OS dependent tweaking ==
In general you should set the LANGUAGE and LANG environment variables before starting GnuCash. For example:
+
=== Verify translations are installed ===
 +
While ''our'' [[Flatpak]], {{Mac}} and Windows bundles include the translations '''some Linux distributions''' split regional stuff in separate packages.
 +
:Use your package manager to verify you did not miss to install <tt>GnuCash.Locale-*</tt>,
 +
:: <tt>gnucash-lang-*</tt> or however they named it.
 +
:The same is also valid for ''standard buttons'' like <code><u>Y</u>es</code>, <code><u>N</u>o</code> … from GTK like: <syntaxhighlight lang="sh>
 +
sudo apt-get install language-pack-gnome-de
 +
</syntaxhighlight>
  
$ env LANGUAGE=fr_FR
+
=== Changing the Language on Linux ===
$ env LANG=fr_FR
+
In some cases (see [[#LANG vs LANGUAGE]]) you should set the LANGUAGE and LANG environment variables before starting GnuCash. For example: <SyntaxHighlight lang="Console">
$ gnucash
+
$ env LANGUAGE=fr_FR
 +
$ env LANG=fr_FR
 +
$ gnucash
 +
</SyntaxHighlight>
  
 
:This example sets the variables to use GnuCash in French (français) and then launches GnuCash.
 
:This example sets the variables to use GnuCash in French (français) and then launches GnuCash.
 
+
:You could also do this in one line: <SyntaxHighlight lang="Console">
:You could also do this in one line:
+
$ LANGUAGE=de_DE LANG=de_DE gnucash
 
+
</SyntaxHighlight>
  $ LANGUAGE=de_DE LANG=de_DE gnucash
 
  
 
:This example sets the language to German (Deutsch).
 
:This example sets the language to German (Deutsch).
  
:This one-line method can also be used if you like to change the default language for the GnuCash menu item (or in the gnucash.desktop file). For these cases, the path to GnuCash is usually a full path and the command is followed with '%f', which represents the file to be opened:
+
:This one-line method can also be used if you like to change the default language for the GnuCash menu item (or in the gnucash.desktop file). For these cases, the path to GnuCash is usually a full path and the command is followed with '%f', which represents the file to be opened: <SyntaxHighlight lang="Console">
 +
$ LANGUAGE=de_DE LANG=de_DE /usr/bin/gnucash %f
 +
</SyntaxHighlight>
  
$ LANGUAGE=de_DE LANG=de_DE /usr/bin/gnucash %f
+
On some systems the encoding could be part of the locale name, like "no_NO.UTF-8". You can use these names as well.
 +
;Note: ''no'' is a '''macrolanguage''' containing
 +
:* '''nb''' - ''Bokmål'' which is supported by GnuCash and
 +
:* '''nn''' - ''Nynorsk'' which is unsupported.
 +
: If "no_NO" fails, try "nb_NO".
 +
: Full list: [https://iso639-3.sil.org/code_tables/macrolanguage_mappings/data ISO 639-3 Macrolanguage Mappings]
  
On some systems the encoding could be part of the locales name, like "no_NO.UTF-8". You can use these names as well.
+
You should first test your setting by calling it on the ''command line''. Then you might see <SyntaxHighlight lang="Console">
 +
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale
 +
</SyntaxHighlight>
 +
if something still is wrong, i.e. you did not install or enable the respective ''language and region support'' of your OS.
  
===Note for Debian users===
+
====Note for Debian users====
Make sure your locales of the language in which you want ''GnuCash'' to appear are properly installed. You can check by <tt>locale -a | grep de_DE</tt> (in case of German). If nothing is in output, run <tt>dpkg-reconfigure locales</tt> and install needed one. Eventually you will have run <tt>locale-gen</tt> afterwards to make the new installed locales available.
+
Make sure your locales of the language in which you want ''GnuCash'' to appear are properly installed. You can check by <tt>locale -a | grep de_DE</tt> (in case of German). If nothing is in output, run <tt>dpkg-reconfigure locales</tt> and install needed one. Eventually you will have run <tt>locale-gen</tt> afterwards to make the newly-installed locales available.
  
 
Note that the default desktop manager for Debian is GDM which does '''NOT''' read the .xsession files. To get the right language using GDM, use the Options button on the GDM login screen and set the default language. (The list includes all those languages supported by locales). When you login, confirm that the new language is to be the default for future sessions.
 
Note that the default desktop manager for Debian is GDM which does '''NOT''' read the .xsession files. To get the right language using GDM, use the Options button on the GDM login screen and set the default language. (The list includes all those languages supported by locales). When you login, confirm that the new language is to be the default for future sessions.
  
===Notes for Ubuntu users===
+
====Notes for Ubuntu users====
  
If the previous instructions don't works, please check the following items:
+
If the previous instructions don't work, please check the following items:
* if you have installed ''localepurge'' package, be sure that the locale you are using is not deleted after the installation of gnucash. To check this, reconfigure localepurge, and be sure to not include your locale in the list of the ones to be deleted
+
* if you have installed ''localepurge'' package, be sure that the locale you are using is not deleted after the installation of gnucash. To check this, reconfigure localepurge, and be sure to not include your locale in the list of the ones to be deleted <SyntaxHighlight lang="sh>
sudo dpkg-reconfigure localepurge
+
sudo dpkg-reconfigure localepurge
: Then reinstall all gnucash packages:
+
</SyntaxHighlight>
sudo apt-get install --reinstall gnucash gnucash-common gnucash-doc
+
: Then reinstall all gnucash packages: <SyntaxHighlight lang="sh>
 +
sudo apt-get install --reinstall gnucash gnucash-common gnucash-doc
 +
</SyntaxHighlight>
  
* If you can get the graphical interface in the correct language , but you can't get the accounts in the desired locale, you have to add the LC_ALL variable, like in the following example:
+
* If you can get the graphical interface in the correct language , but you can't get the accounts in the desired locale, you have to add the LC_ALL variable, like in the following example: <SyntaxHighlight lang="sh>
LANG=it_IT.UTF-8 LANGUAGE=it_IT.UTF8 LC_ALL=it_IT.UTF-8 gnucash
+
LANG=it_IT.UTF-8 LANGUAGE=it_IT.UTF8 LC_ALL=it_IT.UTF-8 gnucash
 +
</SyntaxHighlight>
  
== Changing the Language on OSX ==
+
=== Changing the Language on {{Mac}} ===
  
=== GnuCash 2.4.0 or newer ===
+
By default, Gnucash will select the first available translation from the list in your language list (''System Settings>International'' or ''System Settings>Languages and Text'', depending on what version of {{Mac}} you're using). Other localization settings (numeric format, date format, and default currency) are determined from the "Formats" tab of the same System Settings panel. Environment variables have '''no effect''', and there is no environment.sh file.
By default, Gnucash will select the first available translation from the list in your language list (''System Settings>International'' or ''System Settings>Languages and Text'', depending on what version of OSX you're using). Other localization settings (numeric format, date format, and default currency) are determined from the "Formats" tab of the same System Settings panel. Environment variables have '''no effect''', and there is no environment.sh file.
 
  
If you want to use a different translation from the one that is automatically selected, you can run the following in ''Terminal.app'':
+
If you want to use ''a different translation from the one that is automatically selected'', you can run the following in ''Terminal.app'':
 
   defaults write -app Gnucash AppleLanguages '(de, en)'
 
   defaults write -app Gnucash AppleLanguages '(de, en)'
  
 
(Use whatever language codes you want, replacing Deutsch and English. It won't work if there isn't a translation file for the language you want.)
 
(Use whatever language codes you want, replacing Deutsch and English. It won't work if there isn't a translation file for the language you want.)
 +
Some versions of {{Mac}} don't accept <tt>-app Gnucash</tt> and emit <tt>Can't determine domain name for application Gnucash</tt>. In that case use <tt>org.gnucash.Gnucash</tt> in place of <tt>-app Gnucash</tt>.
  
 
If you want to unset it (that is, return to using the system settings), run this:
 
If you want to unset it (that is, return to using the system settings), run this:
 
  defaults delete -app Gnucash AppleLanguages
 
  defaults delete -app Gnucash AppleLanguages
  
You can adjust the other locale settings similarly: Use <tt>AppleLocale  'xx_XX'</tt>, providing a language and country code; you can specialize it for currency with <tt>AppleLocale  'xx_XX@currency=YYY'</tt>, where <tt>YYY</tt> is a valid [http://en.wikipedia.org/wiki/ISO_4217 ISO-4217 currency code].
+
You can adjust the ''other locale settings'' similarly: Use
 +
AppleLocale  'xx_XX'
 +
providing a language and country code; you can specialize it for currency with <tt>AppleLocale  'xx_XX@currency=YYY'</tt>, where <tt>YYY</tt> is a valid [https://en.wikipedia.org/wiki/ISO_4217 ISO-4217 currency code].
  
 
'''NB:''' The quotes around the value must be ''single'' quotes. If you use double quotes you'll get the following error:
 
'''NB:''' The quotes around the value must be ''single'' quotes. If you use double quotes you'll get the following error:
Line 90: Line 189:
 
   Defaults have not been changed.
 
   Defaults have not been changed.
  
=== GnuCash 2.2.9 ===
+
=== Changing the Language on Windows ===
With Gnucash 2.2.9 (the first version with a project-provided MacOSX build), the language and locale settings are extracted from the system defaults in the launcher script, <tt>Gnucash.app/Contents/MacOS/Gnucash</tt> (You can see this file in Finder by control-clicking on Gnucash.app and selecting "Show Package Contents" from the context menu; the Contents subfolder will open in a new Finder window. From there you can navigate to the launcher script and open it with your favorite editor. If  you don't have a favorite editor, TextEdit works fine.)
+
 
 +
==== GnuCash 3.0 or newer ====
 +
 
 +
If you are running GnuCash 3.0 (or newer) on Windows, you can set the interface language by editing the file ''environment.local''. This file does not exist by default, but you can create one ''as administrator'' in '''c:\\Program Files\gnucash\etc\gnucash''' next to the file called '''environment''': <SyntaxHighlight lang="ini">
 +
[Variables]
 +
LANG=fr_CA
 +
LANGUAGE={LANG}
 +
</SyntaxHighlight>
 +
Note the second line can usually remain as-is, unless you explicitly want to configure LANG and LANGUAGE differently as explained under [[#LANG vs LANGUAGE]].  The braces are a variable expansion of the LANG variable.
 +
You can find more information in the environment file in the same directory.
 +
 
 +
==== GnuCash 2.4.0 - 2.6.21 ====
 +
 
 +
If you are running GnuCash 2.4.0 - 2.6.21 on Windows, you can set the interface language by editing the file ''environment''. By default this file is installed in '''c:\\Program Files\gnucash\etc\gnucash'''. Change this file ''as administrator'' such that the last few lines are: <SyntaxHighlight lang="ini">
 +
# If you wish GnuCash to use a different language, uncomment the two parameters
 +
# below and set LANG to your preferred locale
 +
LANG=nl_BE
 +
LANGUAGE={LANG}
 +
</SyntaxHighlight>
 +
Note the second line can usually remain as-is, unless you explicitly want to configure LANG and LANGUAGE differently as explained under [[#LANG vs LANGUAGE]]. The braces are a variable expansion of the LANG variable.
 +
 
 +
Don't forget to remove the comment signs: <code>#</code>.
 +
 
 +
The Language lines in your Environment file should look like this (change language variables based on desired language): <SyntaxHighlight lang="ini">
 +
LANG=fr_CA
 +
LANGUAGE={LANG}
 +
</SyntaxHighlight>
 +
 
 +
==== Swedish and probably other Languages ====
 +
 
 +
According [{{BugURL}}/show_bug.cgi?id=725296 Bug 725296 Unable to change language from english using the environment file] there seems to be something wrong in the table translating ''ISO-639 language codes'' - specialized with ISO-3166-1 country codes where appropriate - into ''Microsoft locale names''.
 +
;Workaround: In the environment file set <SyntaxHighlight lang="ini">
 +
LANG=Swedish_Sweden
 +
LANGUAGE=sv
 +
</SyntaxHighlight>
 +
 
 +
==== Using More Than One Language ====
 +
In this case you can create shortcuts, see [https://netlicensing.io/blog/2012/06/15/set-environment-variables-in-windows-shortcut/ How to set environment variables in windows shortcut?].
 +
 
 +
== Support State ==
 +
This section explains how to get the current state of translated languages and adapted account templates for specific regions.  
 +
 
 +
=== Supported Languages ===
 +
While we have many translations for the program, there are fewer documentation translations.
  
The shell script method of obtaining the locale information proved to be a bit brittle, producing surprising results for a few users. If you find that you want to override it, you can change the variables in the script or just add the following at the bottom
+
==== Program ====
export LANG=xx_XX
+
You can easily see an outdated overview at the [https://translationproject.org/domain/gnucash.html Translation Project].
export LANGUAGE=xx_XX
 
just before the
 
$EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS
 
line. It's important to export both LANG and LANGUAGE because while the POSIX spec says that LANGUAGE should override LANG and Gnucash follows the spec, Gtk+ doesn't and uses only LANG. Some button and menu item translations are provided by Gtk+, so you can get mixed languages on controls in Gnucash.  
 
  
If you need to adjust something else (currency, perhaps), look at the locale-setting block in the launcher script to see what variables to override.
+
The ''next GnuCash release'' will have (at least partial) support of your language, if you see <language>.po in the stable branch of our [https://github.com/Gnucash/gnucash/tree/maint/po Github po directory]
  
== Changing the Language on Windows ==
+
Feel free to click on <tt>Branch->Tags</tt> there to select your ''current version'' or some historical data.
  
=== GnuCash 2.4.0 or newer ===
+
To see the completeness of any .po file download it and run
 +
msgfmt --statistics <language>.po
 +
or in your preferred ''po file editor''. You can find an overview of them in [[Translation#Tools]].
  
If you are running GnuCash 2.4.0 (or newer) on Windows, you can set the interface language by editing the file ''environment''. By default this file is installed in ''c:\\Program Files\gnucash\etc\gnucash''. Change this file such that the last few lines are:
+
msgfmt -c <language>.po
 +
can be used to check the file for syntactical errors. The program ''msgfmt'' is part of the package [https://en.wikipedia.org/wiki/Gettext Gettext]
  
# If you wish GnuCash to use a different language, uncomment the two parameters
+
==== Documentation ====
# below and set LANG to your preferred locale
+
Similar as for the [[#Program]] you can search the documentation for a <language> directory:
LANG=nl_BE
+
*[https://github.com/Gnucash/gnucash-docs/tree/maint/guide Guide]
LANGUAGE={LANG}
+
*[https://github.com/Gnucash/gnucash-docs/tree/maint/help Help]
Note that the second line should remain as-is, unless you explicitly want to set LANG and LANGUAGE to different locales as explained under [[#LANG vs LANGUAGE]]. The braces are a variable expansion of the LANG variable.
 
  
The Language lines in your Environment file should look like this (change language variables based on desired language):
+
==== Improving Translations ====
 +
If you think the translations could be improved, continue on our [[Translation]] page.
  
LANG=fr_CA
+
=== Supported Regions ===
LANGUAGE={LANG}
+
Finally for the [https://github.com/Gnucash/gnucash/tree/maint/data/accounts account templates] search your <language>[_<region>] directory.
  
=== GnuCash 2.2.9 and older ===
+
== Font Issues ==
 +
(main section should be moved from [[FAQ#Q: How get I rid of strange unreadable characters?]]
 +
=== Rare Fonts ===
 +
We have translations in scripts which are rare in most common fonts. See [[Published_tools#Fonts]] for places to download them.
  
A good place to set your language preference is in ''gnucash.cmd''. By default this file is installed in 'c:\\Program Files\gnucash\bin'. Change this file such that the last few lines are:
+
== Adjusting Currency Symbols ==
 +
In order to support the use of appropriate currency symbols when using foreign or multi-currency accounts, In GNUCash 2.6.x is ongoing work on [{{BugURL}}/show_bug.cgi?id=723145 Bug 723145 - Currency display does not respect locale]. Some versions of Gnucash do not ask the currency symbol in the right order from the different settings. If for example your locale was set to en_US and you had a Euro account, "EUR" would prefix monetary amounts rather than the preferable "&#x20ac;" (Euro sign). Currency symbols are now taken from a pre-populated list based on [https://en.wikipedia.org/wiki/ISO_4217 ISO-4217].
  
set LANG=nl_BE
+
The default symbols are not always appropriate for every region setting however. For example, the default display symbol for the Canadian dollar is "C$", which is not optimal if you are in Canada using only CAD accounts. In this context, simply "$" is preferable. Therefore, it is possible to customize the display symbol for any currency in the security editor '''Tools->Securities->Currency'''.
set LANGUAGE=nl_BE
 
start gnucash-bin %*
 

Latest revision as of 10:08, 21 February 2022

While Gnucash was written in American English, there are many localizations available like:

Language
Region specific formats
Number and currency, date and time, paper size.

This page shows how to select them. An additional source is The User’s View in the Gettext manual.

System settings

In general, GnuCash uses the system settings of your computer. So the control center for system settings of your operating system, distribution or desktop environment should be your first choice to adjust them:

Linux
Distro dependent
If one exists, the configuration tool of your distribution (like Yast in openSUSE) might be your first choice, because it might apply the settings to all environments and for all users. Additionally it will install the respective language packages, if they are missing.
Flatpak
Also Flatpak uses the system setting.
Only if you changed your systems locale after your first Flatpak installation it is necessary to
  1. make the respective locale available in the org.gnucash.GnuCash.Locale package. For example, if one chooses the German locale "de_DE" the first step is to execute:
    flatpak update (--user|--system) --subpath=de org.gnucash.GnuCash.Locale
    
    Flatpak Command Reference: flatpak-update
  2. set it as default:
    flatpak override (--user|--system) --env "LANG=de_DE" --env "LANGUAGE=de_DE" org.gnucash.GnuCash
    
    Flatpak Command Reference: flatpak-override
That ensures not only the necessary environment variables are set, but also that the respective locale subdirectory is available. Otherwise GnuCash will start with the old default locale.
Gnome
Computer->[System->]Controlcenter->[System->]Language
KDE
Start->System settings->Regional
shell
csh
setenv LANG de_DE
sh
export LANG; LANG=de_DE
bash, ksh
export LANG=de_DE
This can be set for your system from your .login, .profile or .bashrc file.
Note
By default bash uses .login for remote logins and .bashrc for interactive shell, but some distibutions like openSUSE source .bashrc in login. Then it has only to be done in .bashrc.
macOS
Mavericks (10.9) and newer
System Settings>Language and Region
Snow Leopard (10.6) … Mountain Lion (10.8)
System Settings>Languages and Text
Windows
10
Right click the Start icon in the task bar and select Settings -> Time & Language -> <Region>.
Changing the Regional Format will select both the UI language and the number and date formats. There's no need to log in, but if GnuCash is running you'll have to quit and relaunch it.
7
To change the UI language
Start->Control Panel->[Clock, Language and Region->]Change display language.
To change number and date formats
Start -> Control Panel -> [Clock, Language and Region] Change format locale.
Vista
Since DOS incl. OS/2
At the shell prompts of COMMAND.COM and cmd.exe: SET LANG=de_DE

(Feel free to complete and correct this list)

Usually you must then restart your session - re-login.

But there are some cases, e.g. as a translator or bug hunter, where you wish to tweak them. Usually this is done by setting the locale environment variables with proper #IETF language tags, but the How depends on your operating system.

Basics

Here are a few basic points to consider.

Language tags

There are at least 2 slightly different definitions of language tags: The Internet Engineering Task Force (IETF) defined the language tags in BCP 47, the Institute of Electrical and Electronics Engineers in IEEE Std 1003.1 (aka POSIX). In short, commonly they are of the form:

<language>[_<region>][.<charset>]

where usually

The POSIX standard includes an additional modifier:

[language[_territory][.codeset][@modifier]]

The @modifier will be used if e.g. different scripts are available like cyrillic vs. latin. The Codes for the representation of names of scripts are defined in ISO 15924.

The preferred charset is UTF-8, which has enough space for all known scripts, but Windows might wish another codepage. In some Linux distributions (like Fedora 21), at least as long as the language is not installed system wide, the default is @euro, a shortcut for ISO-8859-15, which is different from UTF-8. If the program crashes as described in Bug 628710 - Crash when calling "New File" with a charset <> utf8 in LANG or showing a line like Invalid UTF-8 string passed to pango_layout_set_text() on the command line or in the log file, you should explicitly set the charset to utf-8.

POSIX (Linux, macOS, *BSD)
localectl shows your current setting and keyboard selection,
locale shows all categories of your current settings.
locale -c[k] <category> shows the current content of a category. k will add the keyword names.
locale -k <keyword> shows the current value of a keyword.
locale -a gives you a list of the installed locales on your system and
locale -m of the available charmaps.
If the list is too long you can filter it, e.g.
locale -a | grep de_ to see available combinations for German (de) or
locale -a | grep _DE to see available combinations for Germany (DE).
See
$ man locale
Man: find all matching manual pages (set MAN_POSIXLY_CORRECT to avoid this)
* locale (5)
  locale (7)
  locale (1p)                                                                              
Man: What manual page do you want?
Man: 1p
for further details.
Windows
has—at least for programmers–similar tools and APIs, see Internationalization for Windows Applications

If your desired language or charset is missing you should install them using the tools of your operating system.

LANG vs LANGUAGE

LANG is the important variable. It sets a whole bunch of LC_ variables, which you can always check, at least under Linux, by running locale on the command line. This setting affects things like

  • the default currency;
  • formats of date and numbers;
  • sort order of language specific letters like á, à, â, ä …, if in the locale defined = a, else behind z;
  • in GnuCash available account templates and tax reports.

LANGUAGE is usually not required. If LANGUAGE should be the same as LANG, there is no need to set it. It can contain, like in your browser settings, a priority list of languages to be used by the program surface. You can set it to a colon separated list of language codes, which you prefer over US English - the fallback if your languages are not found.

Example 1
LANG=fy_NL 
LANGUAGE=fy:nl
if you are a westfrisian who prefers Frysk (Frisian) and understands Nederlands (Dutch) better than English. But as long as nobody has submited frisian account templates and a frisian translation, better use LANG=nl_NL to get the dutch instead of the US-american templates.
Example 2
If you understand Spanish better than English, but wish to create an US tax report, you can run
LANGUAGE=es LANG=en_US gnucash
See also
gettext manual: The LANGUAGE variable

Again, at least under Linux, you can simply unset LANGUAGE and only use LANG. Please report here, which are required for other OSes.

OS dependent tweaking

Verify translations are installed

While our Flatpak, macOS and Windows bundles include the translations some Linux distributions split regional stuff in separate packages.

Use your package manager to verify you did not miss to install GnuCash.Locale-*,
gnucash-lang-* or however they named it.
The same is also valid for standard buttons like Yes, No … from GTK like:
sudo apt-get install language-pack-gnome-de

Changing the Language on Linux

In some cases (see #LANG vs LANGUAGE) you should set the LANGUAGE and LANG environment variables before starting GnuCash. For example:
$ env LANGUAGE=fr_FR
$ env LANG=fr_FR
$ gnucash
This example sets the variables to use GnuCash in French (français) and then launches GnuCash.
You could also do this in one line:
$ LANGUAGE=de_DE LANG=de_DE gnucash
This example sets the language to German (Deutsch).
This one-line method can also be used if you like to change the default language for the GnuCash menu item (or in the gnucash.desktop file). For these cases, the path to GnuCash is usually a full path and the command is followed with '%f', which represents the file to be opened:
$ LANGUAGE=de_DE LANG=de_DE /usr/bin/gnucash %f

On some systems the encoding could be part of the locale name, like "no_NO.UTF-8". You can use these names as well.

Note
no is a macrolanguage containing
  • nb - Bokmål which is supported by GnuCash and
  • nn - Nynorsk which is unsupported.
If "no_NO" fails, try "nb_NO".
Full list: ISO 639-3 Macrolanguage Mappings
You should first test your setting by calling it on the command line. Then you might see
The locale defined in the environment isn't supported. Falling back to the 'C' (US English) locale

if something still is wrong, i.e. you did not install or enable the respective language and region support of your OS.

Note for Debian users

Make sure your locales of the language in which you want GnuCash to appear are properly installed. You can check by locale -a | grep de_DE (in case of German). If nothing is in output, run dpkg-reconfigure locales and install needed one. Eventually you will have run locale-gen afterwards to make the newly-installed locales available.

Note that the default desktop manager for Debian is GDM which does NOT read the .xsession files. To get the right language using GDM, use the Options button on the GDM login screen and set the default language. (The list includes all those languages supported by locales). When you login, confirm that the new language is to be the default for future sessions.

Notes for Ubuntu users

If the previous instructions don't work, please check the following items:

  • if you have installed localepurge package, be sure that the locale you are using is not deleted after the installation of gnucash. To check this, reconfigure localepurge, and be sure to not include your locale in the list of the ones to be deleted
    sudo dpkg-reconfigure localepurge
    
Then reinstall all gnucash packages:
sudo apt-get install --reinstall gnucash gnucash-common gnucash-doc
  • If you can get the graphical interface in the correct language , but you can't get the accounts in the desired locale, you have to add the LC_ALL variable, like in the following example:
    LANG=it_IT.UTF-8 LANGUAGE=it_IT.UTF8 LC_ALL=it_IT.UTF-8 gnucash
    

Changing the Language on macOS

By default, Gnucash will select the first available translation from the list in your language list (System Settings>International or System Settings>Languages and Text, depending on what version of macOS you're using). Other localization settings (numeric format, date format, and default currency) are determined from the "Formats" tab of the same System Settings panel. Environment variables have no effect, and there is no environment.sh file.

If you want to use a different translation from the one that is automatically selected, you can run the following in Terminal.app:

  defaults write -app Gnucash AppleLanguages '(de, en)'

(Use whatever language codes you want, replacing Deutsch and English. It won't work if there isn't a translation file for the language you want.) Some versions of macOS don't accept -app Gnucash and emit Can't determine domain name for application Gnucash. In that case use org.gnucash.Gnucash in place of -app Gnucash.

If you want to unset it (that is, return to using the system settings), run this:

defaults delete -app Gnucash AppleLanguages

You can adjust the other locale settings similarly: Use

AppleLocale  'xx_XX'

providing a language and country code; you can specialize it for currency with AppleLocale 'xx_XX@currency=YYY', where YYY is a valid ISO-4217 currency code.

NB: The quotes around the value must be single quotes. If you use double quotes you'll get the following error:

 Rep argument is not a dictionary
 Defaults have not been changed.

Changing the Language on Windows

GnuCash 3.0 or newer

If you are running GnuCash 3.0 (or newer) on Windows, you can set the interface language by editing the file environment.local. This file does not exist by default, but you can create one as administrator in c:\\Program Files\gnucash\etc\gnucash next to the file called environment:
[Variables]
LANG=fr_CA
LANGUAGE={LANG}

Note the second line can usually remain as-is, unless you explicitly want to configure LANG and LANGUAGE differently as explained under #LANG vs LANGUAGE. The braces are a variable expansion of the LANG variable. You can find more information in the environment file in the same directory.

GnuCash 2.4.0 - 2.6.21

If you are running GnuCash 2.4.0 - 2.6.21 on Windows, you can set the interface language by editing the file environment. By default this file is installed in c:\\Program Files\gnucash\etc\gnucash. Change this file as administrator such that the last few lines are:
# If you wish GnuCash to use a different language, uncomment the two parameters
# below and set LANG to your preferred locale
LANG=nl_BE
LANGUAGE={LANG}

Note the second line can usually remain as-is, unless you explicitly want to configure LANG and LANGUAGE differently as explained under #LANG vs LANGUAGE. The braces are a variable expansion of the LANG variable.

Don't forget to remove the comment signs: #.

The Language lines in your Environment file should look like this (change language variables based on desired language):
LANG=fr_CA
LANGUAGE={LANG}

Swedish and probably other Languages

According Bug 725296 Unable to change language from english using the environment file there seems to be something wrong in the table translating ISO-639 language codes - specialized with ISO-3166-1 country codes where appropriate - into Microsoft locale names.

Workaround
In the environment file set
LANG=Swedish_Sweden
LANGUAGE=sv

Using More Than One Language

In this case you can create shortcuts, see How to set environment variables in windows shortcut?.

Support State

This section explains how to get the current state of translated languages and adapted account templates for specific regions.

Supported Languages

While we have many translations for the program, there are fewer documentation translations.

Program

You can easily see an outdated overview at the Translation Project.

The next GnuCash release will have (at least partial) support of your language, if you see <language>.po in the stable branch of our Github po directory

Feel free to click on Branch->Tags there to select your current version or some historical data.

To see the completeness of any .po file download it and run

msgfmt --statistics <language>.po

or in your preferred po file editor. You can find an overview of them in Translation#Tools.

msgfmt -c <language>.po

can be used to check the file for syntactical errors. The program msgfmt is part of the package Gettext

Documentation

Similar as for the #Program you can search the documentation for a <language> directory:

Improving Translations

If you think the translations could be improved, continue on our Translation page.

Supported Regions

Finally for the account templates search your <language>[_<region>] directory.

Font Issues

(main section should be moved from FAQ#Q: How get I rid of strange unreadable characters?

Rare Fonts

We have translations in scripts which are rare in most common fonts. See Published_tools#Fonts for places to download them.

Adjusting Currency Symbols

In order to support the use of appropriate currency symbols when using foreign or multi-currency accounts, In GNUCash 2.6.x is ongoing work on Bug 723145 - Currency display does not respect locale. Some versions of Gnucash do not ask the currency symbol in the right order from the different settings. If for example your locale was set to en_US and you had a Euro account, "EUR" would prefix monetary amounts rather than the preferable "€" (Euro sign). Currency symbols are now taken from a pre-populated list based on ISO-4217.

The default symbols are not always appropriate for every region setting however. For example, the default display symbol for the Canadian dollar is "C$", which is not optimal if you are in Canada using only CAD accounts. In this context, simply "$" is preferable. Therefore, it is possible to customize the display symbol for any currency in the security editor Tools->Securities->Currency.