add a common method for title formatting and translation

This commit is contained in:
zzz
2009-10-20 12:12:26 +00:00
parent dc6d6ead69
commit 45a59f009b
5 changed files with 40 additions and 15 deletions

View File

@ -27,13 +27,16 @@ do
# translate calls must be one of the forms:
# _("foo")
# cssHelper._("foo")
# cssHelper.title("foo")
# handler._("foo")
# formhandler._("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find src ../jsp/WEB-INF -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java --keyword=_ --keyword=cssHelper._ --keyword=handler._ --keyword=formhandler._ -o ${i}t
xgettext -f $TMPFILE -F -L java \
--keyword=_ --keyword=cssHelper._ --keyword=cssHelper.title --keyword=handler._ --keyword=formhandler._ \
-o ${i}t
if [ $? -ne 0 ]
then
echo 'Warning - xgettext failed, not updating translations'

View File

@ -28,4 +28,15 @@ public class CSSHelper extends HelperBase {
if (lang != null && lang.length() > 0)
_context.router().setConfigSetting(Messages.PROP_LANG, lang);
}
/** translate the title and display consistently */
public String title(String s) {
StringBuilder buf = new StringBuilder(128);
buf.append("<title>")
.append(_("I2P Router Console"))
.append(" - ")
.append(_(s))
.append("</title>");
return buf.toString();
}
}