Skip to content

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

Description

@ne0-cz

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions