Hello,
I'm working with AEM6 and Sightly and have an issue with our message keys.
Until now we had some text output like
<fmt:message key="message.key.${variable}" />
Now I would like to use this format: ${'message.key' @ i18n}
I thought, I found the solution by using
${'message.key.part.{0}.another.part.{1}' @ i18n, format=[variable1, variable2]}
but the format-option only injects the values of variable1 and variable2 into the translation of the provided message key at the corresponding placeholders.
Other combinations like ${'message.key.'variable @ i18n} or ${'message.key.${variable}' @ i18n} failed.
I hope someone can provide a solution :-)
Best regards
Matthias
Solved! Go to Solution.
Views
Replies
Total Likes
You can first concat it into one string and assign it to sightly variable using data-sly-test. See the snippet below
<div data-sly-test.prefix="next">
<div data-sly-test.suffix="text">
<div data-sly-test.i18key="${prefix}.${suffix}">
Value - ${i18key @ i18n}
You can also use @format to form a single string and assign it to sightly variable using data-sly-test.<variablename>
<div data-sly-test.key="${ '{0}.{1}' @ format=['next','text']}">
Value - ${key @ i18n}
I guess above should help.
Cheers
- Runal
You can first concat it into one string and assign it to sightly variable using data-sly-test. See the snippet below
<div data-sly-test.prefix="next">
<div data-sly-test.suffix="text">
<div data-sly-test.i18key="${prefix}.${suffix}">
Value - ${i18key @ i18n}
You can also use @format to form a single string and assign it to sightly variable using data-sly-test.<variablename>
<div data-sly-test.key="${ '{0}.{1}' @ format=['next','text']}">
Value - ${key @ i18n}
I guess above should help.
Cheers
- Runal
Hello Runal,
thx for your reply.
I used the format-version and it works!
Very nice idea.
Kind regards
Matthias
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies