0

In the process of internationalizing a web application, we have some XLIFF files in french and we are going to translate them in two other languages.

We are going to transition to symfony in the long run (6 month), so that is our target ; and they recommand using instead of real sentences as keys : https://symfony.com/doc/5/best_practices.html

So our files look like that:

<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" target-language="fr" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="translation">
                <source>trans</source>
                <target>traduction</target>
            </trans-unit>
        </body>
    </file>
</xliff>

and hopefuly, our end files will end up like that :

<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" target-language="es" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="translation">
                <source>trans</source>
                <target>traduccion</target>
            </trans-unit>
        </body>
    </file>
</xliff>

With symfony's translation-contracts, I end up with something like that :

<?php
// ...
echo $translator->trans('trans');
// traduction

I have all my PHP working.

It is practical, for developers, to use keys instead of sentences, but it seems like it does not go well with the XLIFF standard which asks two languages per file.

Standard software assist translation from source language to target language in a single file, and this goes in conflict with symfony best-practice, and both are right to advice doing so.

How do you assist the translation process from key-indexed XLIFF files?

Pierre-Antoine Guillaume
  • 1,047
  • 1
  • 12
  • 28

1 Answers1

0

Personally I use yaml for translations, but I don’t have complicated translations anyway.

You can use always the source language as en and the source of every translations should be the key which the developers should use.

Alexander Dimitrov
  • 944
  • 1
  • 6
  • 17
  • What do you give to your translator ? How do you make it so a translator can properly work on the file you give him ? – Pierre-Antoine Guillaume Apr 21 '20 at 10:30
  • Are you using the translation bungle as standalone or in a symfony project? – Alexander Dimitrov Apr 21 '20 at 10:32
  • I am not using the translation bundle, and I don't know what it is – Pierre-Antoine Guillaume Apr 21 '20 at 10:38
  • This is the translation module https://symfony.com/doc/current/translation.html, but I’m afraid I can understand what exactly you are trying to do.. – Alexander Dimitrov Apr 21 '20 at 10:43
  • I have all the PHP working, now I must translate the files ; but the format suggested by symfony (key => value pairs) is not compatible with the XLIFF standard, and thus is not compatible with standard translation software. – Pierre-Antoine Guillaume Apr 21 '20 at 10:49
  • The symfony/translation-contracts are just an abstraction. You should use symfony/translation package. Here is a quick demo how it should work outside symfony project: https://github.com/netbull/translations-demo. – Alexander Dimitrov Apr 21 '20 at 11:36
  • That has nothing to do with the question, so I guess I asked poorly. What file do you provide to the human in charge of the translation, so that his software has the correct data ? If you provide the spanish version, he will have "your_traduction" as an input to translate into spanish, and that does not help a lot – Pierre-Antoine Guillaume Apr 21 '20 at 11:42
  • anyway you provide the XLIFF file, but if you choose to use keywords the human will see only them without the original text. This is disadvantage in the keywords in general not only the format /XLIFF/, because the human does not see the context of the translation. From Symfony suggest to use the language instead of keywords in cases of shared bundles.. I guess it's also a valid point for better translation experience as well. – Alexander Dimitrov Apr 21 '20 at 11:49