Register | Forgot password
All Blogs...
For example, let's take a look at my first attempt of a very basic presentation for a pagecollection element:
<%-- Patrick's Very Basic pageCollectionElement.jspf --%>
<%@ page language="java" session="false" buffer="none" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.gx.nl/taglib/wm" prefix="wm" %>
<c:set var="pageCollectionElement" value="${presentationcontext.element}" />
<ul>
<c:forEach var="page" items="${pageCollectionElement.pages}">
<%-- This is where the action is --%>
<wm:link var="link" reference="${item}" />
<li>${link.htmlTag}</li>
</c:forEach>
</ul>
Cute, isn't it?
Now I would like to just print the name without a link and print "Read more" linked behind it. That's just how I like my page collections. Call me crazy.One way to do that, would be to make the code like this:
<%-- This is where the action is --%>
<c:set var="pageTitle" value="${item.current.title}" />
<wm:link var="link" title="Read more" reference="${item}" />
<li>${pageTitle} (${link.htmlTag})</li>
But wait a minute... The "Read more" text is now fixed for this design. If the same presentation is used on the Japanese site, it will still say "Read more" instead of "多くを読みなさい".
Luckily there is a way to avoid this: use text labels. By using text labels, strings can be retrieved from GX WebManager, where a webmaster can define which text should be used for which language. There are a few rules to abide by when using text labels:
Using these rules, I end up with the aptly named text label "project.pa_read_more".
My code becomes something like this:
<%-- This is where the action is --%>
<c:set var="pageTitle" value="${item.current.title}" />
<wm:text var="readMoreText" label="project.pa_read_more">
<wm:link var="link" title="${readMoreText}" reference="${item}" />
<li>${pageTitle} (${link.htmlTag})</li>
So all we now need to do is head over to "Configure > Language labels", select "English" as language and scroll down to "pa_read_more" and edit in "Read more". Or select "Japanese" as language and fill in "多くを読みなさい".
And presto! No more need to change the presentation code for each and every language version. So... whenever you encounter hardcoded text in a layout, be sure to use text labels. Think: "wm:text is my friend! " It will save your hide later on!
Return to all blogs
Patrick Atoon has gained nuff respect as one of the most experienced web architects in the GX Webmanager community or even the global hip hop community for that matter.
Read all Patricks blog entries
Other blog entries: