5 Replies Latest reply on Nov 21, 2008 1:22 PM by pdimilla

    rich:calendar apply button i18n not working for me

      Hello,

      Thank you in advance for any help you can give me. I have had mixed results in trying to internationalize rich:calendar. The month and day names work fine. Apply, Today and the other buttons always end up using the strings specified in my en_US properties file regardless of locale. I do have property files for my other locales and I do define the correct translations for RICH_CALENDAR_TODAY_LABEL, etc. I have read the other posts on this subject and have tried the solution that has worked for the others; however, it is not working for me. Am I doing too much?

      Here's what I have in faces-config.xml:

      <application>
       <locale-config>
       <default-locale>en_US</default-locale>
       <supported-locale>en_US</supported-locale>
       <supported-locale>en_UK</supported-locale>
       <supported-locale>fr_CA</supported-locale>
       <supported-locale>es_ES</supported-locale>
       <supported-locale>en</supported-locale>
       <supported-locale>fr</supported-locale>
       <supported-locale>es</supported-locale>
       </locale-config>
       <message-bundle>
       com.myco.resources.my_messages
       </message-bundle>
      </application>


      Here is where I define my calendar:

      <rich:calendar id="tsoDateTime" popup="true"
       firstWeekDay="#{msgs.submitRequestDialogFirstWeekDay}"
       monthLabels="#{msgs.submitRequestDialogMonthLabels}"
       monthLabelsShort="#{msgs.submitRequestDialogMonthLabelsShort}"
       weekDayLabels="#{msgs.submitRequestDialogWeekDayLabels}"
       weekDayLabelsShort="#{msgs.submitRequestDialogWeekDayLabelsShort}"
       showApplyButton="true"
       locale="#{msgs.submitRequestDialogLocale}"
       datePattern="#{msgs.submitRequestDialogDateFormat}"
       value="#{supportrequestbean.timeStamp}">
      </rich:calendar>


      I also define the msgs variable at the beginning:

      <body >
       <f:view locale="#{mednetSessionInfo.locale}">
       <a4j:loadBundle
       basename="com.myco.resources.my_messages"
       var="msgs"/>


      And here is the resources from my_messages_fr_CA:

      submitRequestDialogLocale=fr/CA
      submitRequestDialogDateFormat=d/M/yyyy HH:mm
      submitRequestDialogFirstWeekDay=1
      submitRequestDialogMonthLabels=janvier,février,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre
      submitRequestDialogMonthLabelsShort=jan,fév,mar,avr,mai,juin,juil,août,sep,oct,nov,déc
      submitRequestDialogWeekDayLabels=dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi
      submitRequestDialogWeekDayLabelsShort=dim,lun,mar,mer,jeu,ven,sam
      RICH_CALENDAR_APPLY_LABEL=Appliquer
      RICH_CALENDAR_TODAY_LABEL=aujourd'hui
      RICH_CALENDAR_CLOSE_LABEL=Fermer
      RICH_CALENDAR_OK_LABEL=OK
      RICH_CALENDAR_CLEAN_LABEL=nettoyer
      RICH_CALENDAR_CANCEL_LABEL=Annuler


      Please note that my calendar is contained within a form that is within a modalPanel.

      I am using RichFaces 3.2.2, JBoss 4.2.2.GA and IE 6.

      Thank You,
      Paul

        • 1. Re: rich:calendar apply button i18n not working for me

          Hello, Paul.

          rich:calendar apply, cancel and others button i18n working fine for me.
          Follow the next instructions:

          1) Set supported locales in faces-config:

          <application>
           <locale-config>
           <default-locale>en_US</default-locale>
           <supported-locale>en_US</supported-locale>
           <supported-locale>en_UK</supported-locale>
           <supported-locale>fr_CA</supported-locale>
           <supported-locale>ru_RU</supported-locale>
           <supported-locale>es_ES</supported-locale>
           <supported-locale>en</supported-locale>
           <supported-locale>fr</supported-locale>
           <supported-locale>es</supported-locale>
           </locale-config>
          </application>

          2) Add properties files in following package inside your resource folder:

          org.richfaces.renderkit.calendar_fr_CA.properties
          org.richfaces.renderkit.calendar_ru_RU.properties


          3) Fill properties files using RICH_CALENDAR_APPLY_LABEL, RICH_CALENDAR_TODAY_LABEL ...

          4) Define locale calendar attribute:
          <rich:calendar ...locale="#{calendarBean.locale}"
          


          See result for russian internalization:
          [url=http://www.freeimagehosting.net/image.php?ccb97293eb.png][img]http://www.freeimagehosting.net/uploads/th.ccb97293eb.png[/img][/url]

          If it will not help you, let us know.

          • 2. Re: rich:calendar apply button i18n not working for me

            Thank you for the reply. I tried a couple of the things you mentioned and it is still not working. I think I may be missing something.

            1) I created a file called org.richfaces.renderkit.calendar_fr_CA.properties. I placed all of my "_LABEL" resources in it. I then placed the file in the same folder as my other resource files. Was this correct or was I supposed to use a org.richfaces.renderkit.calendar_fr_CA.properties file that comes with RichFaces? And did I put it in the correct place?

            2) I removed the message-bundle tag that I had in faces-config.xml so that my faces-config looks like yours. This did not correct the problem either.

            I am going to play around with locale next; although, I thought I was already setting this correctly. Perhaps not...

            • 3. Re: rich:calendar apply button i18n not working for me

              I discovered one of my errors; however, this did not fix the problem either.

              Rather than name my properties file org.richfaces.renderkit.calendar_fr_CA.properties and putting it in the same folder as my other properties files (which is WEB-INF\classes\com\myco\resources), I named it calendar_fr_CA.properties and placed it in WEB-INF\classes\resources\org\richfaces\renderkit.

              Again, this did not work for me either.

              • 4. Re: rich:calendar apply button i18n not working for me
                ilya_shaikovsky

                pdimilla, please send me the war sample with sources directly. I'll check it and correct if need. It will be faster to update you in this way.

                • 5. Re: rich:calendar apply button i18n not working for me

                  Solved it! It turns out I had three remaining errors. Here are the fixes:

                  1) I placed org\richfaces\renderkit\calendar_fr_CA properties directly under WEB-INF\classes rather than under WEB-INF\classes\resources.

                  2) I am now getting the locale from a backing bean rather than from my messages.properties file.

                  3) I discovered that the apostrophe in the word "aujourd'hui" was causing my calendar not to open. Once I removed the apostrophe, the calendar opened and all my buttons had their translations.

                  Thanks again for your help!

                  Paul