From Fedora Project Wiki

No edit summary
No edit summary
Line 15: Line 15:
     done
     done
  done
  done


Finally, rename the folders to the correct ISO compliant names.
Finally, rename the folders to the correct ISO compliant names.
The above was Paul's suggestion.  However, on reflection, since we need to do a lot of renaming as well, I wonder if we shouldn't do away with po/LINGUAS altogether and do something like:
#!/bin/sh
#
# Turn all single PO into separate PO for Publican
# * Make sure you're in the top of the module with the 'po/' folder.
#
# YOU MUST ADJUST THE FOLLOWING TWO ARRAYS TO REFLECT THE LANGUAGES YOU
# HAVE, AND DON'T FORGET THE COUNT
#
TFXLAN=(as bn ca cs da de el es fi fr gu he hi hr hu id it ja kn ko ml mr ms nb nl or pa pl pt_Br pt ru sk sr_Latn sr sv ta te uk zh zh)
PUBLAN=(as-IN bn-IN ca-ES cs-CZ da-DK de-DE el-GR es-ES fi-FI fr-FR gu-IN he-IL hi-IN hr-HR hu-HU id-ID it-IT ja-JP kn-IN ko-KR ml-IN mr-IN ms-MY nb-NO nl-NL or-IN pa-IN pl-PL pt-BR pt-PT ru-RU sk-SK sr-Latn-RS sr-RS sv-SE ta-IN te-IN uk-UA zh-CN zh-TW)
for NUM in {0..39} ; do
    mv po/${TFXLAN[${NUM}]}.po po/${PUBLAN[${NUM}]}.po
    for POTFILE in pot/*.pot; do
        msgmerge po/${PUBLAN[${NUM}]}.po ${POTFILE} | msgattrib --no obsolete  \
                  > ${PUBLAN[${NUM}]}/$(basename ${POTFILE} .pot).po
    done
  done
This way we wouldn't forget to do all that renaming, and the renaming would be guaranteed consistent with the languages.




[[Category:Docs_Project]]
[[Category:Docs_Project]]
[[Category:Docs_Project_tools]]
[[Category:Docs_Project_tools]]

Revision as of 16:00, 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.


The above was Paul's suggestion. However, on reflection, since we need to do a lot of renaming as well, I wonder if we shouldn't do away with po/LINGUAS altogether and do something like:

#!/bin/sh
#
# Turn all single PO into separate PO for Publican
# * Make sure you're in the top of the module with the 'po/' folder.
#
# YOU MUST ADJUST THE FOLLOWING TWO ARRAYS TO REFLECT THE LANGUAGES YOU
# HAVE, AND DON'T FORGET THE COUNT
#
TFXLAN=(as bn ca cs da de el es fi fr gu he hi hr hu id it ja kn ko ml mr ms nb nl or pa pl pt_Br pt ru sk sr_Latn sr sv ta te uk zh zh)
PUBLAN=(as-IN bn-IN ca-ES cs-CZ da-DK de-DE el-GR es-ES fi-FI fr-FR gu-IN he-IL hi-IN hr-HR hu-HU id-ID it-IT ja-JP kn-IN ko-KR ml-IN mr-IN ms-MY nb-NO nl-NL or-IN pa-IN pl-PL pt-BR pt-PT ru-RU sk-SK sr-Latn-RS sr-RS sv-SE ta-IN te-IN uk-UA zh-CN zh-TW)
for NUM in {0..39} ; do
    mv po/${TFXLAN[${NUM}]}.po po/${PUBLAN[${NUM}]}.po
    for POTFILE in pot/*.pot; do
        msgmerge po/${PUBLAN[${NUM}]}.po ${POTFILE} | msgattrib --no obsolete  \
                 > ${PUBLAN[${NUM}]}/$(basename ${POTFILE} .pot).po
    done
  done

This way we wouldn't forget to do all that renaming, and the renaming would be guaranteed consistent with the languages.