Translation of complex views

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Translation of complex views

localheinz
Hello, fellow developers,


this is likely a question that's framework-agnostic: how do you approach translation of complex views?

I'm not so sure which is a bigger nightmare:

* struggling with tons of translation message ids and translations
* duplicating view scripts, splicing in the locale/language in the filename ("index.phtml" becomes "index.en.phtml", "index.de.phtml" etc), and implementing an appropriate template resolver strategy or similarly ensure the appropriate view script is chosen

What are your experiences if you've got any you're willing to share?


Best regards,

Andreas
--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Translation of complex views

Matus Zeman
I'd say instead of struggling with tons of message ids just use text itself
as translation "ID" and problem solved. Then use tools like gettext/PoEdit
to scan though the project source files.
You really don't want to create different view scripts for different
languages -- unless it really necessary and other translation techniques
fails -- as this would introduce duplicating of your presentation logic
which you want to avoid!
With this approach you get few benefits for you as developer like: you
don't have to think much about translation when implementing new features.
Just make sure you use $this->translate() method. You don't have to
'manage' message IDs (questions like what's the best name for it so I don't
violate naming conventions? etc, etc, etc). Basically you don't care about
translation until your application needs to be translated - then you just
scan the project and hand over .po file to translators to edit.

Matus


On 9 August 2013 05:11, Andreas Möller <[hidden email]> wrote:

> Hello, fellow developers,
>
>
> this is likely a question that's framework-agnostic: how do you approach
> translation of complex views?
>
> I'm not so sure which is a bigger nightmare:
>
> * struggling with tons of translation message ids and translations
> * duplicating view scripts, splicing in the locale/language in the
> filename ("index.phtml" becomes "index.en.phtml", "index.de.phtml" etc),
> and implementing an appropriate template resolver strategy or similarly
> ensure the appropriate view script is chosen
>
> What are your experiences if you've got any you're willing to share?
>
>
> Best regards,
>
> Andreas
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>