I don't know how 'normal' PHP handles domains but my understanding from gettext 
is that you can specifically mark a context/domain for a translation key so you 
can reuse the same key in multiple locations without collisions. When we came 
to implement this very useful feature in Ztal we were rather surprised to note 
that Zend Framework doesn't actually have any concept of context for 
translation keys and when it processes a contextual mo file it leaves the 
context and the key concatenated. Within the mo file there is a spacial char 
used to mark the boundary between context and key and as ZF doesn't do anything 
with it, Ztal can handle the context internally. I'm completely unaware of how 
php's gettext implementation handles this feature however.

Within the po files you can use the command 'msgctxt "<mycontext>"' to 
contextualise a translation key. Within Ztal you can then use i18n:domain to 
specify a context and Ztal will first look for a translation key for the 
specified domain before then trying a non-contextual key.

Anyone had experience of doing this in normal PHP?

Of course, there is every chance that Ztal's interpretation of i18n:domain is 
different from the intended design but the functionality is extremely useful so 
if i18n:domain is not intended for this can we please have an i18n:context as 
well! :D

Robert

On 28 Jun 2011, at 17:49, Darrell Hamilton wrote:

> There seems to be a lacking of any documentation for the i18n:domain
> attribute.  In the current documentation, it is only mentioned as an
> aside in the PHPTAL_TranslationService section of the PHP Integration
> Chapter.
> 
>> From the doc comments in it's implementation:
> 
> * The i18n:domain attribute is used to specify the domain to be used
> to get
> * the translation. If not specified, the translation services will
> use a
> * default domain. The value of the attribute is used directly; it is
> not
> * a TALES expression.
> 
> 
> Darrell Hamilton,
> Software Developer,
> 4over, Inc
> darre...@4over.com
> 818-246-1170 ext. 285
> 
> _______________________________________________
> PHPTAL mailing list
> PHPTAL@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to