Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-5734

Make it possible for url|text substitutions to also have arbitrary attributes

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2014-03-03
    • 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/

            ianmcorvidae Ian McEwen
            freso Freso
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2014-03-03