inpsyde / wpml2mlp

Convert posts from an existing WPML multilingual site via WXR Export/Import for MultilingualPress
https://wordpress.org/plugins/wpml-to-multilingualpress/
GNU General Public License v2.0
10 stars 6 forks source link

XLIFF Background #1

Closed bueltge closed 9 years ago

bueltge commented 9 years ago

Format for Ex-Import is XLIFF.

Spezifikation

<?xml version="1.0" encoding="utf-8" ?>
<xliff version="1.1" xml:lang='en'>
 <file source-language='en' target-language='de' datatype="plaintext" original="Sample.po">
  ...
   <body>
    <trans-unit id="1" restype="button" resname="IDC_TITLE">
     <source>Title</source>
    </trans-unit>
    <trans-unit id="2" restype="label" resname="IDC_STATIC">
     <source>&amp;Path:</source>
    </trans-unit>
  ...
 </file>
 <file source-language='en' target-language='fr' datatype="plaintext" original="Sample.po">
    <trans-unit id="1" restype="button" resname="IDC_TITLE">
  ...
   </body>
 </file>
</xliff>
<?xml version="1.0" ?>
<xliff version="1.0">
    <file original="global" source-language="en_US" target="fi" datatype="plaintext">
        <body>
          <trans-unit id="1">
            <source>Application Name</source>
            <target>Sovelluksen nimi</target>
          </trans-unit>
          <trans-unit id="2">
            <source>Home</source>
            <target>Koti</target>
          </trans-unit>
          <trans-unit id="3">
            <source>Exit</source>
            <target>Poistua</target>
          </trans-unit>
        </body>
    </file>
  </xliff>
<xliff xmlns='urn:oasis:names:tc:xliff:document:2.0' version='2.0'
 srcLang='en' trgLang='fr'>
 <file id='1'>
  <val:validation xmlns:val='urn:oasis:names:tc:xliff:validation:2.0'>
   <val:rule startsWith='*'/>
  </val:validation>
  <unit id='1'>
   <originalData>
    <data id='d1'>&lt;B></data>
    <data id='d2'>&lt;/B></data>
   </originalData>
   <segment>
    <source>* Hello <pc id='1' dataRefStart='d1' dataRefEnd='d2' type='fmt' subType='xlf:b'>World</pc>! </source>
    <target>* Bonjour <pc id='1' dataRefStart='d1' dataRefEnd='d2' type='fmt' subType='xlf:b'>tout le monde</pc> ! </target>
   </segment>
   <segment>
    <source>Welcome in the universe of <pc id='2' dataRefStart='d1' dataRefEnd='d2' type='fmt' subType='xlf:b'>XLIFF 2</pc>.</source>
   </segment>
  </unit>
 </file>
</xliff>

PHP class

davscro commented 9 years ago

Hi Frank,

I'm not sure am I right but seems that any of examples above doesn't pass validation check through online tool (http://okapi-lynx.appspot.com/validation). Maybe there is some issues with XLIFF version but I'm not sure. Could you please tell me which of these examples are we gonna use. Maybe this one below, because if I copy this code

<?xml version="1.0" ?>
<xliff version="1.0">
    <file original="global" source-language="en_US" target="fi" datatype="plaintext">
        <body>
          <trans-unit id="1">
            <source>Application Name</source>
            <target>Sovelluksen nimi</target>
          </trans-unit>
          <trans-unit id="2">
            <source>Home</source>
            <target>Koti</target>
          </trans-unit>
          <trans-unit id="3">
            <source>Exit</source>
            <target>Poistua</target>
          </trans-unit>
        </body>
    </file>
  </xliff>

to my text editor and save it in xliff format, I'm able to open it in iLocalize app on my mac.

Image of iLocalize

Should we use this xliff scheme or?

bueltge commented 9 years ago

@davscro Yes, this please. I think this format is the easiest way for development. I think only source -target in each file is a better way as a complex file with a lot of languages. But for the import it is a little bit harder. Maybe you solve this with a upload of zip and import a lot of xliff files from the zip.

davscro commented 9 years ago

@bueltge Thanks for quick answer. Ok we will use that format. Will let you know if we have some other questions. Regards

bueltge commented 9 years ago

Thanks for your feedback, time and the nice work with your. Please ask, the way here is fine for my time windows.

bueltge commented 9 years ago

@davscro After discussion in the team would be fine that we get the xliff version 2.0 - http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html Can you check this. The validator works only on version 2.0, the version 1.0 is old, not maintained.

davscro commented 9 years ago

@bueltge Ok, I'm checking 2.0 specifications. Yea I notice that validator only works with 2.0 version.

davscro commented 9 years ago

Hi all, xliff export is ready for review. Please can you take a look. Regards, Davor