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 https://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 when they apply.
In PO files, the following simple selectors (based on "CSS classes", see the CSS2 spec, section 5.8.3) are supported.
.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).
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 (msgid etc.) and the spaces between them.
.msgidThis matches the untranslated string including the string delimiters,
the associated keywords (msgid etc.) and the spaces between them.
.msgstrThis matches the translated string including the string delimiters,
the associated keywords (msgstr etc.) and the spaces between them.
.keywordThis matches the keywords (msgid, msgstr, etc.).
.stringThis matches strings, including the string delimiters (double quotes).
.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-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-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: normal and bold. Values >= 600 are rendered as
bold.
font-style (CSS2 spec, section 15.2.3)This property is supported. The values italic and oblique are
rendered the same way.
text-decoration (CSS2 spec, section 16.3.1)This property is supported, limited to the values none and
underline.