Results 1 to 3 of 3

Thread: Extjs Japanese locale issue when ploting month names

    This issue duplicates another issue.
  1. #1

    Default Extjs Japanese locale issue when ploting month names

    Hi,

    When the graph labels are abbreviated for Japanese month names we could see only 1,2,3,4 instead of 1月, 2月, 3月, 4月.

    I could see that there is a the “buggy” ExtJs code that handles Japanese Locale support in the file "ext\classic\locale\overrides\ja\ext-locale-ja.js".

    we can fix the above by change code to:

    Ext.onReady(function() {
    var parseCodes;

    if (Ext.Date) {
    Ext.Date.monthNames = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];

    //Ext.Date.getShortMonthName = function(month) {
    // return "" + (month + 1);
    //Working
    Ext.Date.getShortMonthName = function(month) {
    return (Ext.Date.monthNames[month]);

    };




    Please let me know whether it is a good idea.

  2. #2
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569

    Default

    Hello Swetha,

    Thank you for contacting Sencha Support!

    Your changes are good, but could you tell us in which version you got such buggy file, because in 6.6.0, 6.7.0 and 7.0 I am not
    getting such file where month name is only 1,2,3,4 instead of 1月, 2月, 3月, 4月...


    I got this piece of code in Japanese local file with which you can match your code


    Ext.onReady(function() {
    var parseCodes;


    if (Ext.Date) {
    Ext.Date.monthNames = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];


    Ext.Date.getShortMonthName = function(month) {
    return "" + (month + 1);
    };


    Ext.Date.monthNumbers = {
    "1": 0,
    "2": 1,
    "3": 2,
    "4": 3,
    "5": 4,
    "6": 5,
    "7": 6,
    "8": 7,
    "9": 8,
    "10": 9,
    "11": 10,
    "12": 11
    };


    Ext.Date.getMonthNumber = function(name) {
    return Ext.Date.monthNumbers[name.substring(0, name.length - 1)];
    // or simply parseInt(name.substring(0, name.length - 1)) - 1
    };


    Ext.Date.dayNames = ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"];


    Ext.Date.getShortDayName = function(day) {
    return Ext.Date.dayNames[day].substring(0, 1); // just remove "曜日" suffix
    };


    Ext.Date.formatCodes.a = "(this.getHours() < 12 ? '午前' : '午後')";
    Ext.Date.formatCodes.A = "(this.getHours() < 12 ? '午前' : '午後')"; // no case difference

    parseCodes = {
    g: 1,
    c: "if (/(午前)/i.test(results[{0}])) {\n"
    + "if (!h || h == 12) { h = 0; }\n"
    + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
    s: "(午前|午後)",
    calcAtEnd: true
    };


    Ext.Date.parseCodes.a = Ext.Date.parseCodes.A = parseCodes;
    }


    if (Ext.util && Ext.util.Format) {
    Ext.apply(Ext.util.Format, {
    thousandSeparator: ',',
    decimalSeparator: '.',
    currencySign: '\u00a5',
    // Japanese Yen
    dateFormat: 'Y/m/d'
    });
    }
    });


    Regards,
    Kumar
    Sencha Support.

  3. #3

    Default Version and problem

    Thanks for response. The version I am using is v6.5.3.6.

    The following piece of code returns a number instead of the month name.

    Code:
    Ext.Date.getShortMonthName = function(month) {
    return "" + (month + 1);
    };
    We are wondering if this is the correct approach to display simply a number when a short month name is asked for. It would be better if we can display the entire month name in case of Japanese even when short month name is required.

    What would you guys say.

    Thanks
    Swetha Kalaskar

Tags for this Thread

Posting Permissions

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