Comment 3 for bug 408718

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Here's what the query would look like:

SELECT
    POMsgId.msgid AS msgid,
    POMsgID_Plural.msgid AS msgid_plural,
    context,
    date_reviewed,
    is_current,
    is_imported,
    pt0.translation AS translation0,
    pt1.translation AS translation1,
    pt2.translation AS translation2,
    pt3.translation AS translation3,
    pt4.translation AS translation4,
    pt5.translation AS translation5
FROM POTMsgSet
JOIN TranslationTemplateItem ON
    TranslationTemplateItem.potmsgset=POTMsgSet.id
JOIN POTemplate ON
    POTemplate.id=TranslationTemplateItem.potemplate
JOIN POFile ON
    POFile.potemplate=POTemplate.id AND
    POFile.id=%(pofile)s
JOIN TranslationMessage ON
    POTMsgSet.id=TranslationMessage.potmsgset AND
    (TranslationMessage.potemplate=POTemplate.id OR
     TranslationMessage.potemplate IS NULL) AND
    POFile.language=TranslationMessage.language AND
    POFile.variant IS NOT DISTINCT FROM TranslationMessage.variant
LEFT OUTER JOIN POTranslation pt0 ON pt0.id = TranslationMessage.msgstr0
LEFT OUTER JOIN POTranslation pt1 ON pt1.id = TranslationMessage.msgstr1
LEFT OUTER JOIN POTranslation pt2 ON pt2.id = TranslationMessage.msgstr2
LEFT OUTER JOIN POTranslation pt3 ON pt3.id = TranslationMessage.msgstr3
LEFT OUTER JOIN POTranslation pt4 ON pt4.id = TranslationMessage.msgstr4
LEFT OUTER JOIN POTranslation pt5 ON pt5.id = TranslationMessage.msgstr5
JOIN POMsgID ON
    POMsgID.id=POTMsgSet.msgid_singular
LEFT OUTER JOIN POMsgID AS POMsgID_Plural ON
    POMsgID_Plural.id=POTMsgSet.msgid_plural
WHERE (is_current IS TRUE OR is_imported IS TRUE)
ORDER BY
    TranslationTemplateItem.sequence,
    TranslationMessage.potemplate NULLS LAST