blob: 9e73c5c73d56b185c7b91592570d16655baf624d [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<ui:composition template="/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:c="http://java.sun.com/jsp/jstl/core">
<p>Use the EL functions from <code>tc:format1</code> to <code>tc:format9</code>
to replace up to 9 variables in a given internationalized text.
This work like in
<tc:link label="java.text.MessageFormat"
link="https://docs.oracle.com/javase/6/docs/api/java/text/MessageFormat.html"/>.</p>
<ui:param name="format1text" value="The equatorial radius of the sun is {0} km."/>
<ui:param name="format3text"
value="The temperature of the sun is {0} K on the surface, but {1} K in the center and {2} K in the corona."/>
<ui:param name="format9text" value="Just reordering: {4} - {1} - {6} - {8} - {5} - {3} - {0} - {7} - {2}"/>
<tc:section label="Format 1">
<p>The message format is: "#{format1text}"</p>
<pre><code class="language-markup">&lt;tc:out value="\#{tc:format1(format1text, 695700)}"/></code></pre>
<tc:out id="o1" value="#{tc:format1(format1text, 695700)}"/>
</tc:section>
<tc:section label="Format 3">
<p>The message format is: "#{format3text}"</p>
<pre><code
class="language-markup">&lt;tc:out value="\#{tc:format3(format3text, 5800, 15700000, 5000000)}"/></code></pre>
<tc:out id="o2" value="#{tc:format3(format3text, 5800, 15700000, 5000000)}"/>
</tc:section>
<tc:section label="Format 9">
<p>The message format is: "#{format9text}"</p>
<pre><code
class="language-markup">&lt;tc:out value="\#{tc:format9(format9text, 0, 1, 2, 3, 4, 5, 6, 7, 8)}"/></code></pre>
<tc:out id="o3" value="#{tc:format9(format9text, 0, 1, 2, 3, 4, 5, 6, 7, 8)}"/>
</tc:section>
<tc:section label="UpperCase">
<p>You may also use the <code>fn:</code> function library for string manipulation.</p>
<pre><code class="language-markup">&lt;tc:out value="\#{fn:toUpperCase('uppercase')}"/></code></pre>
<tc:out id="o4" value="#{fn:toUpperCase('uppercase')}"/>
</tc:section>
</ui:composition>