-
5 Feb 2010 10:58 AM #1
[FNR] Change the language of PagingToolBarMessages
[FNR] Change the language of PagingToolBarMessages
Hi,
I'm using a PagingToolBar and I have to change the language of the messages, but setMessages(PagingToolBarMessages messages) don't actualize them.
GXT 2.1.1
-
23 May 2010 3:53 PM #2
IMHO the PagingToolBar can't be translated without extending/overriding the class (bug). The constructor uses a "fresh" object of PagingToolBarMessages:
All elements, which are not updated later, won't recognize, that setMessages was used to store your own PagingToolBarMessages object. This applies to all elements created in the constructor only and not updated in onLoad, especially all tooltip messages and beforePageText ("Page").Code:public PagingToolBar(final int pageSize) { this.pageSize = pageSize; msgs = new PagingToolBarMessages(); first = new Button();
Workaround:
You may override the onLoad method with code that updates all tooltip messages and labels. Or set the not-updated texts "from the outside". e.g.:
Fixed the problem for me. Note, that the numbers may change with never GXT versions/more elements in the PagingToolBar class (this code has been tested with V2.1.2).Code:PagingToolBar toolBar = new PagingToolBar(50); PagingToolBarMessages toolBarMessages = toolBar.new PagingToolBarMessages(); toolBarMessages.setAfterPageText("von {0}"); toolBarMessages.setBeforePageText("Seite"); toolBarMessages.setDisplayMsg("Zeige {0} - {1} von {2}"); toolBarMessages.setEmptyMsg("Keine Teilnehmer"); toolBarMessages.setFirstText("Erste Seite"); toolBarMessages.setLastText("Letzte Seite"); toolBarMessages.setNextText("Nächste Seite"); toolBarMessages.setPrevText("Vorherige Seite"); toolBarMessages.setRefreshText("Aktualisieren"); toolBar.setMessages(toolBarMessages); // Now fix text if (toolBar.isShowToolTips()) { // 0: First ((Button)toolBar.getItem(0)).setToolTip(toolBarMessages.getFirstText()); // 1: Prev ((Button)toolBar.getItem(1)).setToolTip(toolBarMessages.getPrevText()); // 2: Separator // 3: BeforePage (no tooltip, see below for text fix) // 4: Textbox (no tooltip) // 5: After (no tooltip, text updated by onload) // 6: Separator // 7: Next ((Button)toolBar.getItem(7)).setToolTip(toolBarMessages.getNextText()); // 8: Last ((Button)toolBar.getItem(8)).setToolTip(toolBarMessages.getLastText()); // 9: Seperator // 10: Refresh ((Button)toolBar.getItem(10)).setToolTip(toolBarMessages.getRefreshText()); // 11: Fill // 12: Display text (no tooltip, text updated by onload) } // Allways fix beforePage text ((LabelToolItem)toolBar.getItem(3)).setLabel(toolBarMessages.getBeforePageText());
Regards,
HerrBLast edited by HerrB; 23 May 2010 at 4:09 PM. Reason: Code tested
-
15 Jun 2010 5:44 AM #3
There has to be a better way...clearly the architect felt it necessary to have this customizable.
-
15 Jul 2010 7:06 AM #4
Fixed in SVN as of revision 2126.
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
Change Grid language
By flashed in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 27 Apr 2009, 1:21 AM -
Change language of default-messages
By wuschba in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 21 Apr 2008, 5:00 AM -
change language without reload the page
By gimler in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 3 Feb 2008, 4:11 AM -
Change language errors-messages
By ec-cts in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 21 Dec 2007, 9:25 AM -
change language
By paulofernandesjr in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 3 Dec 2007, 8:46 AM


Reply With Quote
