-
Improvement
-
Resolution: Fixed
-
Normal
-
None
-
None
-
None
For MBS-5651 I would have loved to do something like:
l('Review the {doc|list of packaging types|target="_blank"} for help.', { doc => doc_link('Release/Packaging') })
I'm sure there are places where a |class="foo" could be useful as well, and there are probably plenty of other cases. I don't much care for how the syntax ends up being, as long as it becomes possible.
The current substitution happens in lib/MusicBrainz/Server/Translation.pm::_expand : $string =~ s/{($re)|(.*?)}/defined $args{$1} ? "<a href=\"" . $args{$1} . "\">" . (defined $args{$2} ? $args{$2} : $2) . "<\/a>" : "{$0}"/ge;
One possible way, as mentioned by Kuno in #musicbrainz-devel, is to make it accept something other than strings. This would allow us to still be able to say something similar to:
l('{url|some text}', { url => { href => doc_link('Some_text'), class => 'some-text-class', id => 'not-just-some-test', target => 'SuperFrame', hreflang => 'nxx', }})
- ie., adding more power/flexibility to the developers, without increasing complexity for translators! \o/