gettext: Style rules
1
1 9.11.4 Style rules for PO files
1 -------------------------------
1
1 The same style file can be used for styling of a PO file, for
1 terminal output and for HTML output. It is written in CSS (Cascading
1 Style Sheet) syntax. See <http://www.w3.org/TR/css2/cover.html> for a
1 formal definition of CSS. Many HTML authoring tutorials also contain
1 explanations of CSS.
1
1 In the case of HTML output, the style file is embedded in the HTML
1 output. In the case of text output, the style file is interpreted by
1 the ‘msgcat’ program. This means, in particular, that when ‘@import’ is
1 used with relative file names, the file names are
1
1 − relative to the resulting HTML file, in the case of HTML output,
1
1 − relative to the style sheet containing the ‘@import’, in the case
1 of text output. (Actually, ‘@import’s are not yet supported in
1 this case, due to a limitation in ‘libcroco’.)
1
1 CSS rules are built up from selectors and declarations. The
1 declarations specify graphical properties; the selectors specify specify
1 when they apply.
1
1 In PO files, the following simple selectors (based on "CSS classes",
1 see the CSS2 spec, section 5.8.3) are supported.
1
1 • Selectors that apply to entire messages:
1
1 ‘.header’
1 This matches the header entry of a PO file.
1
1 ‘.translated’
1 This matches a translated message.
1
1 ‘.untranslated’
1 This matches an untranslated message (i.e. a message with
1 empty translation).
1
1 ‘.fuzzy’
1 This matches a fuzzy message (i.e. a message which has a
1 translation that needs review by the translator).
1
1 ‘.obsolete’
1 This matches an obsolete message (i.e. a message that was
1 translated but is not needed by the current POT file any
1 more).
1
1 • Selectors that apply to parts of a message in PO syntax. Recall
1 the general structure of a message in PO syntax:
1
1 WHITE-SPACE
1 # TRANSLATOR-COMMENTS
1 #. EXTRACTED-COMMENTS
1 #: REFERENCE…
1 #, FLAG…
1 #| msgid PREVIOUS-UNTRANSLATED-STRING
1 msgid UNTRANSLATED-STRING
1 msgstr TRANSLATED-STRING
1
1 ‘.comment’
1 This matches all comments (translator comments, extracted
1 comments, source file reference comments, flag comments,
1 previous message comments, as well as the entire obsolete
1 messages).
1
1 ‘.translator-comment’
1 This matches the translator comments.
1
1 ‘.extracted-comment’
1 This matches the extracted comments, i.e. the comments placed
1 by the programmer at the attention of the translator.
1
1 ‘.reference-comment’
1 This matches the source file reference comments (entire
1 lines).
1
1 ‘.reference’
1 This matches the individual source file references inside the
1 source file reference comment lines.
1
1 ‘.flag-comment’
1 This matches the flag comment lines (entire lines).
1
1 ‘.flag’
1 This matches the individual flags inside flag comment lines.
1
1 ‘.fuzzy-flag’
1 This matches the ‘fuzzy’ flag inside flag comment lines.
1
1 ‘.previous-comment’
1 This matches the comments containing the previous untranslated
1 string (entire lines).
1
1 ‘.previous’
1 This matches the previous untranslated string including the
1 string delimiters, the associated keywords (‘msgid’ etc.) and
1 the spaces between them.
1
1 ‘.msgid’
1 This matches the untranslated string including the string
1 delimiters, the associated keywords (‘msgid’ etc.) and the
1 spaces between them.
1
1 ‘.msgstr’
1 This matches the translated string including the string
1 delimiters, the associated keywords (‘msgstr’ etc.) and the
1 spaces between them.
1
1 ‘.keyword’
1 This matches the keywords (‘msgid’, ‘msgstr’, etc.).
1
1 ‘.string’
1 This matches strings, including the string delimiters (double
1 quotes).
1
1 • Selectors that apply to parts of strings:
1
1 ‘.text’
1 This matches the entire contents of a string (excluding the
1 string delimiters, i.e. the double quotes).
1
1 ‘.escape-sequence’
1 This matches an escape sequence (starting with a backslash).
1
1 ‘.format-directive’
1 This matches a format string directive (starting with a ‘%’
1 sign in the case of most programming languages, with a ‘{’ in
1 the case of ‘java-format’ and ‘csharp-format’, with a ‘~’ in
1 the case of ‘lisp-format’ and ‘scheme-format’, or with ‘$’ in
1 the case of ‘sh-format’).
1
1 ‘.invalid-format-directive’
1 This matches an invalid format string directive.
1
1 ‘.added’
1 In an untranslated string, this matches a part of the string
1 that was not present in the previous untranslated string.
1 (Not yet implemented in this release.)
1
1 ‘.changed’
1 In an untranslated string or in a previous untranslated
1 string, this matches a part of the string that is changed or
1 replaced. (Not yet implemented in this release.)
1
1 ‘.removed’
1 In a previous untranslated string, this matches a part of the
1 string that is not present in the current untranslated string.
1 (Not yet implemented in this release.)
1
1 These selectors can be combined to hierarchical selectors. For
1 example,
1
1 .msgstr .invalid-format-directive { color: red; }
1
1 will highlight the invalid format directives in the translated strings.
1
1 In text mode, pseudo-classes (CSS2 spec, section 5.11) and
1 pseudo-elements (CSS2 spec, section 5.12) are not supported.
1
1 The declarations in HTML mode are not limited; any graphical
1 attribute supported by the browsers can be used.
1
1 The declarations in text mode are limited to the following
1 properties. Other properties will be silently ignored.
1
1 ‘color’ (CSS2 spec, section 14.1)
1 ‘background-color’ (CSS2 spec, section 14.2.1)
1 These properties is supported. Colors will be adjusted to match
1 the terminal’s capabilities. Note that many terminals support only
1 8 colors.
1
1 ‘font-weight’ (CSS2 spec, section 15.2.3)
1 This property is supported, but most terminals can only render two
1 different weights: ‘normal’ and ‘bold’. Values >= 600 are rendered
1 as ‘bold’.
1
1 ‘font-style’ (CSS2 spec, section 15.2.3)
1 This property is supported. The values ‘italic’ and ‘oblique’ are
1 rendered the same way.
1
1 ‘text-decoration’ (CSS2 spec, section 16.3.1)
1 This property is supported, limited to the values ‘none’ and
1 ‘underline’.
1