Zend Translate Poedit y el contexto de traducción

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

preguntado el 27 de noviembre de 13 a las 18:11

1 Respuestas

I was searching this too, and it would seem that Zend_Translateno 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



$translate->translate($context, array($singular, $plural, $num));


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

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

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.