Gettext PO files only allow one message with a common msgid (source string). Many other formats allow duplicate entries. To create a valid PO file you need to merge these duplicate entries into one PO message. However, this often negatively affects the roundrip or is not what is expected by the user. Thus we have a number of methods of handling duplicates which we call duplicate styles.
Also affected are conversions in which the source format is empty (allowing possible translation). As the header in a PO file is identified by an empty source string, your message will appear to be a duplicate of the header. In this case duplicate removal is critical.
Previously the tools used msgid_comment (KDE style comments) to disambiguate text. However, with the release of Gettext 0.15, the new msgctxt disambiguation is now recommended, especially if you wish to use your files with other Gettext the tools. Many other pieces of software now also support this feature, and will probably become the best choice for almost all circumstances.
This is the traditional Gettext approach. All messages with the same source string or English string are merged into one PO message.
#: file1.dtd:instruction_manual #: file1.dtd:manual_process msgid "Manual" msgstr ""
If however the source text is blank (these are often configuration options in Mozilla) then the merge style will use KDE comments as used in the msgid_comment style in order to create unambiquous entries that can still be used for configuration.
#: file1.dtd:translators_name msgid "_: file1.dtd:translators_name\n" msgstr "" #: file1.dtd:translators_email msgid "_: file1.dtd:translators_email\n" msgstr ""
Duplictes are not merged and each appear in their own message. This type of PO file will not work with the Gettext tools.
#: file1.dtd:instruction_manual msgid "Manual" msgstr "" #: file1.dtd:manual_process msgid "Manual" msgstr ""
If a duplicates is discovered then we make use of the KDE style comments to make them unique.
#: file1.dtd:instruction_manual msgid "_: instruction_manual\n" "Manual" msgstr "" #: file1.dtd:manual_process msgid "_: manual_process\n" "Manual" msgstr ""
You can see that both the entries instruction_manual and manual_process have source strings of “Manual”. By adding the KDE style comment we make the messages unique. This is helful for many people but isn't quite perfect in that in many cases your language will use the same word and you don't want it split - you now simply have more work.
This operates the same as msgid_comment except now every message has a KDE style comment added regardless if it is a duplicate or not.
This uses the new feature of gettext that was introduced with gettext 0.15. Several tools might not support it 100%. This option for duplicatestyle was added in version 1.0 of the translate toolkit.
#: file1.dtd:instruction_manual msgctxt "instruction_manual" msgid "Manual" msgstr "" #: file1.dtd:manual_process msgctxt "manual_process" msgid "Manual" msgstr ""