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

Allow passing objects to setOption('description') #142

Closed
ne0-cz opened this issue Feb 9, 2017 · 1 comment
Closed

Allow passing objects to setOption('description') #142

ne0-cz opened this issue Feb 9, 2017 · 1 comment

Comments

@ne0-cz
Copy link

ne0-cz commented Feb 9, 2017

This is probably feature request but some might call it a bug :)

Same thing as #52 but for the Control description (which is translated in Renderer).

I'm using Kdyby\Translation: I'd like to be able to use Phrase (see https://forum.nette.org/cs/22010-kdyby-translation-validacni-message-formu-s-parametry): currently it's possible to use it only as label, not description.

I am running Nette 2.3 (because of Kdyby\Translation compatibility) but based on source code I think it's the same with 2.4:
https://api.nette.org/2.3/source-Forms.Rendering.DefaultFormRenderer.php.html#272
https://api.nette.org/2.4/source-Forms.Rendering.DefaultFormRenderer.php.html#277

I guess I can use Html as a workaround but then I'll end up with two different approaches for translatable strings with parameters depending on context (Control label vs Control description).

Currently the non-Html object is just being ignored: I can try making a PR but I'm afraid I'm not the right person - it makes no sense to me that label is translated in control and description in renderer: I am not really familiar with Forms source and therefore I might cause some horrible BC-break.

Or do you think that something like:

} elseif (is_object(($text) && $translator !== NULL) {
    $text = $translator->translate($text);
}

would be sufficient?

@ne0-cz
Copy link
Author

ne0-cz commented Jun 22, 2017

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

No branches or pull requests

1 participant