[ 
https://issues.apache.org/jira/browse/RAVE-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185897#comment-13185897
 ] 

Anthony Carlucci edited comment on RAVE-299 at 1/13/12 10:02 PM:
-----------------------------------------------------------------

We now have internationalization support in our javascript code for messages 
that need to be displayed via javascript.  Simply:

1) Add messages to the java messages.properties files with keys that start with 
"_rave_client." (see bottom of file)

2) Ensure your JSP page is loading the rave_client_messages.js controller path:

<script src="<spring:url 
value="/app/messagebundle/rave_client_messages.js"/>"></script>

3) Access the text on the client side by using: rave.getClientMessage(key).  
Note that the key will NOT contain the "_rave_client. prefix".

Example:  rave.getClientMessage("api.error")

Dutch translations courtesy of Google Translate...

Still TODO: improve performance by caching the javascript response content per 
locale in the controller rather than generating it with every request

                
      was (Author: carlucci):
    We now have internationalization support in our javascript code for 
messages that need to be displayed via javascript.  Simply:

1) Add messages to the java messages.properties files with keys that start with 
"_rave_client." (see bottom of file)

2) Ensure your JSP page is loading the rave_client_messages.js controller path:

<script src="<spring:url 
value="/app/messagebundle/rave_client_messages.js"/>"></script>

3) Access the text on the client side by using: rave.getClientMessage(key)  ie: 
rave.getClientMessage
("_rave_client.api.error")

Dutch translations courtesy of Google Translate...

Still TODO: improve performance by caching the javascript response content per 
locale in the controller rather than generating it with every request

                  
> Create mechanism for using message bundle text inside javascript code
> ---------------------------------------------------------------------
>
>                 Key: RAVE-299
>                 URL: https://issues.apache.org/jira/browse/RAVE-299
>             Project: Rave
>          Issue Type: Improvement
>    Affects Versions: 0.5-INCUBATING
>            Reporter: Anthony Carlucci
>            Assignee: Anthony Carlucci
>            Priority: Minor
>
> Come up with a common way for using java message bundle text inside our 
> javascript code.  A good example is a javascript alert or confirmation dialog 
> box that we currently have to hard-code the text for inside the javascript 
> code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to