Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding localization to the project #19

Merged
merged 12 commits into from
Apr 23, 2014
Merged

Adding localization to the project #19

merged 12 commits into from
Apr 23, 2014

Conversation

fzipi
Copy link
Contributor

@fzipi fzipi commented Dec 5, 2013

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

@pdobrigkeit
Copy link
Member

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
Copy link
Contributor Author

fzipi commented Dec 6, 2013

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
#19 (comment).

@stefankleff
Copy link
Member

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
Copy link
Contributor Author

fzipi commented Dec 6, 2013

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
#19 (comment).

@stijnhau
Copy link
Contributor

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
Copy link
Contributor

Closed?
Will it be merged or not?

@pdobrigkeit pdobrigkeit reopened this Apr 23, 2014
@pdobrigkeit
Copy link
Member

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

pdobrigkeit added a commit that referenced this pull request Apr 23, 2014
Adding localization to the project
@pdobrigkeit pdobrigkeit merged commit a66465c into goalio:master Apr 23, 2014
@stijnhau
Copy link
Contributor

so it will be merged later on ?

@pdobrigkeit
Copy link
Member

Yes, will be included in the next update

@stijnhau
Copy link
Contributor

hmm update was just before my comment.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants