Skip to content

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

Merged
dg merged 1 commit intonette:masterfrom
dg:translator
Jun 21, 2017
Merged

BaseControl, SelectBox: labels and prompt are translated by global translator#58
dg merged 1 commit intonette:masterfrom
dg:translator

Conversation

@dg
Copy link
Member

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

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

@dg
Copy link
Member Author

dg commented Jan 30, 2015

setTranslator has sense for items on Choice & MultiChoiceControl.

@dg dg force-pushed the translator branch 2 times, most recently from 9303edc to 45e02e5 Compare February 6, 2015 01:59
@dg dg force-pushed the master branch 2 times, most recently from b644bbd to 3b543ff Compare February 6, 2015 03:50
@solcik
Copy link
Contributor

solcik 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 master branch 4 times, most recently from 75b0565 to 72a5c56 Compare February 8, 2015 13:00
@Olicek
Copy link

Olicek 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 master branch 4 times, most recently from 164ee7d to 7b7189f Compare February 18, 2015 11:04
@tomaswindsor
Copy link
Contributor

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 master branch 2 times, most recently from 131f7d2 to 532059a Compare May 21, 2015 11:49
@dg dg force-pushed the master branch 2 times, most recently from a57a557 to 55d0eb8 Compare June 19, 2015 12:05
@dg dg force-pushed the master branch 2 times, most recently from 81549c5 to 98832d3 Compare June 7, 2016 11:43
@dg dg force-pushed the master branch 7 times, most recently from 33344ff to 312ca1b Compare June 30, 2016 13:48
@dg dg force-pushed the master branch 3 times, most recently from 802f3d4 to ed7ecd7 Compare June 30, 2016 18:18
@dg dg force-pushed the master branch 3 times, most recently from 27d3e69 to 57295d1 Compare July 9, 2016 12:02
@dg dg force-pushed the master branch 2 times, most recently from 5f19501 to 105a1af Compare January 4, 2017 14:16
@zraly
Copy link

zraly 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
Copy link
Member Author

dg commented Jan 16, 2017

I think it can be merged to 3.0-dev

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.

6 participants