Results 1 to 4 of 4

Thread: Overriding Localization

  1. #1
    Sencha User
    Join Date
    Jun 2014
    Location
    Madrid
    Posts
    4

    Default Answered: Overriding Localization

    Hi all.

    We have a new application in EXT5.1 and localized properly in three languages following this thread:
    http://www.sencha.com/forum/showthre...ationalization

    In a form, there are several fields with validation "presence" in the model.
    When this validation fails, I get the message in English 'Must be present' when my locale is 'es' .

    Analyzing both translation files in ext-locale package, I can't see the translated message for Ext.locale.es.data.validator.Presence in ext-locale-es.js. I tried to override Ext.data.validator.Presence

    Code:
    Ext.define("Ext.locale.es.data.validator.Presence", {
        override: "Ext.data.validator.Presence",
        message: "Este campo es obligatorio"
    });
    And I've to override the getter message.

    Code:
    Ext.require('Ext.data.validator.Presence', function() {
        Ext.override(Ext.data.validator.Presence, {
            getMessage: function() {
                var me = this;
                return me.message || me.config.message;
            }
        });    
    });
    It work's, but I don't know if it's the right way.

    Thanks in advance

  2. You could do it with just one override, like this:

    Code:
    Ext.define("Ext.locale.es.data.validator.Presence", {
        override: "Ext.data.validator.Presence",
        message: "Este campo es obligatorio",
        getMessage: function() {
            var me = this;
            return me.message || me.config.message;
        }
    });
    Guilherme Lopes
    Sencha Support

  3. #2
    Sencha - Support Team
    Join Date
    Mar 2015
    Location
    Chicago
    Posts
    239
    Answers
    40

    Post

    You could do it with just one override, like this:

    Code:
    Ext.define("Ext.locale.es.data.validator.Presence", {
        override: "Ext.data.validator.Presence",
        message: "Este campo es obligatorio",
        getMessage: function() {
            var me = this;
            return me.message || me.config.message;
        }
    });
    Guilherme Lopes
    Sencha Support
    Guilherme Lopes
    Sencha Support

  4. #3
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    123

    Default

    Any chance the missing translation will be shipped with Ext JS? These fundamental messages should be delivered as part of the product. Same things are missing for the german translation!

  5. #4
    Sencha - Support Team
    Join Date
    Mar 2015
    Location
    Chicago
    Posts
    239
    Answers
    40

    Default

    It has been submitted, and it will probably be shipping with 6.1
    Guilherme Lopes
    Sencha Support

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
  •