Pergunta

In Symfony 2's documentation regarding translations all of the XLIFF examples appear to use file.ext as the original file attribute. From XLIFF 1.2's documentation:

Original file - The original attribute specifies the name of the original file from which the contents of a element has been extracted.

In Symfony 2's case I don't belief we're actually extracting any contents for translation, but the original attribute is required. The usage of file.ext is never explained in Symfony 2's documentation, whether it is simply a place holder and ignored, or whether it needs to point to an actual file. My best guess is that it is ignored by Symfony 2, but I haven't had a chance to do any tests or dig around in the code.

Second question: Would it be appropriate to specify a default set of translations, e.g. messages.default.yml and use this as the original file from which the XLIFF translations are derived?

XLIFF seems a little bit like overkill when it comes to translations for use with web applications...

Foi útil?

Solução

Although original attribute of <file> is required in Xliff 1.2 spec and schema, you can ignore it and have a dummy string as its value so that your file passes schema validation.

One of the common uses of this property is when the strings from multiple documents (.properties files, gettext files, etc.) are extracted and reformatted as Xliff trans-units so that the strings from each individual file are placed under a respective individual <file> tag. original attribute can be used to keep the original filenames in an Xliff file with multiple <file> tags:

<?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='de' datatype="plaintext" original="Sample.properties">
    <trans-unit id="1" restype="label" resname="IDC_LABEL">
  ...
   </body>
 </file>
</xliff>

I agree that using Xliff for localizing small web applications can often be a bit of an overkill, but this format is arguably the only industry standard file format for localization data interchange at the moment. This makes it very popular with large scale localization implementation either simple source/target-structured files or heavily customized and tailored ones like those used in Translation Management Systems like SDL Idiom Worldserver.

Additionally, there is compatibility between Xliff and other standard file formats of OAXAL family.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top