Preprocessing has failed.
" "Please check your bracketed images stack.
" "Click \"Details\" to show processing details.
") ~~~ `` tags could be avoided by splitting this message into one message per sentence, but this should not be done, because paragraphs should be translated as single units of meaning. Another important point about XML-like text markup, is to try and keep it well-formed in XML sense on the level of standalone message. For example: ~~~ // BAD (for translation, although fine by HTML / Qt rich text): i18n("
Some sentence." "
Another sentence."); // Good: i18n("
Some sentence.
" "Another sentence.
"); ~~~ Well-formedness is good because the most frequent error in translation in presence of markup is mistyping (or miscopying) a tag. If the original text is well-formed, a translation checker tool can require the same of translation, and signal when that is not so. The previous example of non-well-formedness was perhaps trivial; in practice, non-trivial examples usually break some other rules too (e.g. no word puzzles). ### Writing Good Contexts The message context, given as first argument in `*i18nc` calls, is of great help to translators. Unfortunately, to a programmer it is not always clear when a context is needed, or what it should state. So, the very first rule of writing good contexts is to *listen to the translators asking for contexts*. When taking suggestions from translators, there is no need to worry if the proposed context will be sufficient for "all" languages. It is fine to simply add the information that a translator into particular language requested, and wait for translators into other languages to maybe request some other context information as well. Having said this, some apriori guidelines on contexts can be followed. Since in English the form of an adjective does not change based on the gender of the noun it modifies, properly translating messages which are single standalone adjectives will be impossible in many languages without a context. So, in general, every message which is a standalone adjective should have context: ~~~ i18nc("new file", "New"); i18nc("default action", "Default"); ~~~ Lists of related items typically benefit from having the same context, since they should all be translated in the same style: ~~~ i18nc("IPv4 configuration method", "Automatic (VPN)"); i18nc("IPv4 configuration method", "Automatic (VPN) addresses only"); i18nc("IPv4 configuration method", "Automatic (PPP)"); i18nc("IPv4 configuration method", "Automatic (PPP) addresses only"); ... ~~~ When there are placeholders in the text for which it is not clear, from the text alone, what kind of argument they represent, this should be explained in the context: ~~~ i18nc("%1 old file path, %2 new file path", "Cannot move '%1' to '%2'.", oldPath, newPath); i18nc("%1 track URL, %2 artist name", "%1 (by %2)", trackUrl, artistName); ~~~ It is frequently suggested to state in the context the grammar category of the message text, such as "this is a verb" or "this is a noun". Since the grammar category of the translation does not have to be the same as that of the original, this kind of context provides circumstantial information at best (see the section [User Interface Markers](#uimark_ctxt) for what translators may use it to draw some real information about), and is worthless at worst. Also, due to relative absence of declension in English grammar, different programmers may have different opinion on the grammar category: the menu title "View", is it a verb or a noun? #### User Interface Markers In the same way there exists a HIG (Human Interface Guidelines) document for the programmers to follow, translators should establish HIG-like convention for their language concerning the forms of UI text. Therefore, for a proper translation, the translator will need too know not only what does the message mean, but also where it figures in the UI. E.g. is the message a button label, a menu title, a tooltip, etc. To this end a convention has been developed among KDE translators, which programmers can use to succinctly describe UI usage of messages. In this convention, the context string starts with an *UI marker* of the form `@| Major | Minor | Description |
|---|---|---|
| \@action5.0 | Labels of clickable widgets which cause an action to be performed. | |
| :button5.0 | Push buttons in windows and dialogs. | |
| :inmenu5.0 | Menu entries that perform an action (as opposed e.g. to being checked). | |
| :intoolbar5.0 | Toolbar buttons. | |
| \@title5.0 | Text that is the title of a major UI element or a widget container. | |
| :window5.0 | Title of a window or a (dockable) view/pane. | |
| :menu5.0 | Menu title. | |
| :tab5.0 | Tab name. | |
| :group5.0 | Title to a group of widgets, like a group of checkboxes or radio buttons. | |
| :column5.0 | Column name in a table header, e.g. in a table view widget. | |
| :row5.0 | Row name in a table. | |
| \@option5.0 | Labels of option selection widgets, which can be enable/disabled or selected between. | |
| :check5.0 | Checkbox label, also a checkable menu entry. | |
| :radio5.0 | Radio button label. | |
| \@label5.0 | Various widget labels which are not covered by any of \@action, \@title, or \@option. | |
| :slider5.0 | Slider label. | |
| :spinbox5.0 | Spinbox label. | |
| :listbox5.0 | Label to a list box or combo box. | |
| :textbox5.0 | Label to a text box or text edit field. | |
| :chooser5.0 | Label to any special-purpose chooser widget, like color chooser, font chooser, etc. | |
| \@item5.0 | Strings that are items from a range of possibilities or properties of a given type. | |
| :inmenu5.0 | Item presented in menu (e.g. sort ordering, encoding name, etc). | |
| :inlistbox5.0 | Item presented in a list or combo box. | |
| :intable5.0 | Item presented in a table cell. | |
| :inrange5.0 | End range labels, e.g. on sliders. | |
| :intext5.0 | Words and short phrases which are inserted into a larger piece of text. | |
| :valuesuffix5.46 | Suffix appended to a value, including any spacing (e.g. in a spinbox). | |
| \@info5.0 | Any transient information for the user. | |
| :tooltip5.0 | Expanded formulation of the widget's label, usually appearing automatically when the pointer hovers over the widget. | |
| :whatsthis5.0 | Longer description of a widget's purpose and behavior, usually manually called up by the user. | |
| :placeholder5.46 | A hint what input is expected in an input field, shown in the place of the input where there is none yet. | |
| :status5.0 | A piece of text displayed in application's status view (e.g in the status bar). | |
| :progress5.0 | Text describing the current step or state of an operation, possibly periodically updating. | |
| :usagetip5.0 | A tip that comes up to inform the user about
a certain possibility in a given context,
e.g. a "tip of the day" on application startup. Deprecated synonym: :tipoftheday. | |
| :credit5.0 | Contributor names and their contributions, e.g. in the about dialog. | |
| :shell5.0 | A note, warning or error sent to application's text output stream (stdout, stderr) rather than shown in the UI. |
| UI Marker | Visual Format |
|---|---|
| (none) | plain |
| \@action:\ |
plain |
| \@title:\ |
plain |
| \@option:\ |
plain |
| \@label:\ |
plain |
| \@item:\ |
plain |
| \@info, \@info:tooltip, \@info:whatsthis, \@info:usagetip | rich |
| \@info:status, \@info:progress, \@info:credit | plain |
| \@info:shell | term |
Task state:
" // "On indefinite hold.
" ~~~ If the argument and the text have different visual formats implied by their UI markers, the outermost format overrides inner formats. ### Predefined Tags All KUIT tags belong to one of the two classes: - phrase tags, which describe parts of sentences or whole sentences inserted into running text; - structuring tags, which split text into paragraph-level blocks. A text without any structuring tags is considered equivalent of one paragraph or sub-paragraph sentence or phrase. If at least one structuring tag appears in the text, then the text is considered multi-paragraph, and no content may appear outside of structuring tags. For example: ~~~ // Good: i18nc("@info", "You can configure the history sidebar here."); // BAD: xi18nc("@info", "| Phrase Tags |
|---|
|
\ Name of an application. ~~~ xi18nc("@action:inmenu", "Open with |
|
\ Line-breaking body of code, for short code or output listings. ~~~ xi18nc("@info:whatsthis", "You can try the following snippet: |
|
\ Attributes: section=5.0 Name of a shell command, system call, signal, etc. Its man section can be given with the `section=` attribute. ~~~ xi18nc("@info", "This will call |
|
\ Attributes: address=5.0 Email address. Without attributes, the tag text is the address. If the address is explicitly given with the `address=` attribute, the tag text is the name or description attached to the address. In rich text, the phrase will be hyperlinked. ~~~ xi18nc("@info", "Send bug reports to |
|
\ Attributes: strong=5.0 Emphasized word or phrase in the text. For strong emphasis, attribute `strong=` can be set to `[1|true|yes]`. |
|
\ Environment variable. A `$`-sign will be prepended automatically in formatted text. ~~~ xi18nc("@info", "Assure that |
|
\ Subtags: \ File or folder name or path. Slash (/) should be used as path separator, and it will be converted into native separator for the underlying platform. ~~~ xi18nc("@info", "Cannot read |
|
\ Subtags: \ Inline code, like a shell command line. ~~~ xi18nc("@info:tooltip", "Execute |
|
\ Path to a graphical user interface element. If a path of UI elements is needed, elements should be separated with `|` or `->`, which will be converted into the canonical separator. ~~~ xi18nc("@info:whatsthis", "If you make a mistake, click " " |
|
\5.0 Attributes: url=5.0 Link to a URL-addressable resource. Without attributes, the tag text is the URL; alternatively, the URL can be given by `url=` attribute, and then the text serves as description. Separate URL and description are preferred if applicable. The phrase will be hyperlinked in rich text. ~~~ xi18nc("@info:tooltip", "Go to %1 website.", urlKDE); xi18nc("@info:tooltip", "Go to the KDE website.", urlKDE); ~~~ |
|
\ Subtags: all phrase tags An external message inserted into the text. ~~~ xi18nc("@info", "The fortune cookie says: |
|
\ Line break. ~~~ xi18nc("@info", "The server replied: |
|
\ Attributes: label=5.0 Subtags: all phrase tags The sentence is a side note related to the topic. Prefix "Note:" will be added automatically; another prefix can be set with attribute `label=`. ~~~ xi18nc("@info", "Probably the best known of all duck species is the Mallard. " "It breeds throughout the temperate areas around the world. " " |
|
\ A placeholder text. It could be something which the user should replace with actual text, or a generic item in a list. ~~~ xi18nc("@info", "Replace |
|
\ Combination of keyboard keys to press. Key names should be separated by "+" or "-", and the shortcut will be converted into canonical form. ~~~ xi18nc("@info:whatsthis", "Cycle through layouts using |
|
\ Attributes: label=5.0 Subtags: all phrase tags The sentence is a warning. Prefix "Warning:" will be added automatically; another prefix can be set with attribute `label=`. ~~~ xi18nc("@info", "Really delete this key? " " |
| Structuring Tags |
|
\ Subtags: all phrase tags A list item. |
|
\ Subtags: \ List of items. List is considered an element of the paragraph, so `
|
|
\ Subtags: all phrase tags, \ One paragraph of text. |
|
\ Subtags: all phrase tags The subtitle of the text. Must come after ` |
|
\ Subtags: all phrase tags The title of the text. Must be the first tag in the text if present. |
| Entity | Expansion |
|---|---|
| < | less-than (\c <) |
| > | greater-than (\c >) |
| & | ampersand (\c &) |
| ' | single quote (\c ') |
| " | double quote (\c ") |
| Entity | Expansion |
|---|---|
| 5.0 | non-breaking space (\c ) |