| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.11.4 Style rules for PO files
The same style file can be used for styling of a PO file, for terminal output and for HTML output. It is written in CSS (Cascading Style Sheet) syntax. See http://www.w3.org/TR/css2/cover.html for a formal definition of CSS. Many HTML authoring tutorials also contain explanations of CSS.
In the case of HTML output, the style file is embedded in the HTML output.
In the case of text output, the style file is interpreted by the
msgcat program. This means, in particular, that when
@import is used with relative file names, the file names are
- - relative to the resulting HTML file, in the case of HTML output,
- -
relative to the style sheet containing the
@import, in the case of text output. (Actually,@imports are not yet supported in this case, due to a limitation inlibcroco.)
CSS rules are built up from selectors and declarations. The declarations specify graphical properties; the selectors specify specify when they apply.
In PO files, the following simple selectors (based on "CSS classes", see the CSS2 spec, section 5.8.3) are supported.
-
Selectors that apply to entire messages:
.headerThis matches the header entry of a PO file.
.translatedThis matches a translated message.
.untranslatedThis matches an untranslated message (i.e. a message with empty translation).
.fuzzyThis matches a fuzzy message (i.e. a message which has a translation that needs review by the translator).
.obsoleteThis matches an obsolete message (i.e. a message that was translated but is not needed by the current POT file any more).
-
Selectors that apply to parts of a message in PO syntax. Recall the general
structure of a message in PO syntax:
white-space # translator-comments #. extracted-comments #: reference… #, flag… #| msgid previous-untranslated-string msgid untranslated-string msgstr translated-string
.commentThis matches all comments (translator comments, extracted comments, source file reference comments, flag comments, previous message comments, as well as the entire obsolete messages).
.translator-commentThis matches the translator comments.
.extracted-commentThis matches the extracted comments, i.e. the comments placed by the programmer at the attention of the translator.
.reference-commentThis matches the source file reference comments (entire lines).
.referenceThis matches the individual source file references inside the source file reference comment lines.
.flag-commentThis matches the flag comment lines (entire lines).
.flagThis matches the individual flags inside flag comment lines.
.fuzzy-flagThis matches the ‘fuzzy’ flag inside flag comment lines.
.previous-commentThis matches the comments containing the previous untranslated string (entire lines).
.previousThis matches the previous untranslated string including the string delimiters, the associated keywords (
msgidetc.) and the spaces between them..msgidThis matches the untranslated string including the string delimiters, the associated keywords (
msgidetc.) and the spaces between them..msgstrThis matches the translated string including the string delimiters, the associated keywords (
msgstretc.) and the spaces between them..keywordThis matches the keywords (
msgid,msgstr, etc.)..stringThis matches strings, including the string delimiters (double quotes).
-
Selectors that apply to parts of strings:
.textThis matches the entire contents of a string (excluding the string delimiters, i.e. the double quotes).
.escape-sequenceThis matches an escape sequence (starting with a backslash).
.format-directiveThis matches a format string directive (starting with a ‘%’ sign in the case of most programming languages, with a ‘{’ in the case of
java-formatandcsharp-format, with a ‘~’ in the case oflisp-formatandscheme-format, or with ‘$’ in the case ofsh-format)..invalid-format-directiveThis matches an invalid format string directive.
.addedIn an untranslated string, this matches a part of the string that was not present in the previous untranslated string. (Not yet implemented in this release.)
.changedIn an untranslated string or in a previous untranslated string, this matches a part of the string that is changed or replaced. (Not yet implemented in this release.)
.removedIn a previous untranslated string, this matches a part of the string that is not present in the current untranslated string. (Not yet implemented in this release.)
These selectors can be combined to hierarchical selectors. For example,
.msgstr .invalid-format-directive { color: red; }
will highlight the invalid format directives in the translated strings.
In text mode, pseudo-classes (CSS2 spec, section 5.11) and pseudo-elements (CSS2 spec, section 5.12) are not supported.
The declarations in HTML mode are not limited; any graphical attribute supported by the browsers can be used.
The declarations in text mode are limited to the following properties. Other properties will be silently ignored.
color(CSS2 spec, section 14.1)background-color(CSS2 spec, section 14.2.1)These properties is supported. Colors will be adjusted to match the terminal’s capabilities. Note that many terminals support only 8 colors.
font-weight(CSS2 spec, section 15.2.3)This property is supported, but most terminals can only render two different weights:
normalandbold. Values >= 600 are rendered asbold.font-style(CSS2 spec, section 15.2.3)This property is supported. The values
italicandobliqueare rendered the same way.text-decoration(CSS2 spec, section 16.3.1)This property is supported, limited to the values
noneandunderline.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 27, 2013 using texi2html 5.0.
