goalio / GoalioForgotPassword

A Zend Framework 2 (ZF2) Module offering forgot password via e-mail functionality to ZfcUser
BSD 3-Clause "New" or "Revised" License
42 stars 49 forks source link

Adding localization to the project #19

Closed fzipi closed 10 years ago

fzipi commented 10 years ago

Localization is a must for a generic module like this one.

pdobrigkeit commented 10 years ago

Thank you, but I have a couple of questions. For one I do not use gettext files right now for translation. Does it mix with ZF2 if you use multiple different adapters? And how is the textdomain set? If I would have different modules with this structure, would it work out of the box?

Also I would remove the setting of the locale from this module. That is application specific and should go into your own application module.

fzipi commented 10 years ago

On 06/12/13 06:34, Philipp Dobrigkeit wrote:

Thank you, but I have a couple of questions. For one I do not use gettext files right now for translation.

Using gettext is practically unobtrusive. You just add '_' whenever you want a string translated (well, at least in simple modules). If you want to do the full stuff, you must consider plurals, and right to left languages... but again, not for this simple stuff.

Does it mix with ZF2 if you use multiple different adapters?

I didn't had any problems (yet). I think is fully supported.

And how is the textdomain set? If I would have different modules with this structure, would it work out of the box?

See this tutorial from Manuel Stosic: http://samminds.com/2012/09/zend-framework-2-translate-i18n-locale/

My experience is that it works out of the box. But you must have sane defaults.. that's why I put initialization onBoostrap. But could be made declaratively at the module config. I'm uploading these changes as you requested.

Also I would remove the setting of the locale from this module. That is application specific and should go into your own application module.

Done.

— Reply to this email directly or view it on GitHub https://github.com/goalio/GoalioForgotPassword/pull/19#issuecomment-29971768.

stefankleff commented 10 years ago

using _() is the wrong way to translate form labels. the form label view helper itself is aware of the translator and can translate them.

See the code at https://github.com/zendframework/zf2/blob/master/library/Zend/Form/View/Helper/AbstractHelper.php#L13

fzipi commented 10 years ago

On 06/12/13 11:58, Stefan Kleff wrote:

using _() is the wrong way to translate form labels. the form label view helper itself is aware of the translator and can translate them

Well, you're right in that. But, tools aren't always aware... i.e. you should copy your strings to another file in which xgettext could parse, or do some hack like a function with does nothing (like http://stackoverflow.com/questions/15961628/how-to-translate-form-labels-in-zend-framework-2). I any case, I've taken out all ''.

See the code at

https://github.com/zendframework/zf2/blob/master/library/Zend/Form/View/Helper/AbstractHelper.php#L13

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/goalio/GoalioForgotPassword/pull/19#issuecomment-29995873.

stijnhau commented 10 years ago

Personaly in think evey module needs to have the basi tranaltion files and settings. So the modules can be used without need from custom(language files).

stijnhau commented 10 years ago

Closed? Will it be merged or not?

pdobrigkeit commented 10 years ago

Sorry, I am just working on an update. Was cleaning up some stuff. Will merge your fixes. Thank you and apologies for the long delay

stijnhau commented 10 years ago

so it will be merged later on ?

pdobrigkeit commented 10 years ago

Yes, will be included in the next update

stijnhau commented 10 years ago

hmm update was just before my comment. Thank you.