Results 1 to 2 of 2

Thread: DatePicker localization

  1. #1

    Join Date
    Aug 2013
    Location
    Paris
    Posts
    13
    Answers
    1

    Default DatePicker localization

    Hello,

    We use the "DatePickerField" component. When the picker appears, titlebar shows the choosen date in English ("Tue, Feb 20 2018" for example).

    How can we localize this date?

    If a dynamic locale is not possible, in our usecase, we can just force the locale (to French). But we did not find a way to achieve this.

  2. #2

    Join Date
    Aug 2013
    Location
    Paris
    Posts
    13
    Answers
    1

    Default

    Found an ExtJS snippet that works:

    Code:
    Ext.onReady(function() {
      Ext.Date.dayNames = ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'];
    
    Ext.Date.monthNames = [
        'Janvier',
    'F\u00e9vrier',
    'Mars',
    'Avril',
    'Mai',
    'Juin',
    'Juillet',
    'Ao\u00fbt',
    'Septembre',
    'Octobre',
    'Novembre',
    'D\u00e9cembre'
    ];
    
    Ext.Date.monthNumbers = {
        'Janvier': 0,
    'Jan': 0,
    'F\u00e9vrier': 1,
    'F\u00e9v': 1,
    'Mars': 2,
    'Avril': 3,
    'Avr': 3,
    'Mai': 4,
    'Juin': 5,
    'Juillet': 6,
    'Juil': 6,
    'Ao\u00fbt': 7,
    'Septembre': 8,
    'Sept': 8,
    'Octobre': 9,
    'Oct': 9,
    'Novembre': 10,
    'Nov': 10,
    'D\u00e9cembre': 11,
    'Dec': 11
    };
    
    Ext.Date.getShortMonthName = function(month) {
        switch (month) {
          case 0: return 'Jan';
    case 1: return 'F\u00e9v';
    case 2: return 'Mars';
    case 3: return 'Avr';
    case 4: return 'Mai';
    case 5: return 'Juin';
    case 6: return 'Juil';
    case 7: return 'Ao\u00fbt';
    case 8: return 'Sept';
    case 9: return 'Oct';
    case 10: return 'Nov';
    case 11: return 'D\u00e9c';
    }
        return null;
    };
    });
    

Similar Threads

  1. DatePicker Localization
    By echowang in forum Ext: Q&A
    Replies: 4
    Last Post: 28 Sep 2015, 11:27 AM
  2. [FIXED] DatePicker Localization
    By rhonen in forum Sencha GXT Bugs
    Replies: 4
    Last Post: 28 Feb 2014, 1:33 AM
  3. Datepicker localization
    By cscagliola in forum Ext 3.x: Help & Discussion
    Replies: 9
    Last Post: 5 Nov 2009, 6:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •