Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Localization in Sench Touch

  1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Posts
    30
    Vote Rating
    0
      0  

    Smile Localization in Sench Touch

    Hello,

    I found out this tutorial for Ext.JS localization:

    http://www.sencha.com/learn/Tutorial:Localizing_Ext

    But I could not apply it to Sencha Touch since there is no locale file anywhere in Sencha Touch package.

    I copied locale files from Ext.JS to Sencha folder:

    senchatouch\src\locale

    Then include the locale file (For example: German locale file ext-lang-de.js to the header). Then implemented a simple Date Picker to check. Nothing is changed still default English. I tried Ext.JS, the Date Picker did change to German version although the UI is different from Sencha Touch Date Picker.

    Could anyone give a hint how to make theis localization work in Sencha Touch?

    Thank you!

    Buck

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Posts
    30
    Vote Rating
    0
      0  

    Question

    I think I need to clarify my question here:

    I can do my own control label translation no problem, but cannot translate Sencha native controls like Date Picker.

    Can anyone give me a hand?

    Thanks!

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Do you have any news on this or how did you solve the problem? I read in the release notes from 0.92 that support for localization were added to the library but I don't understand in what way.

  4. #4
    Touch Premium Member
    Join Date
    Nov 2010
    Posts
    30
    Vote Rating
    0
      0  

    Default

    Basically you have to do the translation yourself as following:


    Code:
    Date.dayNames = [
        'Sunday',
        'Monday',
        'Tuesday',
        'Wednesday',
        'Thursday',
        'Friday',
        'Saturday'
    ];
    
    Date.monthNames = [
        'January',
        'February',
        'March',
        'April',
        'May',
        'June',
        'July',
        'August',
        'September',
        'October',
        'November',
        'December'
    ];
    
    Date.monthNumbers = {
        'Jan': 0,
        'Feb': 1,
        'Mar': 2,
        'Apr': 3,
        'May': 4,
        'Jun': 5,
        'Jul': 6,
        'Aug': 7,
        'Sep': 8,
        'Oct': 9,
        'Nov': 10,
        'Dec': 11
    };
    
    Date.getShortMonthName = function(month) {
        return Date.monthNames[month].substring(0, 3); };
    
    Date.getShortDayName = function(day) {
        return Date.dayNames[day].substring(0, 3); };
    
    Date.getMonthNumber = function(name) {
      return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()]; };
    
    Date.parseCodes.S.s = '(?:st|nd|rd|th)';
    
    if(Ext.Picker){
        Ext.override(Ext.Picker, {
            doneText: 'Done'    
        });
    }
    
    if(Ext.DatePicker){
        Ext.override(Ext.DatePicker, {
            'dayText': 'Day',
            'monthText': 'Month',
            'yearText': 'Year',
            'slotOrder': ['month', 'day', 'year']    
        });
    }
    
    if(Ext.IndexBar){
        Ext.override(Ext.IndexBar, {
            'letters': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']    
        });
    }
    
    if(Ext.NestedList){
        Ext.override(Ext.NestedList, {
            'backText': 'Back',
            'loadingText': 'Loading...',
            'emptyText': 'No items available.'
        });
    }
    
    if(Ext.util.Format){
        Ext.util.Format.defaultDateFormat = 'm/d/Y'; }
    
    if(Ext.MessageBox){
        Ext.MessageBox.OK.text = 'OK';
        Ext.MessageBox.CANCEL.text = 'Cancel';
        Ext.MessageBox.YES.text = 'Yes';
        Ext.MessageBox.NO.text = 'No';
    }

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    71
    Vote Rating
    0
      0  

    Default

    This works great, thanks for the hint
    Just a note: it's "doneButton" for the picker in the current version (1.1.0) and not "doneText".

    Another problem with localization in sencha touch and the DatePicker is the "cancel" button. There is a property for the "doneButton" but no possibility to change the "cancelText" or did I miss something?

  6. #6
    Sencha User
    Join Date
    Aug 2009
    Posts
    1
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by heringsfilet View Post
    This works great, thanks for the hint
    Just a note: it's "doneButton" for the picker in the current version (1.1.0) and not "doneText".

    Another problem with localization in sencha touch and the DatePicker is the "cancel" button. There is a property for the "doneButton" but no possibility to change the "cancelText" or did I miss something?
    try this: "cancelButton"

  7. #7
    Touch Premium Member
    Join Date
    Feb 2011
    Posts
    7
    Vote Rating
    0
      0  

    Default please, give me a hand with setting my own text translation.

    Quote Originally Posted by Buckeye View Post
    I can do my own control label translation no problem
    Hi,Can you please give me an example of how you do the above('own control label translation')
    using the different language files(ext-lang-de.js,ext-lang-fa.js etc...)
    thank you!!

  8. #8
    Touch Premium Member
    Join Date
    Feb 2011
    Posts
    7
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Buckeye View Post
    I can do my own control label translation no problem
    Hi,Can you please give me an example of how you do the above('own control label translation')
    using the different language files(ext-lang-de.js,ext-lang-fa.js etc...)
    thank you!!

  9. #9
    Sencha User
    Join Date
    May 2011
    Posts
    5
    Vote Rating
    0
      0  

    Question Best practice for localization in sencha touch?

    Can you provide us a localization example in sencha touch

  10. #10
    Sencha User
    Join Date
    May 2011
    Posts
    5
    Vote Rating
    0
      0  

    Default

    provide us an example of label translation in sencha touch please
    thank you in advance

Page 1 of 2 12 LastLast

Similar Threads

  1. Localization in Sench Touch
    By Buckeye in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 28 Aug 2011, 9:21 PM
  2. [DUPE-653] Touch 1.0.1 scrolls to end of page on simple touch.
    By stevek in forum Sencha Touch 1.x: Bugs
    Replies: 2
    Last Post: 23 Dec 2010, 3:45 PM
  3. Sencha Touch on iPhone v1 / iPod touch v1 ?
    By palnap in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 28 Oct 2010, 5:30 PM
  4. [FIXED-202] Error in sench/examples/geocongress
    By efx in forum Sencha Touch 1.x: Bugs
    Replies: 12
    Last Post: 8 Sep 2010, 1:25 PM

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
  •