Showing a parameterized string for localization purpose - jsf

Is there a way to have a parmeterized string in resource bundle? I need this as the order of nouns can be different in different languages.
For e.g. in my English bundle I will have
love_message={0} loves {1}
And my Latin translator will pick it up and do
love_message={0} {1} amet
And in my page I will have something like
<h:outputText value="#{bundle.love_message,John,Jenny}" />
(If this would have been possible)
So that my English translated page reads
Jonh love Jenny
And Latin page reads
John Jenna amet.
How can I achieve this?

Use <h:outputFormat> instead of <h:outputText>. It can take those parameters as <f:param>:
<h:outputFormat value="#{bundle.love_message}">
<f:param value="John" />
<f:param value="Kenny" />
</h:outputFormat>

Related

how to restrict the image in only one language in xhtml

I need to include an image in the xhtml page but when I add the image it is showing in all the languages. I want to restict the image only to one english language.
how to restrict it?
<h:graphicImage value="#{resource['images:register_img.png']}" alt="image" width="560px" height="140px" />

How to change the default locale in GXT?

I don't need the default english locale, only pt_BR. If I do this:
<extend-property name="locale" values="pt_BR"/>
...it will generate one permutation for english (which is the default locale) and another one for pt_BR. How can I avoid the default english one?
Try to add two lines
<extend-property name="locale" values="pt_BR" />
<set-property-fallback name="locale" value="pt_BR" />
<set-property name="locale" value="pt_BR" />

Prettyfaces url style search gmail

Good day:
I am conducting a search using prettyFaces, style gmail.
When I do with gmail, space is replaced by a symbol "+". And in the box is not added the "+".
In my case, when I do the same, in other characters url as in my box are added.
Here the mapping code, and box:
<url-mapping id="search">
<pattern value="/buscar/#{ /.*/ searchBean.q}" />
<view-id value="/faces/reqs/search.xhtml" />
<action>#{searchBean.search}</action>
</url-mapping>
<div class="search">
<h:form id="searchForm">
<span class="button-group">
<p:inputText value="#{searchBean.q}" size="50"/>
<p:commandButton action="pretty:search"/>
</span>
</h:form>
</div>
Thanks for the help.
EDIT:
And if facebook would be because it is a parameter? and as it would be a solution to avoid aparesca special characters in the input?
This is expected behavior. In case of GMail the spaces are part of the "fragment" which is the part after the "#" character. In your PrettyFaces setup, the search term is part of the path.
There are different encoding rules for fragments and path parts of the URL. So PrettyFaces is handling this correctly.

text disappears when I use inputMask in primefaces

There is a problem with p:inputMask that I could not understand. I gave nine required area to p:inputMask by putting mask="aaaaaaaaa" . It works fine the problem happens when I write only three letters (below nine letters) and click other fields at screen , the text that I wrote at p:inputMask disappears :( . It works fine when I write nine letters (required letters) at p:inputMask and click other field of the screen, text does not disappear at p:inputMask.
It took a lot time of mine. It should have a simple solution that I could not fine. I would be glad if you can help me.
Here is the Sample Code :
<p:inputMask mask="999" style="width: 25px;text-align: left" readonly="true" value="# {gercekKrediBasvuruDetayGirisKefilView.evTel1Ilk}" />
Try
<p:inputMask mask="?999" style="width: 25px;text-align: left" readonly="true" value="# {gercekKrediBasvuruDetayGirisKefilView.evTel1Ilk}" />
mask="999" requires exactly 3 digits input.
mask="?999" requires 3 digits at most.

Talend - Component Creations - Add a line in output

I'm creating a new component Talend. This component have many data in input (example : a Title, a Content, an Extract and an Author) and it returns same data (but Title, Extract and Content have been modified). So, in output I have the Title modified, the Content modified, the Extract modified and the Author (which it has not been modified).
I would that my component returns another line. A line more. An id for example. Is it possible that my component create new "line" and returns them ?
I don't know if I'm understandable...
Can you help me please ?
Bye.
PS : If you're french : it's a french forum with my problem
I solved my problem.
I must add this in the xml files :
<PARAMETER NAME="SCHEMA" FIELD="SCHEMA_TYPE" REQUIRED="true" NUM_ROW="10">
<TABLE READONLY="false">
<COLUMN NAME="id" TYPE="id_String" LENGTH="255" READONLY="true" CUSTOM="true" />
</TABLE>
</PARAMETER>

Resources