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

BaseControl, SelectBox: labels and prompt are translated by global translator #58

Merged
merged 1 commit into from Jun 21, 2017

Conversation

@dg
Copy link
Member

commented Jan 29, 2015

This is just idea.

Error messages are since 6451fe0 translated by form's translator instead of control's one. It turned out to be the right decision. What about labels? I think that labels should be translated by form's translator too.

Maybe selectbox prompt too, but I am not sure.

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2015

So – what would the control's translator be for?

@dg

This comment has been minimized.

Copy link
Member Author

commented Jan 30, 2015

setTranslator has sense for items on Choice & MultiChoiceControl.

@dg dg force-pushed the dg:translator branch 2 times, most recently from 9303edc to 45e02e5 Feb 6, 2015

@dg dg force-pushed the nette:master branch 2 times, most recently from b644bbd to 3b543ff Feb 6, 2015

@dg dg force-pushed the dg:translator branch from 45e02e5 to 9ca4ce8 Feb 6, 2015

@solcik

This comment has been minimized.

Copy link
Contributor

commented Feb 7, 2015

I would very welcome this approach. Label and prompt via form's translator and items via control's. So It would not be needed to hack it - setTranslator(NULL) and then manually translate label and prompt.

@dg dg force-pushed the nette:master branch 4 times, most recently from 75b0565 to 72a5c56 Feb 8, 2015

@Olicek

This comment has been minimized.

Copy link

commented Feb 9, 2015

Will this PR in Nette 2.3?

@dg dg added this to the v2.4 milestone Feb 16, 2015

@dg dg force-pushed the nette:master branch 4 times, most recently from 164ee7d to 7b7189f Feb 17, 2015

@dg dg force-pushed the dg:translator branch from 9ca4ce8 to 0e0b661 Feb 25, 2015

@tomaswindsor

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2015

I like the idea, but I suggest using overridable control's methods like getOuterTranslator() and getItemsTranslator(), which would in their default implementation work as outlined above (getOuterTranslator() would return form's translator and getItemsTranslator() would return control's translator. Purpose is simply to make it possible to modify the behavior via inheritance.

Alternatively there could be properties and public setters for both types of these translators (setItemsTranslator, setOuterTranslator) and the default behavior could again be the same as outlined above.

@dg dg force-pushed the nette:master branch 2 times, most recently from 131f7d2 to 532059a May 21, 2015

@dg dg force-pushed the dg:translator branch from 0e0b661 to 3d169d2 May 25, 2015

@dg dg force-pushed the nette:master branch 2 times, most recently from a57a557 to 55d0eb8 Jun 19, 2015

@dg dg force-pushed the dg:translator branch from 3d169d2 to 37a3d26 Jun 19, 2015

@dg dg force-pushed the dg:translator branch from 37a3d26 to 3f1cb6c Aug 22, 2015

@dg dg force-pushed the nette:master branch from ec29b6d to 249f516 Nov 29, 2015

@dg dg force-pushed the nette:master branch from 728c43e to ffb3b6b Jan 11, 2016

@dg dg force-pushed the nette:master branch 2 times, most recently from 5f19501 to 105a1af Jan 2, 2017

@medhi

This comment has been minimized.

Copy link

commented Jan 14, 2017

So what is the result? It seems, that it is still not possible to translate control with form translator, but leave control items untranslated. Is that right? Because use case, when selectbox items are gathered from database is very common.

@dg dg force-pushed the dg:translator branch from 407d326 to 8004048 Jan 16, 2017

@dg

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2017

I think it can be merged to 3.0-dev

@dg dg force-pushed the nette:master branch 14 times, most recently from a6ec22a to c2c4dc3 Jan 23, 2017

@dg dg force-pushed the nette:master branch 2 times, most recently from 454e643 to a8c2e65 Feb 2, 2017

@dg dg force-pushed the nette:master branch 2 times, most recently from 571b36c to 841e5de Mar 29, 2017

@dg dg force-pushed the dg:translator branch from 8004048 to 6271110 Jun 19, 2017

@dg dg merged commit 782b319 into nette:master Jun 21, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
coverage/coveralls Coverage increased (+0.007%) to 94.588%
Details

@dg dg deleted the dg:translator branch Jun 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.