1. #1
    Ext User flashed's Avatar
    Join Date
    Feb 2009
    Posts
    33
    Vote Rating
    0
    flashed is on a distinguished road

      0  

    Post Translation language

    Translation language


    I have a problem, the file of language translation *.js(pt), don't translate all the words, for example the word "filters" remains in english instead of português. Where i can add the translation, i all ready try:

    Code:
    if(Ext.grid.GridView){
       Ext.apply(Ext.grid.GridView.prototype, {
          sortAscText  : "Ordem Ascendente",
          sortDescText : "Ordem Descendente",
          lockText     : "Bloquear Coluna",
          unlockText   : "Desbloquear Coluna",
          filtersText  : "Filtros", //------------>Add this line
          columnsText  : "Colunas"
       });
    }
    You can see on attachment.
    Can anyone tell how to change the translation to a word?
    Attached Images

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Grid filters are a user extension, so they are not translated in the standard translations.

    You'll need to add translations for:
    Code:
    if(Ext.grid){
    	if(Ext.grid.GridFilters){
    		Ext.override(Ext.grid.GridFilters, {
    			filtersText: 'Filters'
    		});
    	}
    	if(Ext.grid.filters){
    		if(Ext.grid.filter.BooleanFilter){
    			Ext.override(Ext.grid.filter.BooleanFilter, {
    				yesText: 'Yes',
    				noText: 'No'
    			});
    		}
    		if(Ext.grid.filter.DateFilter){
    			Ext.override(Ext.grid.filter.DateFilter, {
    				dateFormat: 'm/d/Y',
    				beforeText: 'Before',
    				afterText: 'After',
    				onText: 'On'
    			});
    		}
    		if(Ext.grid.filter.ListFilter){
    			Ext.override(Ext.grid.filter.ListFilter, {
    				loadingText: 'Loading...'
    			});
    		}
    	}
    }

  3. #3
    Ext User flashed's Avatar
    Join Date
    Feb 2009
    Posts
    33
    Vote Rating
    0
    flashed is on a distinguished road

      0  

    Question Re

    Re


    Hi,

    I do what you told me to do, i add the code on the end of file ext-lang-pt.js :

    Code:
    if(Ext.grid){
        if(Ext.grid.GridFilters){
            Ext.override(Ext.grid.GridFilters, {
                filtersText: 'Filtros'
            });
        }
        if(Ext.grid.filters){
            if(Ext.grid.filter.BooleanFilter){
                Ext.override(Ext.grid.filter.BooleanFilter, {
                    yesText: 'Sim',
                    noText: 'Não'
                });
            }
            if(Ext.grid.filter.DateFilter){
                Ext.override(Ext.grid.filter.DateFilter, {
                    dateFormat: 'm/d/Y',
                    beforeText: 'Antes',
                    afterText: 'Depois',
                    onText: 'On'
                });
            }
            if(Ext.grid.filter.ListFilter){
                Ext.override(Ext.grid.filter.ListFilter, {
                    loadingText: 'Carregando...'
                });
            }
        }
    }
    But apparently didm't resulted, i noticed other thing, my paging bar is on english to instead of portuguese, although in file ext-lang-pt.js there is this code :

    Code:
    ´if(Ext.PagingToolbar){
       Ext.apply(Ext.PagingToolbar.prototype, {
          beforePageText : "Página",
          afterPageText  : "de {0}",
          firstText      : "Primeira Página",
          prevText       : "Página Anterior",
          nextText       : "Próxima Página",
          lastText       : "Última Página",
          refreshText    : "Atualizar",
          displayMsg     : "<b>{0} &agrave; {1} de {2} registo(s)</b>",
          emptyMsg       : 'Sem registos para exibir'
       });
    }
    If you can clarify me these doubts, i would appreciate. I'm doing something wrong?

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. Are you including the ext-lang-pt.js file before or after loading the GridFilters.js and related files?

    2. Which text on the pagingtoolbar is not correctly translated? Are you using any pagingtoolbar extensions?

  5. #5
    Ext User flashed's Avatar
    Join Date
    Feb 2009
    Posts
    33
    Vote Rating
    0
    flashed is on a distinguished road

      0  

    Default Re

    Re


    1. I'm including ext-lang-pt.js file before loading the GridFilters.js as you can see below


    Code:
    <link rel="stylesheet" type="text/css" href="./ext-2.0.2/resources/css/ext-all.css" />
            <script type="text/javascript" src="./ext-2.0.2/adapter/ext/ext-base.js"></script>
            <script type="text/javascript" src="./ext-2.0.2/ext-all-debug.js"></script>
            <script type="text/javascript" src="ext/ext-all.js"></script>
            <script type="text/javascript" src="./ext-2.0.2/source/locale/ext-lang-pt.js"></script>
    
            <script type="text/javascript" src="ux/menu/EditableItem.js"></script>
            <script type="text/javascript" src="ux/menu/RangeMenu.js"></script>
            <script type="text/javascript" src="ux/menu/RowExpander.js"></script>
            <script type="text/javascript" src="ux/grid/PagingToolbar.js"></script>
    
            <script type="text/javascript" src="ux/grid/GridFilters.js"></script>
            <script type="text/javascript" src="ux/grid/filter/Filter.js"></script>
            <script type="text/javascript" src="ux/grid/filter/StringFilter.js"></script>
            <script type="text/javascript" src="ux/grid/filter/DateFilter.js"></script>
            <script type="text/javascript" src="ux/grid/filter/ListFilter.js"></script>
            <script type="text/javascript" src="ux/grid/filter/NumericFilter.js"></script>
            <script type="text/javascript" src="ux/grid/filter/BooleanFilter.js"></script>
            <!-- filtros -->
    
            <script type="text/javascript" src="classificador-binding.js" charset="UTF-8" ></script>
    2. "Page" shoul be página. Yes i'm using pagingtoolbar extensions

    classificador-binding.js is:

    Code:
    /*
     * Ext JS Library 2.2.1
     * Copyright(c) 2006-2009, Ext JS, LLC.
     * licensing@extjs.com
     * 
     * http://extjs.com/license
     */
    
    Ext.onReady(function(){
        // create the Data Store
        var store = new Ext.data.Store({
            // load using HTTP
            url: '../gestorClassificador',
    
            reader: new Ext.data.XmlReader({
    
                totalRecords: 'TotalResults',
                record: 'Item',
                id: 'ID'
            }, [
                'Codigo',
                'Designacao',
                'Descricao'
            ])
        });
        
        var expander = new Ext.grid.RowExpander({
            tpl : new Ext.Template(
                '<p><b>Descrição:</b> {Descricao}</p><br>'
            )
        });
        
        // filtros
        var filters = new Ext.ux.grid.GridFilters({filters:[
                {type: 'string',  dataIndex: 'Codigo'},
                {type: 'string',  dataIndex: 'Designacao'},
                {
                    type: 'list',  
                    dataIndex: 'size', 
                    options: ['extra small', 'small', 'medium', 'large', 'extra large'],
                    phpMode: false},
                {type: 'boolean', dataIndex: 'visible'}
            ]});  
        // filtros
        
        // create the grid
        var grid = new Ext.grid.GridPanel({
            store: store,
            columns: [
                expander,
                {header: "Código", width: 120, dataIndex: 'Codigo', sortable: true},
                {header: "Designação", width: 180, dataIndex: 'Designacao', sortable: true}
            ],
            sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
            viewConfig: {
                forceFit: true
            },
            loadMask: true,
            plugins: [expander,filters], //Adicionei
            height: 300,
            split: true,
            region: 'north',
            autoExpandColumn: 'Descricao',
    
            bbar: new Ext.PagingToolbar({
                store: store,
                pageSize: 20, //nº de registos a dispôr por página
                plugins: filters})
        });
        
        // define a template to use for the detail view
        var bookTplMarkup = [
            '{Descricao}<br/>'
        ];
        var bookTpl = new Ext.Template(bookTplMarkup);
    
        var ct = new Ext.Panel({
            renderTo: 'classificador',
            frame: true,
            title: 'Classificador',
            width: 640,
            height: 500,
            layout: 'border',
            items: [
                grid,
                {
                    id: 'detailPanel',
                    region: 'center',
                    bodyStyle: {
                        background: '#ffffff',
                        padding: '7px'
                    },
                    html: 'NOTA: Para efectuar pesquisas e ordenações passe com o rato e clique sobre o extremo direito dos cabeçalhos "Código" e "Designação"'
                }
            ]
            
            
        })
           //grid.getSelectionModel().on('rowselect', function(sm, rowIdx, r) {
            grid.getSelectionModel().on('rowselect', function(sm, index, r) {
            var detailPanel = Ext.getCmp('detailPanel');
            bookTpl.overwrite(detailPanel.body, r.data);
            setSeleccionado(r.data.Codigo, r.data.Designacao);
            });
        
        grid.render();
      
        store.load({params:{start: 0, limit: 20}});
    });
    Attached Images

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. Include ext-lang-pt.js after all other script files (since it now also contains overrides for GridFilters.js and other files).
    2. I assume that ux/grid/PagingToolbar.js also needs some translations (I can't recommend any, because I don't know which extension this is).

  7. #7
    Ext User flashed's Avatar
    Join Date
    Feb 2009
    Posts
    33
    Vote Rating
    0
    flashed is on a distinguished road

      0  

    Default Re

    Re


    1. Done it

    The problem of paging is solved already has translated, but the filter problem remains.

    The word "Filters" remains in english.

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    That's stange. These lines should have fixed that:
    Code:
    Ext.override(Ext.grid.GridFilters, {
        filtersText: 'Filtros'
    });

  9. #9
    Ext User flashed's Avatar
    Join Date
    Feb 2009
    Posts
    33
    Vote Rating
    0
    flashed is on a distinguished road

      0  

    Default Re

    Re


    I even tried in other way:

    Code:
    Ext.apply(Ext.grid.GridFilters, { //instead of override, apply
        filtersText: 'Filtros'
    });
    but didn't work.

    Thanks anyway, i will keep trying. Thanks a lot for helping.

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    No, Ext.apply is used to apply configs to objects (e.g. singletons). You need Ext.override to apply configs to classes.

    But I think I see the problem. The class is called:
    Code:
    Ext.ux.grid.GridFilters
    (you're not using the filters supplied with the Ext 2.2.1 SDK examples)

Thread Participants: 1