[Openstack-i18n] common (RST) translation

KATO Tomoyuki tomo at dream.daynight.jp
Tue Jun 16 13:23:35 UTC 2015


> On 06/04/2015 01:41 PM, KATO Tomoyuki wrote:
> > Hi team,
> >
> > I'm translating User Guides (RST) recently.
> > I found a below problem.
> > Any thought?
> >
> > Problem:
> >    Each message catalog "pot" file contains all strings of
> >    the RST document, including "common" files (glossary and so on).
> >    In particular, "user-guide" and "user-guide-admin" resource at
> >    Transifex have same strings in "common" files respectively.
> >    This causes unintended inconsistency of translation.
> >    In fact, Japanese "user-guide" and "user-guide-admin" have
> >    different translated strings, which need to sync manually.
> 
> Indeed this is not optimal yet.
> 
> > Solution (just my idea):
> >    As is:
> >      1. Sphinx(?) generates the "pot" file.
> >      2. translate at Transifex.
> >      3. Sphinx(?) merge the translated strings.
> >
> >    To be:
> >      1. Sphinx(?) generates the "pot" file.
> >      2. A new script split message stringss for "common".
> >         (maybe, based on "msgcat")
> >         So, generate 2 resources (main document resource
> >         and "common" resource).
> >      3. translate at Transifex.
> >      4. merge the 2 resources for Sphinx(?).
> >      5. Sphinx(?) merge the translated strings.
> 
> 
> Yes, translating the "common-rst" separate from user-guide and 
> user-guide-admin (and other future RST guides) would be the better way 
> forward but needs some scripting.
> 
> You need to enhance in openstack-doc-tools the file 
> bin/doc-tools-check-languages and in openstack-manuals the file 
> tools/generatepot-rst.sh.
> 
> If you like to tackle this, it would be appreciated and I'll give any 
> help - just don't have time right now to work on this myself,
> 
> Feel free to ask any questions,

Hi Andreas, team,

Here is a mockup about my idea.
Make sense?

==== tools/generatepot-rst.sh in openstack-manuals ====
33,62d32
< # Build common
< # Delete Project-Id-Version to simplify output
< sed -i -E 's/^"Project-Id-Version: [a-zA-Z0-9\. ]+\\n"$/"Project-Id-Version: \\n"/' \
<   doc/$DOCNAME/source/locale/common.pot
< # Create the common pot file
< msgcat --sort-output doc/common-rst/locale/common.pot \
<   doc/$DOCNAME/source/locale/common.pot | \
<   sed -E 's/^"Project-Id-Version: [a-zA-Z0-9\. ]+\\n"$/"Project-Id-Version: \\n"/' | \
<   awk '$0 !~ /^\# [a-z0-9]+$/' | awk '$0 !~ /^\# \#-\#-\#-\#-\# /' > doc/$DOCNAME/source/common.pot
< mv -f doc/$DOCNAME/source/common.pot doc/common-rst/locale/common.pot
< # Simplify metadata
< rm -f doc/common-rst/locale/dummy.po
< cat << EOF > doc/common-rst/locale/dummy.po
< msgid ""
< msgstr ""
< "Project-Id-Version: \n"
< "Report-Msgid-Bugs-To: \n"
< "POT-Creation-Date: 2015-01-01 01:01+0900\n"
< "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
< "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
< "Language-Team: LANGUAGE <LL at li.org>\n"
< "MIME-Version: 1.0\n"
< "Content-Type: text/plain; charset=UTF-8\n"
< "Content-Transfer-Encoding: 8bit\n"
< EOF
< msgmerge -N doc/common-rst/locale/dummy.po \
<   doc/common-rst/locale/common.pot > doc/common-rst/locale/tmp.pot
< mv -f doc/common-rst/locale/tmp.pot doc/common-rst/locale/common.pot
< rm -f doc/common-rst/locale/dummy.po

==== bin/doc-tools-check-languages in openstack-doc-tools ====
52,57d51
<     # merge the common po file
<     msgcat -o ${DOC_DIR}${book}/source/locale/${language}/${book}.po \
<       ${DOC_DIR}common-rst/locale/${language}/LC_MESSAGES/common.po \
<       ${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${book}.po
<     mv -f ${DOC_DIR}${book}/source/locale/${language}/${book}.po \
<       ${DOC_DIR}${book}/source/locale/${language}/LC_MESSAGES/${book}.po

==== (other things) ====
push to and pull from Transifex:
  common-rst/locale/common.pot and each language po files


Thanks,
KATO Tomoyuki



More information about the Openstack-i18n mailing list