Difference between revisions of "Locale Settings"
(→GnuCash 2.2.9 and older: More complete explanation) |
(→System settings: of your desktop environment) |
||
Line 2: | Line 2: | ||
== System settings == | == System settings == | ||
− | In general GnuCash uses the system settings of your computer. So the control center for system settings should be your ''first choice'' to adjust them. But there are some cases, e.g. as a [[Translation|translator]], 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. | + | 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. 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. |
== IETF language tags == | == IETF language tags == |
Revision as of 19:11, 31 March 2011
While Gnucash was written in american english, there are many translations available. This page shows, how to select them.
Contents
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. 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 localeenvironment variables with proper #IETF language tags, but the How depends on your operating system.
IETF language tags
The IETF language tags are defined by BCP 47. In short commonly they are of the form:
<language>[_<region>[.<charset>]]
Under Linux
locale -a
gives you a list of the on your system possible locales and
locale -m
of the charmaps.
The prefered charset is UTF-8, but Windows might wish another codepage.
LANG vs LANGUAGE
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.
LANGUAGE sets the language of the program surface.
LANG sets a whole bunch of other LC_ variables, which you can always check, at least under Linux, by running locale. This setting affects also beneath others
- 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
LANGUAGE=es LANG=en_US gnucash
Changing the Language on Linux
In general 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 locales name, like "no_NO.UTF-8". You can use these names as well.
Note for Debian users
Make sure your locales are properly installed. If not, run dpkg-reconfigure locales. 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.
Changing the Language on OSX
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 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:
defaults write $(mdls -name kMDItemCFBundleIdentifier -raw /Applications/Gnucash.app) 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.)
If you want to unset it (that is, return to using the system settings), run this:
defaults delete $(mdls -name kMDItemCFBundleIdentifier -raw /Applications/Gnucash.app)
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.
GnuCash 2.2.9
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, Gnucash.app/Contents/MacOS/Gnucash (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.)
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
export LANG=xx_XX 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.
Changing the Language on Windows
GnuCash 2.4.0 or newer
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:
# 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 that the second line should remain as-is. 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):
LANG=fr_CA LANGUAGE={LANG}
GnuCash 2.2.9 and older
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:
set LANG=nl_BE set LANGUAGE=nl_BE start gnucash-bin %*