Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.9.5
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Translate
-
Labels:None
Description
I use Zend_Translate for a multilingual website. Therefor I would like to use the adapter "Zend_Translate_Adapter_Xliff".
A translation file is structured as follows:
------------------------------------------------------------------
<?xml version="1.0" ?>
<xliff version='1.1' xmlns='urn:oasis:names:tc:xliff:document:1.1'>
<file original='en.xml' source-language='de' target-language='en' datatype='plaintext'>
<body>
<trans-unit id='menu_home'>
<source>Startseite</source>
<target>Home</target>
</trans-unit>
<trans-unit id='menu_produkte'>
<source>Produkte</source>
<target>Products</target>
</trans-unit>
</body>
</file>
</xliff>
------------------------------------------------------------------
I would prefer to use the trans-unit id(s) as array key(s) for the translation instead of the source strings. This method has some advantages. As example when changing the translations. You don't have to:
- update content within the translation file
- update content within source file
- update source-entry within each translation file (such as 'fr', 'es', 'de', 'cn' ...)
- look within all your php scripts where you call "$this->translate()" to translate this content
The use of the "Zend_Translate_Adapter_Xliff" will be terrible if a source such as the complete Terms & Conditions are provided. In a view-script you will translate this full text like this way:
$this->translate('1. These general terms and conditions apply to each and every booking made by any person or entity (hereinafter referred to as the "CLIENT") with Diep in die Berg (hereinafter referred to as the "PROPRIETOR") for any function, occasion or utilization of the facilities of the PROPRIETOR.').
And this is for example only the first paragraph!!!
If no optional possibility will be created to use the trans-unit id, it would be sufficient to declare the methods "_startElement" and "_endElement" as protected to own the possibility to extend them.
And yes, I read this issue / improvement: http://framework.zend.com/issues/browse/ZF-4114
But something must happen please!
Transunit ID is an optional element so we can not use it because it's optional.
Additionally you forgot the negs of such an change.