glib-compile-schemas: get strict about whitespace
authorRyan Lortie <desrt@desrt.ca>
Sat, 28 Jan 2012 00:09:08 +0000 (01:09 +0100)
committerRyan Lortie <desrt@desrt.ca>
Sat, 28 Jan 2012 00:23:05 +0000 (01:23 +0100)
commit9a7a98bf3b4853371e72c91d665e5ad375d68929
tree210729ca462f734f58d832fc4ebdd2c6f7682f00
parent37af8167b65ab95278262bd243292042d01a916b
glib-compile-schemas: get strict about whitespace

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.
gio/glib-compile-schemas.c