i18n internationalization with html code as param

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

i18n internationalization with html code as param

Asheara
This post was updated on .
Hello,

Im new to thymeleaf, I've been looking around the forum and din't find the same problem posted Im facing now.

In my app I have the typical "forgot password" link that looks like:

<nabble_embed><a href="../rmbPass.html" th:href="@{/rmbPass}" th:text="#{link.here}"></a></nabble_embed>

And I have another property created that looks like:

access.form.remember = If you forgot your password, click {0}

where the param is waiting for the full link with its "here" text included.

I tried passing the full code of the link above to <p class="rmbPass" th:utext="#{access.form.remember(...)}"... but either I surround the link with comas or not it doesn't work and comes up with a parsing error.

I've read this section too http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#more-on-texts-and-variables and try to something similar but it didn't work out with a full link

I've tried to concat as I saw one guy doing it in another post, but his case was just to concat a simple '< /br>' code.

So, is there any way to have a fully internationalized forgot pass link with the link surrounding just the word "here", I mean a way to put together these two properties:

<nabble_embed><p class="rmbPass" th:text="#{access.form.remember}"> <a href="../rmbPass.html" th:href="@{/rmbPass}" th:text="#{link.here}"></a></p></nabble_embed>

I know this is very easy to do with fmt and jstl libraries, but as I said Im completely new to thymeleaf

Thank you in advance
Reply | Threaded
Open this post in threaded view
|

Re: i18n internationalization with html code as param

Zemi
Administrator
Hello,

you can pass parameters to i18n messages using parenthesis, as in

   #link.here('foo')

Said that, you probably don't want to put that inside an anchor, so your code should look like

  <p th:utext="#{link.here('http://www.google.com/')}"></p>

and the i18n file

  link.here=If you forgot your password, click <a href="{0}">here</a>

Regards,
   Zemi



Reply | Threaded
Open this post in threaded view
|

Re: i18n internationalization with html code as param

Asheara
That worked out!

Thank you!