-
3 May 2009 6:23 AM #1
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:
You can see on attachment.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" }); }
Can anyone tell how to change the translation to a word?
-
3 May 2009 10:17 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
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...' }); } } }
-
4 May 2009 1:18 AM #3
Re
Re
Hi,
I do what you told me to do, i add the code on the end of file ext-lang-pt.js :
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.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...' }); } } }
If you can clarify me these doubts, i would appreciate. I'm doing something wrong?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} à {1} de {2} registo(s)</b>", emptyMsg : 'Sem registos para exibir' }); }
-
4 May 2009 1:22 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
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?
-
4 May 2009 1:53 AM #5
Re
Re
1. I'm including ext-lang-pt.js file before loading the GridFilters.js as you can see below
2. "Page" shoul be página. Yes i'm using pagingtoolbar extensionsCode:<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>
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}}); });
-
4 May 2009 3:29 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
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).
-
4 May 2009 5:06 AM #7
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.
-
4 May 2009 7:43 AM #8Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
That's stange. These lines should have fixed that:
Code:Ext.override(Ext.grid.GridFilters, { filtersText: 'Filtros' });
-
6 May 2009 12:04 AM #9
Re
Re
I even tried in other way:
but didn't work.Code:Ext.apply(Ext.grid.GridFilters, { //instead of override, apply filtersText: 'Filtros' });
Thanks anyway, i will keep trying. Thanks a lot for helping.
-
6 May 2009 2:39 AM #10Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
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:
(you're not using the filters supplied with the Ext 2.2.1 SDK examples)Code:Ext.ux.grid.GridFilters


Reply With Quote