Zend Translate Poedit y el contexto de traducción
Frecuentes
Visto 301 veces
0
is there a way to use the "context" or "msgctxt" in Zend_Translate when I call the method $translator->translate('My String') ?
I need to classify the item to be translated to a specific context for instance:
- Administración de clientes
- Carrito de compras
- Administración de pedidos
I need to use the contexts to solve ambiguities between the translation items.
At the moment I am using the PoEdit software and Zend_Translate to translate my project.
Muchas Gracias
1 Respuestas
0
I was searching this too, and it would seem that Zend_Translate
sí no support translation context.
You could try to extend the main Zend_Translate
class and implement the translation context as some kind of prefix that is automatically used together with the sentence or terms to be translated, for example:
$translate->translate($context, $sentence);
would be internally managed as
parent::translate("$context|$sentence");
y
$translate->translate($context, array($singular, $plural, $num));
sería
parent::translate(array("$context|$singular", "$context|$plural", $num));
but this would require to have the string with the prefixed $context
in your translation sources.
respondido 29 nov., 13:07
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas translate zend-translate or haz tu propia pregunta.
Salve Matteo, are you sure? - Michelangelo
I am pretty sure, what you can do is make sure to use some kind of prefix in your messages so that they will be guaranteed to be different for each context. - mateo tassinari
it's an idea, but you will lose the normal way to use of the Zend_Translate. maybe can we extend the class? - Michelangelo
unfortunatelly I have to handle a big project and it is really difficult handle/change all the translation items. - Michelangelo
Then you'll have to look elsewhere.. Perhaps ZF2? - mateo tassinari