Changes

From SME Server
Jump to navigationJump to search
3,160 bytes removed ,  11:33, 6 February 2008
Line 45: Line 45:     
== Formagick ==
 
== Formagick ==
Normando suggested a few tools, I'm using XML2PO, see the others in the history
+
we are using http://linux.die.net/man/1/xml2po to convert the xml lexicons to .po files and back
http://wiki.contribs.org/index.php?title=Talk:Pootle&oldid=7649#I_need_your_help
  −
 
  −
===XML2PO===
  −
( http://linux.die.net/man/1/xml2po )
      
I have packaged for a better installation. You can download from  
 
I have packaged for a better installation. You can download from  
 
  http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpm/gnome-doc-utils-0.12.0-1.noarch.rpm
 
  http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpm/gnome-doc-utils-0.12.0-1.noarch.rpm
   −
Before try, you must edit a few lines.  
+
Before try, you must edit a few lines. [ we now use /usr/share/xml2po/smetrans.py ]
    
/usr/share/xml2po/empty.py
 
/usr/share/xml2po/empty.py
Line 62: Line 58:  
  Line 39 from "return []" to "return ['trans']" // or ['lang'] testing
 
  Line 39 from "return []" to "return ['trans']" // or ['lang'] testing
   −
===Create .po and export xml===
+
===Create .po and export xml files===
To test the lexicons
+
we have written a few shell scripts, which are automating checking, we'll release later for contribs authors
xml2po -m empty -e -o backup.po backup
  −
 
  −
View the new bakup.po file in the new PO format. Excellent. Now you can translate PO with pootle, and return again to formmagick panel with this command:
  −
 
  −
xml2po -p backup.po backup > backup.new
  −
 
  −
As you can see, if you not translate backup.po, new_backup file is equal to original backup file, BUT with one difference, backup.new file has added a line at the header: We remove this line with newxml
  −
<?xml version="1.0" encoding="utf-8"?>
  −
 
  −
===shell scripts===
  −
xml2po ignores tags such as CDATA, CDATA does not appear at the PO file.
  −
 
  −
The workaround is to find and replace the problem code
     −
Create a clean .po file with newpo, either edit your lexicon or add s///g commands to workaround new problems
+
===bugs===
 
  −
After you have a clean english .po you could use that as a template and copy and paste the translation in. A better idea is to write a merge tool see below
  −
 
  −
====newpo====
  −
#!/bin/bash
  −
#
  −
#SME Server Create lexicon .po
  −
  −
#under constant change...
  −
 
  −
====newpomerge====
  −
 
  −
The aim of this is to take a blank en .po and merge in the values for a translation .po
  −
 
  −
en.po has
  −
msgid "Yes"
  −
msgstr ""
  −
 
  −
fr.po has
  −
msgid "Oui"
  −
msgstr ""
  −
 
  −
we want fr.po to look like
  −
msgid "Yes"
  −
msgstr "Oui"
  −
 
  −
We can't assume the translation will be in the same order,
  −
so it involves looking back at the lexicon base field to do the match
  −
 
  −
or rewriting the fr lexicon first so it is in the same order, with empty fields if necessary,
  −
then you can just go through in order picking out records.
  −
 
  −
Sample .po output attached, it will always be in this format (but translation msgid's may be missing or out of order)
  −
msgid ""
  −
msgstr ""
  −
"Project-Id-Version: PACKAGE VERSION\n"
  −
"POT-Creation-Date: 2008-02-04 02:31+1100\n"
  −
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  −
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  −
"Language-Team: LANGUAGE <LL@li.org>\n"
  −
"MIME-Version: 1.0\n"
  −
"Content-Type: text/plain; charset=UTF-8\n"
  −
"Content-Transfer-Encoding: 8bit\n"
  −
  −
#: functions/useraccounts:6(trans)
  −
msgid "Create, modify, or remove user accounts"
  −
msgstr ""
  −
  −
#: functions/useraccounts:33(trans)
  −
msgid "Create or modify"
  −
msgstr ""
  −
  −
#: functions/useraccounts:66(trans)
  −
msgid "Modify the admin account"
  −
msgstr ""
  −
 
  −
====newxml====
  −
  #!/bin/bash
  −
#
  −
#SME Server Create .xml from .po
  −
  −
#under constant change...
  −
 
  −
===yum===
   
:newxml needs a parameter to set:  lang="fr"
 
:newxml needs a parameter to set:  lang="fr"
:: why doesn't this work ?
+
:: look at
 
:: xml2po -l fr -p yum.po yum > yum.xml
 
:: xml2po -l fr -p yum.po yum > yum.xml
 
::    -l    --language=LANG      Set language of the translation to LANG
 
::    -l    --language=LANG      Set language of the translation to LANG
   −
:you can't have a base equal to a trans, needs a new bug (if pootle goes ahead)
+
:you can't have a <base> equal to a <trans>
:most en base lexicons do this,
  −
:easy fix is to tweak the trans for Form_Title, capitalise or punctuate
  −
:-<trans>Software installer</trans>
  −
:+<trans>Software Installer</trans>
  −
 
  −
<lexicon lang="en-us">
  −
    <entry>
  −
        <base>FORM_TITLE</base>
  −
        <trans>Software installer</trans>
  −
    </entry>
  −
 
  −
    <entry>
  −
      <base>Configuration</base>
  −
      <trans>Configuration</trans>
  −
    </entry>
  −
 
  −
    <entry>
  −
      <base>Software installer</base>
  −
      <trans>Software installer</trans>
  −
    </entry>
     −
<lexicon lang="en-us">
+
http://bugs.contribs.org/show_bug.cgi?id=3863
    <entry>
  −
      <base>FORM_TITLE</base>
  −
      <trans>Mise à jour logicielle</trans>
  −
    </entry>
  −
  −
    <entry>
  −
      <base>Configuration</base>
  −
      <trans>Configuration</trans>
  −
    </entry>
  −
  −
    <entry>
  −
      <base>Mise à jour logicielle</base>
  −
      <trans>Mise à jour logicielle</trans>
  −
    </entry>
      
==Console==
 
==Console==

Navigation menu