Next: Customizing less, Previous: The --style option, Up: Colorizing
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
@import, in the case of
text output. (Actually, @imports are not yet supported in this case,
due to a limitation in libcroco.)
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.
.header.translated.untranslated.fuzzy.obsolete white-space
# translator-comments
#. extracted-comments
#: reference...
#, flag...
#| msgid previous-untranslated-string
msgid untranslated-string
msgstr translated-string
.comment.translator-comment.extracted-comment.reference-comment.reference.flag-comment.flag.fuzzy-flag.previous-comment.previousmsgid etc.) and the spaces between them.
.msgidmsgid etc.) and the spaces between them.
.msgstrmsgstr etc.) and the spaces between them.
.keywordmsgid, msgstr, etc.).
.string.text.escape-sequence.format-directivejava-format and csharp-format, with a ‘~’ in the case of
lisp-format and scheme-format, or with ‘$’ in the case of
sh-format).
.invalid-format-directive.added.changed.removedThese 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)font-weight (CSS2 spec, section 15.2.3)normal and bold. Values >= 600 are rendered as
bold.
font-style (CSS2 spec, section 15.2.3)italic and oblique are
rendered the same way.
text-decoration (CSS2 spec, section 16.3.1)none and
underline.