I work with liferay 5.2
I want to display same message related to the current language of liferay
the code of this message is in the velocity lnaguage
this is the source code navigation.vm
<div id="navigation" class="sort-pages modify-pages">
<ul>
#foreach ($nav_item in $nav_items)
#if (($nav_item.getTitle() == 'register_correspondence') )
#if ($nav_item.hasChildren())
#foreach ($nav_child in $nav_item.getChildren())
<li >
<a href="$nav_child.getURL()" $nav_child.getTarget()>
<span >$nav_child.getName()</span>
</a>
</li>
#end
#end
#end
#if (($nav_item.getTitle() == 'reports') )
#if ($nav_item.isSelected())
#set ($nav_item_class = "selected")
#else
#set ($nav_item_class = "")
#end
<li>
#if (($nav_item.getTitle() == 'logout'))
<a href="$sign_out_url" $nav_item.getTarget()>
<span class="$nav_item.getTitle()">$nav_item.getName()</span>
</a>
#else
<a href="$nav_item.getURL()" $nav_item.getTarget()>
<span class="$nav_item.getTitle()">$nav_item.getName()</span>
</a>
#end
#if ($nav_item.hasChildren())
<ul class="child-menu">
#foreach ($nav_child in $nav_item.getChildren())
#if ($nav_child.isSelected())
#set ($nav_child_class = "selected")
#else
#set ($nav_child_class = "")
#end
<li class="$nav_child_class">
<a href="$nav_child.getURL()" $nav_child.getTarget()>$nav_child.getName()</a>
</li>
#end
</ul>
#end
</li>#end
#end
#if ($show_sign_out)
<li class="$nav_child_class">
<A HREF="$sign_out_url" onCLick="return confirm(' Are you sure you want to log out ')"> <font color="FF0000">
Logout
</font>
</A>
</li>
#end
</ul>
</div>
my message is in this balise
<li class="$nav_child_class">
<A HREF="$sign_out_url" onCLick="return confirm(' Are you sure you want to log out ')"> <font color="FF0000">
Logout
</font>
</A>
</li>
I want to displya this message ralated to the current language of liferay
meaning when the language is french the message will be displayed in the french
I try without succes with this code :
<div id="navigation" class="sort-pages modify-pages">
<ul>
#foreach ($nav_item in $nav_items)
#if (($nav_item.getTitle() == 'register_correspondence') )
#if ($nav_item.hasChildren())
#foreach ($nav_child in $nav_item.getChildren())
<li >
<a href="$nav_child.getURL()" $nav_child.getTarget()>
<span >$nav_child.getName()</span>
</a>
</li>
#end
#end
#end
#if (($nav_item.getTitle() == 'reports') )
#if ($nav_item.isSelected())
#set ($nav_item_class = "selected")
#else
#set ($nav_item_class = "")
#end
<li>
#if (($nav_item.getTitle() == 'logout'))
<a href="$sign_out_url" $nav_item.getTarget()>
<span class="$nav_item.getTitle()">$nav_item.getName()</span>
</a>
#else
<a href="$nav_item.getURL()" $nav_item.getTarget()>
<span class="$nav_item.getTitle()">$nav_item.getName()</span>
</a>
#end
#if ($nav_item.hasChildren())
<ul class="child-menu">
#foreach ($nav_child in $nav_item.getChildren())
#if ($nav_child.isSelected())
#set ($nav_child_class = "selected")
#else
#set ($nav_child_class = "")
#end
<li class="$nav_child_class">
<a href="$nav_child.getURL()" $nav_child.getTarget()>$nav_child.getName()</a>
</li>
#end
</ul>
#end
</li>#end
#end
#if ($show_sign_out)
<script type="text/javascript">
var varlang = "$themeDisplay.getLocale()";
if( varlang == 'en_US') {
document.write('<li class="$nav_child_class">
<A HREF="$sign_out_url" onCLick="return confirm(' Are you sure you want to log out ')"> <font color="FF0000">
Logout
</font>
</A>
</li>');
}
else
{
document.write('<li class="$nav_child_class">
<A HREF="$sign_out_url" onCLick="return confirm(' Etes-vous sûr que vous voulez vous déconnecter ')"> <font color="FF0000">
Déconnexion
</font>
</A>
</li>');
}
</script>
#end
</ul>
</div>
I make my test in the javascript code I add this line var varlang = "$themeDisplay.getLocale()";
but when I test I have this error :
Uncaught SyntaxError: Unexpected token ILLEGAL
I only changes the code in this section
#if ($show_sign_out)