# Preferences

## Global and project settings

From KBabel 1.10 (KDE 3.4) on, KBabel has the concept of projects and therefore the settings have been split in two categories: the global settings and the project settings (also called project configuration).

&GNU; gettext uses a term called "project", which has nothing to do with KBabel's projects. &GNU; gettext means by project an application which is related to the PO file. For KBabel, a project is much bigger. It can mean a set of applications, like &kde;.

KBabel has always a current project, even if it is the default project. KBabel has not mode without any project. A project is always for KBabel's editor and KBabel's catalog manager.

### Known limitations of the current implementation

Unfortunately the current implementation of projects has a few known problems.

An example is that in the global settings, there is no setting for the default user, his/her default language and other similar important global user data. It means that such data must be entered again each time that a new project is created.

Another problem is the new project wizard. It does not ask enough information, especially it fails to ask for the team email address. So it is recommended to check the project settings after having run the wizard.

Currently you cannot copy projects from inside KBabel, so apparently you cannot easily share good settings. However you are free to copy the project outside KBabel and to load the copied project into KBabel.

### Using KBabel for non-&kde; projects

While &kbabel;'s defaults are oriented toward working with and for &kde;, &kbabel; can be used to translate PO files of other projects. However mostly you will have to tweak the settings to the need of your project. This is especially true for &GNU; and &GNU;-like projects, which need quite different defaults than for &kde;.

One problem is that &kbabel; is relatively agressive when saving PO files and replaces setting of the PO files by settings of the projects, if not told otherwise. This might look very strange to somebody not used to &kde;. However &kde; has 900+ POT files to translate for the GUI messages only. So for such a task, much automatisation is wanted. Taking time to set a project is little compared to the time gained thereafter. Of course, as non-&kde; user, you might be less fortunate. You need to do more settings, as the defaults are not entirely suitable and you will not gain much by doing many translations, as &GNU; projects have typically only one POT file to translate.

## &kbabel; global settings

To show the Preferences dialog choose Settings Configure KBabel... from &kbabel;'s menu. It uses a structured configuration dialog which makes it very easy to find an option without having to perform an extensive search for it.

### Edit

The editor preferences category is divided in 3 subwindows: General, Appearance, Spell Check and Fonts. All these settings customize how the editor behaves and looks.

#### General

Dialog Edit General Dialog Edit General

This section contains a set of checkboxes.

The first checkbox in the upper side sets if the fuzzy status is reset automatically when a character is inputted into the MsgStr editor. When this option is disabled you have to manually choose Edit Unset Fuzzy Status or use the &Ctrl;U shortcut. Note that this means the string `, fuzzy` is removed from the entry's comment.

Next option allows you to enable clever editing, where editor automatically inserts special characters escaped correctly, ⪚ `\t` after pressing Tab and it allows special handling of Enter.

The lower checkboxes are very useful in assisting, not for the correctness of the translation, but if the translated string is a suitable replacement for the original. For example, many messages represent menu items with keyboard accelerator and C-like formatted strings whose structure must remain intact once translated.

Check Arguments

- When this option is selected, C-format strings in the original and the translation are checked to ensure the number of format sequences and the order are consistent.

Check Accelerator

- When this option is selected, &kbabel; checks if the number accelerator characters is identical in both the original and the translated string. Note that accelerator marker is & (but not in every programming toolkit). See the Miscellaneous section below to find how to change a keyboard accelerator.

Check Equation

- This is a feature for the &kde; project development. `.desktop` files are simply text files which store various parameters in `value=key` format. Some of these `key`s are translatable. The only restriction is to maintain the left side of equality unchanged. Equation check allows you to spot many errors determined by the fuzzy `msgmerge` algorithm. Note that there are situations where this function generates false errors on some PO-files.

Look for Translated Context Info

- Some original messages are marked with context information to mark them as being unique even if they represent same word. This is because many simple words, such as Save, are translated into many languages. Context information is marked with `_:`. Many unexperienced translators translate the context information and fill their PO files with garbage. Check this box to make sure you will be warned about these errors in a file.

Check Plural Forms

- If you are translating &kde; project, it uses a special kind of syntax for specifying plural forms of messages. This check automatically counts the number of forms in msgstr and compares it with the number specified in Identity tab. Incorrect number of plural forms can result in crash of an application.

Beep on error

- Your system bell will beep when you switch on entries with errors like those described above.

Change text color on error

- This is another type of warning about errors in current message. It is a good solution for those who are hearing impaired or dislike bell noise. See also the Appearance tab to find out how to change the text color on errors.

#### Appearance

Dialog Edit Appearance Dialog Edit Appearance

These options let you configure the appearance for the message editor. In upper part there are 4 checkboxes:

Highlight syntax

- Setting this option will enable syntax highlighting for special characters, accelerators and text background in the msgid viewer and msgstr editor. If don't have a monochrome display or have a visual impairment, you should enable this option.

Highlight background

- The background will be highlighted only for existing characters in the msgid and msgstr. This includes spaces. This is useful if you don't want to see the surrounding quotes (see below) for the PO entry, and you will still be able to observe starting and ending spaces in a text line.

Mark whitespaces with points

- When you feel the need to count spaces and background highlighting is not your taste then you can check this option to have a point sign drawn in the middle of whitespace characters. Note that the point is a point sign in the center of a character box and is not a decimal point.

Show surrounding quotes

- If you think that viewing the terminal characters in msgstr or msgid's text line is better for you then check this option to view the surrounding quotes for every text line.

  If you are experienced editing PO files with ordinary text editors you may feel safer if you can track starting and ending double quotes in PO entry lines.

For the different items in edited text there are different color choices to make editing easy. Colors can be changed by clicking on color-picker buttons. From the 'select color' dialogs you can choose from standard colors, custom colors or just pick a color from any part of your screen.

Background color

- This sets the background color for characters in the MsgID view and the MsgStr editor. To change the general background color of edit boxes you must use the &kcontrolcenter;.

Color for quoted characters

- Here you can adjust the color for escaped characters like (`\"`) double quotes or (`\n`) newline.

Color for syntax errors

- This is the color for the entire text entry if errors are detected when you try to save PO file. Errors are triggered by not terminating identically both msgid and msgstr, or escaping characters incorrectly.

Color for c-format characters

- This sets the color for a characters sequence like in C language `printf` or `scanf` functions. In general these start with (`%`) percent char and are continued by one char.

Color for keyboard accelerators

- Keyboard accelerators start with (&) ampersand character in &kde; but if you are translating for other projects there might be an different character marking the accelerator key. See Miscellaneous section below to find how to change keyboard accelerator.

The status for the current edited entry is marked by three LEDs. For your convenience you can choose where to put these LEDs—either on the statusbar or in the editor section (between the msgid and msgstr entry). If have difficulties viewing some colors or you want to be able to track LED status changes easily without moving your eye you can select the preferred color using the color button chooser.

### Search

Dialog Search Dialog Search

The search section allows you to customize various settings for searching in previously translated strings.

General settings are common for all search types. If you check the Automatically start search option then the search is automatically started whenever you switch to another entry in the editor. Currently, there are three possibilities you can choose from, but since &kbabel; can use dictionary plugins the available dictionaries depend on those installed. Using Settings Configure Dictionary ... you can configure every search plugin.

The dictionary plugins installed by default are:

&kde; Database Search Engine

- This new method is still in alpha stage of development and is based on &kbabeldict; which accompanies &kbabel;. See &kbabeldict; documentation for further info on configuring the search engine.

PO Compendium

- The compendium is a normal PO file, which should contain a list of standard translations from your translation team. If you don't have one, you can also use a file that contains all the translations from your team (⪚ the `$lang.messages` file in the &kde; Project, that can be found at i18n.kde.org).

PO Auxiliary

- The auxiliary should help you find the context of a translation by looking up the same message in a message catalog of the same package but translated to another language. This way you can have a look how this message is translated in another language.

You can also start searching manually by choosing an entry in the popup menu that appears, either by clicking Dictionaries Search Text PO Compendium or by keeping the search button on the toolbar pressed down for a while.

### Diff

Dialog Diff Dialog Diff

The Diff section holds settings how to display differences in msgids.

Every difference can be displayed by two added parts and by characters removed from the text. For both you can specify the method of display and the color to be used. Highlighted means that the background of the corresponding characters will be shown in the selected color, while Underlined(for added characters) or Stroked Out (for removed characters) will denote the changed parts by colored lines.

Diff mode needs to find the original msgid to compare with. For this purpose, &kbabel; can use the translation database if you turn in on by enabling Use messages from Translation Database. A second possibility is to use a tree of original PO files and specifying the root of the tree in Base folder for diff files.

### Fonts

Dialog Fonts Dialog Fonts

This is a standard &kde; font chooser dialog with a little addition. You can select to view only fixed fonts by checking the Show only fixed fonts option. This is highly recommended for easy translating. The font dialog lets you set font family, style, size and encoding. The bottom box shows a preview of the current font for user convenience.

## New Project Wizard

### Page 1

Project Wizard Page 1 Project Wizard Page 1

The first page of the wizard ask about the basic data of the project.

Project name

- Enter here the name of the project, as it will be displayed in &kbabel;'s menu.

Configuration file name

- Select here a file for holding your project settings.

Language

- Select or enter here the language name used by this project.

Project type

- Select here the type of your project.

### Page 2

Project Wizard Page 2 Project Wizard Page 2

The second page of the wizard asks about settings related to the Catalog Manager.

Base folder for PO files

- Select the base folder where your PO files are.

Base folder for POT files

- Select the base folder where your POT files are.

Type in or select the folders that contains all your PO and respectively POT files. The files and the folders in these folders will then be merged into one tree in &catalogmanager; window.

### Checking Project Stettings

As written earlier in this chapter, unfortunately the wizard is very simple and therefore fails to ask for some important settings.

Now that you have finished your new project, you should verify the main settings in Project Configure.... Especially select the Identity page and fix the team email address in Language mailing list. (The default one created by the wizard from the language setting is only useful if you are part of a &GNU; project.)

If the project settings are not for KDE, it is recommended that you check the Save page and checks the settings there.

## Project Settings

To show the project setting dialog choose Project Configure... from &kbabel;'s or &catalogmanager;'s menu. It uses a structured configuration dialog which makes it very easy to find an option without having to perform an extensive search for it.

The left side of the preferences dialog lists the categories of customizable items and the right side shows the corresponding tab for the selected category. &kbabel; keeps changes if you move between categories, so when you're finally happy click the OK button. At any time you can use quick help—just click on the question mark on the title bar and, after the cursor has changed to an arrow with a question mark, click on a button, label, or preference entry to find out more about it.

Pages for settings for &kbabel; (the editor) and for &catalogmanager; are in the list.

### Identity

These settings are for &kbabel;.

This section allows you to set standard fields for every translated PO file. These are your name, email address, full language name, email address for your translation team mailing list. There is also a timezone field to track your last modified time for PO files. You can specify it as character sequence like EEST or offset from GMT time like +0200 (&ie; for Romania). This information is used when updating file headers. You can find the options that control what fields in the header should be updated in the Save section of the Preferences dialog.

Character sequences for timezones are not standardized. So you should not use the string set here in time specification for saving in Save tab. You should use `%z` instead.

Number of singular/plural forms

- Use this for setting number of plural forms for your language. For example, it is 2 for German (one for the singular and one for the plural form).

  This feature is currently implemented only for plural forms format used in &kde;. It does not work with &GNU; gettext plural forms.

### Save

These settings are for &kbabel;.

This section allows you to edit the options for PO file saving. The first group of checkboxes controls general behavior for actions performed in PO file saving.

Update header when saving

- Check this button, to update the header information of the file every time it is saved. The header normally keeps information about the date and time the file was last updated,the last translator etc. You can choose which information you want to update from the Fields to update checkboxes area below. Fields that do not exist are added to the header. If you want to add additional fields to the header you can edit the header manually by choosing Edit Edit Header in the editor window.

Check syntax of file when saving

- Check this to automatically check syntax of file with ``msgfmt` --statistics` when saving a file. You will only get a message if an error occurred. You should keep this validation enabled unless you know what you are doing.

If you do not want to touch some fields in a PO file header or want to force updating of specific fields, there are five checkboxes which control this: revision date, PO file language, text encoding, last translator name, charset. If a field does not exist, it is appended to the header. If you want to add other information to the header, you have to edit the header manually by choosing Edit Edit Header in the editor window. Deactivate Update header when saving above if you don't want to have the header updated.

For date and time of the header field PO-Revision-Date you can choose one of the formats: Default, Local, Custom.

You should keep the default setting of Default. The two other settings make that the generated PO file is not a standard &GNU; gettext PO file anymore, so this should be avoided.

- Default is the format normally used in PO files.

- Local is the format specific to your country.

- Custom lets you define your own format, where you can use the following C-like format strings:

  ### Year

  Format | Meaning | Range
  %y | year | 00 to 99
  %Y | year | 0001 to 9999

  ### Month

  Format | Meaning | Range
  %m | month of year | 01 to 12
  %f | month of year | 1 to 12
  %b,%h | month abbreviation | Jan to Dec

  ### Day

  Format | Meaning | Range
  %j | day of the year | 001 to 366
  %d | day of month | 01 to 31
  %e | day of month | 1 to 31
  %a | weekday abbreviation | Sun to Sat

  ### Hour

  Format | Meaning | Range
  %H | hour | 00 to 23
  %k | hour | 0 to 23
  %i | hour | 1 to 12
  %I | hour | 01 to 12
  %p |  | AM or PM

  ### Minute, Second, Timezone

  Format | Meaning | Range
  %M | minute | 00 to 59
  %S | second | 00 to 59
  %Z | timezone | (given in identity settings)
  %z | timezone | (numeric offset as specified by system settings)

The option to select the date format for the PO file is considered to be deprecated, and will probably be removed in a future version of KBabel.

The lower group covers encoding options for PO files when saving. If you work on the &kde; project you should be aware that at least PO files must be UTF-8 encoded in &kde;. Alternatively you can select the encoding corresponding to your locale. If, for some reason, you do not want to accidentally change the current PO file encoding, turn on Keep the encoding of the file.

For reason of informtation interchange, &GNU; gettext limits the encodings allowed for a PO file. &kbabel; does not know of this restriction, so the encoding correspondig to your locale might not be suitable. (UTF-8 is always supported by &GNU; gettext.)

### Spell Check

These settings are for &kbabel;.

Here you can set your spell checking preferences. This is of interest if you have a dictionary file for the language you are translating to. Below are the items to consider setting:

Create root/affix combinations not in dictionary

- For new words added to the personal dictionary, the spell checker will create root/affix combinations to match more than one word (variations).

Consider run-together words as spelling errors

- If this is turned on, joined words will be treated as errors. However, such words are very common in the German language, which have a very large number of compound words, so it should be left turned off in that case.

Dictionary

- From the popup list you can choose which dictionary to use. Note that you must install an appropriate dictionary for your language. Check your ispell or aspell distribution to find out if you have one.

Encoding

- Here you choose the encoding for your text. This option is passed to the spellchecker, and is used as the encoding for your words dictionary. See the kspell documentation for more details.

  The encoding selected here is not linked to encodings of the PO files. Depending on the spellchecker (especially in the case of `ispell`), you might not have much choice for the encoding. (For example, a few Western European languages can only work with `ispell` when using ISO-8859-1.)

Client

- Backend program to use for spell checking. Currently either `ispell` (International Ispell) or aspell.

Remember ignored words

- Keep track of user-ignored words when spell-checking PO files. It is very convenient to ignore the abbreviations or strange letter combinations you meet in &GUI; interfaces.

File to store ignored words

- Here you can set location of the file for ignored words. Click on the folder icon to the right of the edit box. The default is `$`HOME`/.kde/share/apps/kbabel/spellignores`, where `$`HOME`` is your home folder.

### Source reference

These settings are for &kbabel;.

Project Settings, source reference Project Settings, source reference

This dialog is for setting how KBabel should construct the full path from each source references, which are in the comments of each entry of a PO file.

#### Dialog elements

In the edit line Base folder for source code, you can set a base folder where the source code of your project is. This defines the value of the variable `@CODEROOT@`, which is described below.

In the group Path Patterns, you can define patterns or rules to construct the paths with the help of a few variables: `@CODEROOT@`, `@PACKAGEDIR@`, `@PACKAGE@`, `@COMMENTPATH@`, `@POFILEDIR@`, which are defined below.

The variable `@PODIRFILE@` was introduced in &kbabel; version 1.11.1 (for &kde; 3.5.1).

With the button Add, you can add the line from the text box to the list of used path patterns. With the button Remove, you can remove the selected pattern from the list. With the buttons Up and Down, you can change the priority of the path patterns.

#### The variables

- `@CODEROOT@`: The base folder of the source code.

- `@PACKAGEDIR@`: The folder of the package (i.e. PO file).

- `@PACKAGE@`: The package name (i.e. PO file name without extension).

- `@POFILEDIR@`: The folder of the PO file.

- `@COMMENTPATH@`: The relative path given as source reference in the comment of an entry of the PO file.

The variables `@PACKAGEDIR@` and `@POFILEDIR@` have similar meaning but not the same result. The variable `@POFILEDIR@` will always hold the folder of PO file, `@PACKAGEDIR@` might not. If the PO file was loaded by the help of the &catalogmanager; then `@PACKAGEDIR@` has only the part of the path, based on the PO base path defined for the &catalogmanager; (see below).

The variables `@CODEROOT@` and `@POFILEDIR@` can only be used at the beginning of a pattern to be useful. The variable `@COMMENTPATH@` can only be used at the end of a pattern and is nearly mandatory. The variables `@PACKAGEDIR@` and `@POFILEDIR@` should not be used in the same pattern. The variables `@CODEROOT@` and `@POFILEDIR@` should not be used in the same pattern either.

#### The default path patterns

From &kbabel; 1.11.1 (of &kde; 3.5.1) on, there are five default path patterns:

- `@PACKAGEDIR@`/`@PACKAGE@`/`@COMMENTPATH@`

- `@CODEROOT@`/`@PACKAGEDIR@`/`@PACKAGE@`/`@COMMENTPATH@`

- `@CODEROOT@`/`@PACKAGE@`/`@COMMENTPATH@`

- `@POFILEDIR@`/`@COMMENTPATH@`

- `@POFILEDIR@`/../`@COMMENTPATH@`

&kde; projects need typically the third pattern. The last pattern is typical for &GNU; projects, where the source references are related to the parent of the directory where the PO file is.

#### Creating New Path Patterns

In most cases the default path patterns should be enough, whatever the project is for KDE (assuming that you have set the correct base directory) or if the project is a &GNU; one (or structured like a &GNU; project).

For &kde;, some PO files do not contain enough information (including the file path and name) for &kbabel; to find the right source file that is supposed to be refered. To fix that you would need precise path patterns for such files, which is nearly impossible to define by the numbers of such files in &kde;. But if you work often with such a file, may be it is worth to set a path pattern explicitely for supporting that PO file.

For creating your own path patterns, you can use the variables defined above, but apart `@COMMENTPATH@` not any variable is mandatory to use. (To be exact, `@COMMENTPATH@` is not mandatory either, but not using it will probably lead to no result.)

An example of path pattern could be that you want to display the source reference of &kde;'s file desktop_kdebase.po. In that case you will probably need a path pattern like: `@CODEROOT@`/`@PACKAGEDIR@`/kdebase/`@COMMENTPATH@` (compared to one of the default path patterns, the sequence `@PACKAGE@` has been replaced by kdebase).

In case of really complex problems you can, of course, define an absolute path without any variables beside `@COMMENTPATH@`, like for example: /home/usr/kde-source/kdebase/`@COMMENTPATH@` assuming that /home/usr/kde-source/kdebase is the path where the kdebase source module is.

### Miscellaneous

These settings are for &kbabel;.

Miscellaneous section holds &kbabel; settings that do not fit anywhere else.

Marker for keyboard accelerator

- Here you can select your own character to serve as the keyboard accelerator indicator in a &GUI;. By default it is & (ampersand), but in some programming toolkits it may vary. For example, in Gnome/GTK translations the underscore character _ is the marker for the keyboard accelerator.

Regular expression for context information

- For inexperienced users "regular expression" may sound strange. So you are advised to change the default value only if you know what you are doing. Some &GUI; programming toolkits provide their own context information description methods. Consult an experienced developer if you translate PO files other than standard &kde; files. For the sake of completeness I will "translate" for you what the default regular expression means: "the text matches if it starts with _: and is followed by one or more characters and ends with a newline".

### Project folders

These settings are for &catalogmanager;.

Here are two edit lines with folder buttons. Type in or select the folders that contains all your PO and respectively POT files. The files and the folders in these folders will then be merged into one tree in Catalog Manager window.

Below you can turn on and off if:

Open files in new window

- If this is activated all files that are opened from the Catalog Manager are opened in a new window.

Kill processes on exit

- If you check this, &kbabel; tries to kill the processes that are not exited already when the program closes by sending a kill signal to them.

  It's not guaranteed that the processes are killed.

Create index for file contents

- If you check this, &kbabel; will create an index of contents for every file in the tree. This index is then used in find/replace operations.

  There is a large speed trade-off. If you enable Create index for file contents, the updating of file information will be much slower. On the other hand, it speeds up find/replace operations considerably.

### Folder Commands

These settings are for &catalogmanager;.

Project Settings,folder commands Project Settings, folder commands

Here you can insert commands you want to execute in folders from the Catalog Manager. The commands are then shown in the submenu Commands in the Catalog Manager's context menu.

Insert in the Command Label field the label of the command. The label can be chosen freely and is only used to be displayed in the menu. In the Command field insert the command you want to have executed when selecting the corresponding menu item. Then press the Add button to add the command to your available commands. To edit a command, select it, press the Edit button and press Add after you have finished. To remove a command, select it from the list and press the Remove button. If you want a different order in the contextual submenu, you can use the up and down buttons.

The command is executed through your default shell, so you can execute multiple commands at once by separating them with a semicolon, and you can set environment variables if you need to. The commands are executed in the (PO file) folder you have selected in the Catalog Manager.

The following strings will be replaced in a command:

- `@PACKAGE@`: The name of the folder without path

- `@PODIR@`: The name of the PO-folder with path

- `@POTDIR@`: The name of the template folder with path

E.g.: If you want to execute `make` and then `make install` you could insert in `Make install` in the Name field, and `make; make install` in the Command field. If you then select Commands Make install from the context menu of a folder, the commands listed above will be executed in that folder.

### File Commands

These settings are for &catalogmanager;.

Project Settings, file commands Project Settings, file commands

Here you can insert the commands you want to execute on files from the Catalog Manager. The commands are then shown in the submenu Commands in the Catalog Manager's context menu.

Insert in the Command Label field the label of the command. The label can be chosen freely and is only used to be displayed in the menu. In the Command field insert the command you want to have executed when selecting the corresponding menu item. Then press the Add button to add the command to your available commands. To edit a command, select it, press the Edit button and press the Add button after you have finished. To remove a command, select it from the list and press the Remove button. If you want a different order in the contextual submenu, you can use the up and down buttons.

The command is executed through your default shell, so you can execute multiple commands at once by separating them with a semicolon, and you can set environment variables, if you need. The commands are executed in the (PO file) folder, in which the file, you have selected in the Catalog Manager, is.

The following strings will be replaced in a command:

- `@PACKAGE@`: The name of the file without path and extension

- `@POFILE@`: The name of the PO file with path and extension

- `@POTFILE@`: The name of the corresponding template file with path and extension

- `@PODIR@`: The name of the folder the PO file is in, with path

- `@POTDIR@`: The name of the folder the template file is in, with path

For example, if you want to merge the template file into your PO file you could insert `Merge` in the Name field and `msgmerge @POFILE@ @POTFILE@ > @PACKAGE@.new && mv @PACKAGE@.new "@PACKAGE@.po` in the Command field. If you then select Commands Merge from a file's context menu, the PO file will be merged with its template file.

### Catalog Manager

These settings are for &catalogmanager;.

Project Settings, &catalogmanager; Project Settings, &catalogmanager;

The checkboxes switches on or off the corresponding column of the &catalogmanager;'s view.

### Diff

These settings are for &catalogmanager;.

Project Settings, diff Project Settings, diff