掲示板
Velocity template for webcontent and localization
11年前 に Becas Vasilis によって更新されました。
Velocity template for webcontent and localization
Junior Member 投稿: 28 参加年月日: 12/08/30 最新の投稿
Hey,
I am not sure if my post is in right section, but is relevant for sure.
I have created a a new web content structure with 3 fields. Description, Image and MoreInfo.
I have created also a template (using velocity) for that structure. The template looks something like this:
Is it possible to get the localized value for More Info in <h2></h2>
I tried #set ($a = $languageUtil.get($locale, “more-info”))
and then
<h2> $a </h2>
But i get an error. Maybe the above solution works only for theme templating(?)
Any help to archive that would be great.
With Regards,
Vasilis
I am not sure if my post is in right section, but is relevant for sure.
I have created a a new web content structure with 3 fields. Description, Image and MoreInfo.
I have created also a template (using velocity) for that structure. The template looks something like this:
<h1> $reserved-article-title.getData()</h1>
<div id="myarticle">
<div class="articleImage">
<img alt="" src="$image.getData()">
</div>
<div class="descriptionArticle">
$description.getData()
</div>
<hr>
<h2>More Info</h2> <--- Localized value??
<div class="moreInfo">
$preparation.getData()
</div>
</div>
Is it possible to get the localized value for More Info in <h2></h2>
I tried #set ($a = $languageUtil.get($locale, “more-info”))
and then
<h2> $a </h2>
But i get an error. Maybe the above solution works only for theme templating(?)
Any help to archive that would be great.
With Regards,
Vasilis
11年前 に Prasanna Raj によって更新されました。
RE: Velocity template for webcontent and localization
Junior Member 投稿: 68 参加年月日: 12/01/30 最新の投稿
can you check this post?
http://www.liferay.com/community/forums/-/message_boards/message/10703201
HTH
http://www.liferay.com/community/forums/-/message_boards/message/10703201
HTH
11年前 に Becas Vasilis によって更新されました。
RE: Velocity template for webcontent and localization
Junior Member 投稿: 28 参加年月日: 12/08/30 最新の投稿
Hey Prasanna,
Thanks for the response, but i do not see how that can help me. I can use the localization for the structure fields with no problem.
My problem is using localization inside the velocity template for non user inputs.
As i said in my previous post.
So my problem is using localization for the static text above. Not the user inputs. With that i do not have a problem.
Thanks
Thanks for the response, but i do not see how that can help me. I can use the localization for the structure fields with no problem.
My problem is using localization inside the velocity template for non user inputs.
As i said in my previous post.
<h1> $reserved-article-title.getData()</h1> [b]<-- USER INPUT. Localization OK[/b]
<div id="myarticle">
<div class="articleImage">
<img alt="" src="$image.getData()"> [b]<-- USER INPUT. Localization OK[/b]
</div>
<div class="descriptionArticle">
$description.getData() [b]<-- USER INPUT. Localization OK[/b]
</div>
<hr>
<h2>More Info</h2> [b]<--- Localized value here?? Static text[/b]
<div class="moreInfo">
$preparation.getData() [b]<-- USER INPUT. Localization OK[/b]
</div>
</div>
So my problem is using localization for the static text above. Not the user inputs. With that i do not have a problem.
Thanks
11年前 に Amos Fong によって更新されました。
RE: Velocity template for webcontent and localization (回答)
Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
If this is an already existing language key or you can add a language key through a hook, you can use:
$languageUtil.get($locale, "more-info")
Otherwise, you'll probably have to do something like:
#if ($locale.toString().equals("xxx"))
More info
#elseif (...)
More info in spanish
#elseif (...)
more info in german
#end
$languageUtil.get($locale, "more-info")
Otherwise, you'll probably have to do something like:
#if ($locale.toString().equals("xxx"))
More info
#elseif (...)
More info in spanish
#elseif (...)
more info in german
#end
9年前 に Jacques Traore によって更新されました。
RE: Velocity template for webcontent and localization
Junior Member 投稿: 49 参加年月日: 13/01/21 最新の投稿
Hi everyone,
Is there any way to force localization of a user input in velocity template (LF 6.2 CE)?
This is the requirement:
- Before liferay 6.2 there was a localization checkbox when creating custom structure. If a user input is not specified as localizable then the default one will be fetched in the template.
- In 6.2, that checbox is no longer available. Instead of editing all contents with that structure, I wanted to modify the template to get the English data for some specific fields (like Firstname, Lastname, Picture, ...).
Thanks in advance
Is there any way to force localization of a user input in velocity template (LF 6.2 CE)?
This is the requirement:
- Before liferay 6.2 there was a localization checkbox when creating custom structure. If a user input is not specified as localizable then the default one will be fetched in the template.
- In 6.2, that checbox is no longer available. Instead of editing all contents with that structure, I wanted to modify the template to get the English data for some specific fields (like Firstname, Lastname, Picture, ...).
Thanks in advance