• Allison Karlitskaya's avatar
    glib-compile-schemas: get strict about whitespace · 9a7a98bf
    Allison Karlitskaya authored
    It's important to have strict rules for handling of whitespace in
    translated strings in GSettings schema files so that the tools
    extracting the messages will end up with the same messages as the
    runtime calling gettext().
    The rules are designed to be simple and unambiguous yet cover most
    normal uses in a convenient way.
    Those rules are as follows (with rationale):
      - for <default> tags, the text content has its leading and trailing
        whitespace stripped off, but internal whitespace is not modified in
        any way.
        This allows for slightly more flexible use of whitespace without
        causing that whitespace to appear in the strings for translation.
      - for <summary> and <description> tags, the content is split into
        paragraphs.  Paragraphs are separated by two or more sequential
        newline characters.  Each paragraph has its leading and trailing
        whitespace removed and all other whitespace is normalised to a
        single ascii space character.  Finally, the paragraphs are rejoined,
        inserting exactly two newlines between them.
        This allows for longer explanations (particularly in the description
        tag) using a natural format that, when normalised, will display
        nicely in toolkits.
    This patch implements the rules for <default> tags.  The schema compiler
    currently ignores <summary> and <description> tags.
glib-compile-schemas.c 61.4 KB