Comment 4 for bug 669831

Revision history for this message
Fabien Tassin (fta) wrote :

I simply can't as i need a fully bijective conversion. I've explained how it works in an thread a few days ago. Pasting here for reference:

=cut

upstream uses grit. It's a combination of one grd and several xtb files.
All are XML files (some kind of xslt).

the 1st string of generated_resources.grd (the template):

====
<if expr="not pp_ifdef('use_titlecase')">
        <message name="IDS_CONTENT_CONTEXT_PRINTFRAME" desc="The name of the Print Frame command in the content area context menu">
          P&amp;rint frame...
        </message>
</if>
====

in generated_resources_en_GB.xtb (the en-GB translation file), it looks like this (and nothing else):

====
<translation id="1002064594444093641">P&amp;rint Frame...</translation>
====

there's no obvious link between IDS_CONTENT_CONTEXT_PRINTFRAME and
1002064594444093641. The reason is that in a grd file, a string could be used for
totally different IDS_xxx codes with different conditions in different
contexts. So what grit does is it applies a function to the string
creating the id in order for that string to be translated only once:
some_hash("P&amp;rint frame...") => 1002064594444093641

So for launchpad, i turn all this into:

====
#. IDS_CONTENT_CONTEXT_PRINTFRAME
#. - description: In Title Case: The name of the Print Frame command in
the content area context menu
#. - condition: pp_ifdef('use_titlecase')
#: id: 1002064594444093641
msgid "P&rint Frame..."
msgstr ""
====

of course, i have to transcode all the xml entities and tags so they are
easy to read, and also i need to convert the gettext back to the grit
format.

=end

it explains why my gettext keys changed (msgid is transcoded, and each time i improve/change the transcoding rules, i hit this bug)