[Building Sakai] Internationalizing a confirmation in RSF

Steve Swinsburg steve.swinsburg at gmail.com
Mon Sep 17 16:40:28 PDT 2012


Hi Brian,

Just do it all in the HTML, you dont need a Javascript method to handle this since confirm() returns a boolean anyway. RSF has a tag that you can use to get the message directly in the HTML.

Some pseudo code:

onclick="return confirm('rsf:id="msg=confirm.message"')"

cheers,
Steve



On 18/09/2012, at 9:31 AM, Matthew Jones <matthew at longsight.com> wrote:

> I'm not sure if there's a better way for RSF on the confirmation, but that sounds like the most compatible way Pre-2.9. After 2.9 the language was added as a javascript variable to the headers which makes it easier to do a lookup with the jquery-i18n-properties. This probably only a good idea if you have a lot of messages to lookup. Here are the rest of the best practices.
> 
> https://confluence.sakaiproject.org/display/I18N/Best+Practices+for+Internationalized+Tools+in+Sakai
> 
> On Mon, Sep 17, 2012 at 5:43 PM, Brian Baillargeon <bbailla2 at uwo.ca> wrote:
> Hello all
> 
> When somebody submits a particular form, I'd like to have a yes/no
> confirmation dialog where the text is internationalized. This is in the
> context of RSF.
> So I was thinking of using a javascript confirm to do this, but I want
> it to show text from Messages.properties.
> 
> So for example,
> Messages.properties:
> ...
> confirm.message=Are you sure you want to proceed?
> ...
> 
> MyForm.html:
> ...
> <script>
> function confirmSubmit()
> {
>      var agree=confirm(<Pull me from Messages.properties>);
>      if (agree)
>          return true;
>      else
>          return false;
> }
> </script>
> ...
> <input class="submit" type="submit" onclick="return confirmSubmit()"
> rsf:id="submitClaim" />
> ...
> 
> How can this be done? / Is there a better way to approach this in RSF?
> 
> Thanks,
> Brian
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120918/5a5023a6/attachment.html 


More information about the sakai-dev mailing list