Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Calendar Internationalization

Expand Messages
  • Frank Dietrich
    I use the YUI Calendar since some month into a French and internationalizable application. Currently I configure the calendar for French users by putting this
    Message 1 of 4 , Nov 3, 2008
    • 0 Attachment

      I use the YUI Calendar since some month into a French and internationalizable application. Currently I configure the calendar for French users by putting this code in the end of each pages who use the calendar (where �fmt:message" retrieve a string  from a file that store internationalized messages):

       

      ....

       

      But I need to copy and paste these lines everywhere. Is there a way for internaltionalize the YUI Calendar ?

       

       
      You might either subclass the calendar or, like I did, create a function that You call directly after instantiating the calendar.
       
      This is what I do for German internationalization:
       
          YAHOO.ddTech.ZLB.app.calendarTimesForm =
              new YAHOO.widget.Calendar('calendarTimesForm', 'calendar_TimesForm');
         
          localizeCalendar(YAHOO.ddTech.ZLB.app.calendarTimesForm);

          YAHOO.ddTech.ZLB.app.calendarTimesForm.selectEvent.subscribe(
               function(type, args, obj) {.....});
       
          ....
       
          

          // Initialisieren der Calender f�r Deutschland
          var localizeCalendar =  function(toCal){
            YAHOO.log("localizing Calendar", "info", "Calendar.js");
       
            // Correct formats for Germany: dd.mm.yyyy, dd.mm, mm.yyyy
            toCal.cfg.setProperty("DATE_FIELD_DELIMITER", ".");
            toCal.cfg.setProperty("START_WEEKDAY", 1);
       
            toCal.cfg.setProperty("MDY_DAY_POSITION", 1);
            toCal.cfg.setProperty("MDY_MONTH_POSITION", 2);
            toCal.cfg.setProperty("MDY_YEAR_POSITION", 3);
       
            toCal.cfg.setProperty("MD_DAY_POSITION", 1);
            toCal.cfg.setProperty("MD_MONTH_POSITION", 2);
       
            // Date labels for German locale
            toCal.cfg.setProperty("MONTHS_SHORT", 
             ["Jan", "Feb", "M\u00E4r", "Apr", "Mai", "Jun",
              "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]);
            toCal.cfg.setProperty("MONTHS_LONG", 
             ["Januar", "Februar", "M\u00E4rz", "April", "Mai", "Juni",
              "Juli", "August", "September", "Oktober", "November", "Dezember"]);
            toCal.cfg.setProperty("WEEKDAYS_1CHAR", ["S", "M", "D", "M", "D", "F", "S"]);
            toCal.cfg.setProperty("WEEKDAYS_SHORT", ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]);
            toCal.cfg.setProperty("WEEKDAYS_MEDIUM",
             ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"]);
            toCal.cfg.setProperty("WEEKDAYS_LONG", 
             ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]);
       
          };
       
       
      Hope that helps
       
      Frank
    Your message has been successfully submitted and would be delivered to recipients shortly.