translationtyposcripttypolink

Typoscript wrap a wrapper


I'm fairly new to typoscript and the manual (which I tried to read) isn't that helpful.

I have the following typoscript:

30 = TEXT
  30 {
    typolink {
      parameter = 1079
      returnLast = url
    }
    wrap (
            <li class="mod-metanav--item">
             <a class="mod-metanav--link" href="|">
              Help
             </a>
            </li>
    )

  }

Now, the word «Help» needs to be translated.

I found out that I can use something like this to translate text in TS

5 = TEXT
5.data = LLL:fileadmin/content/translation.xml:help
5.wrap(
<li class="mod-metanav--item">
  <span style="font-size: 10px; color: #777;">|</span>
</li>
)

But, I need to kind of double-wrap the text (5) into the link (30) and that's where I fail.

I found some documentation on wrap2/wrap3 and innerWrap/outerWrap, but there aren't any examples that match my case and I can't adapt the examples I find to my case...

The first part (30) was made by someone else and I have the suspicion that there's another way to achieve this...

Any hints?


Solution

  • For all who run into the same problem - here's what I came up with:

    30 = TEXT
      30 {
        typolink {
          parameter = 1079
          returnLast = url
        }
        wrap (
                 <a class="mod-metanav--link" href="|">
    
        )
    
        prepend = COA
        prepend{
          10 = TEXT
          10.value = <li class="mod-metanav--item">
        }
    
        append = COA
            append{
                10 = TEXT
                10.data = LLL:fileadmin/content/translation.txt:hilfe
                10.wrap(
                    |
                    </a>
                    </li>
                )
            }
      }
    

    The trick is to pre-/append the additional parts.

    Still it feels like an ugly hack and I'm sure I'm supposed to put the HTML-part into the template.