Difference between revisions of "Locale Settings"

From GnuCash
Jump to: navigation, search
m (GnuCash 2.4.0 or newer: How to deal with Can't determine domain name for application Gnucash.)
(Changing the Language on Windows: Bug 725296)
Line 179: Line 179:
 
  LANG=fr_CA
 
  LANG=fr_CA
 
  LANGUAGE={LANG}
 
  LANGUAGE={LANG}
 +
 +
==== Swedish and probably other Languages ====
 +
 +
According [https://bugzilla.gnome.org/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 - in ''Microsoft locale names''.
 +
;Workaround: In the environment file set
 +
LANG=Swedish_Sweden
 +
LANGUAGE=sv
  
 
==== GnuCash 2.2.9 and older ====
 
==== GnuCash 2.2.9 and older ====

Revision as of 11:58, 20 March 2015

While Gnucash was written in american english, there are many translations available. This page shows, how to select them.

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:

  • Linux
  • distro dependend: the configuration tool of your distribution could do the work for you.
  • Gnome: Computer->[System->]Controlcenter->[System->]Language
  • KDE: Start->System settings->Regional
  • At the shell prompt, merely execute
  • ‘setenv LANG de_DE’ (in csh),
  • ‘export LANG; LANG=de_DE’ (in sh) or
  • ‘export LANG=de_DE’ (in bash).
This can be done from your .login or .profile file, once and for all.
  • MacOS:
  • Mavericks (10.9): System Settings>Languages and Region
  • Snow Leopard (10.6) through Mountain Lion (10.8): System Settings>Languages and Text
  • Leopard (10.5): System Settings>International
  • Windows
  • 7: Start->Control Panel->[Clock, Language and Region->]Change display language. Check also the other tabs, esp. location.
  • Vista:

(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 localeenvironment variables with proper #IETF language tags, but the How depends on your operating system.

Basics

A few things, you should know ...

Language tags

There are at least 2 slightly different definitions of language tasks: 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 knows an additional modifier:

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

That will be used if e.g. different scripts are available like cyrillic vs. latin.

At least under Linux

locale

shows your current settings,

locale -a

gives you a list of the on your system installed locales and

locale -m

of the charmaps.

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 details.

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 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

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. You can set it to a colon separated list of language codes, which you prefer over english - the fallback if your languages are not found. E.g. set your system to

LANG=fy_NL 
LANGUAGE=fy:nl

if you are a westfrisian who prefers frisian and understands nederlands better than english.

gettext manual: The LANGUAGE variable

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,
  • formats of date and numbers,
  • 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

OS dependend tweaking

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
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".

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.

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 new 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 works, 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 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 -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 OS X 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.

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 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 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.

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 - in Microsoft locale names.

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

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 as administrator such that the last few lines are:

set LANG=nl_BE
set LANGUAGE=nl_BE
start gnucash-bin %*

Support State

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

Supported Languages

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

Program

You can easily see an probably 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:

Supported Regions

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

Improve them

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

Font Issues

(main section should be moved from FAQ#Q:_How_get_I_rid_of_strange_unreadable_characters_or_adjust_the_font_size

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.