From Fedora Project Wiki

(Handling po files)
 
No edit summary
Line 17: Line 17:


Finally, rename the folders to the correct ISO compliant names.
Finally, rename the folders to the correct ISO compliant names.
[[Category:Docs_Project]]
[[Category:Docs_Project_tools]]

Revision as of 01:42, 16 April 2009

Publican produces a pot file per xml file, rather than the single pot file per document that the old docs tools produced. Merging those pots with msgcat is no particular problem, but when l10n comes back with the results, you now are faced with the problem of converting one po file per language back into one po file per language per xml file.

It turns out, this is not terribly difficult to deal with. First, create a file in the po directory, LINGUAS, that lists the languages you want to process. Then:

#!/bin/bash
#
# Turn all single PO into separate PO for Publican
# * Relies on po/LINGUAS to be correct!
# * Make sure you're in the top of the module with the 'po/' folder.
#
for LANG in cat po/LINGUAS; do
    for POTFILE in pot/*.pot; do
        msgmerge po/${LANG}.po ${POTFILE} | msgattrib --no-obsolete \
                 > ${LANG}/$(basename ${POTFILE} .pot).po
    done
done

Finally, rename the folders to the correct ISO compliant names.