How to resize a xul pref dialog according to every language |
|
Written by Goofy
|
Monday, 04 June 2007 |
How to resize a xul pref dialog according to every language The problem Preferences Dialog is not resizable (see Bugzilla #122345), so it happens every now and then that the size of the window can be perfect for English language but not so perfect for other languages, once translation is done. Here is a simple example: This is the original en-US dialog | This is the French version, same size. One sentence is longer, so the last word on the right is sadly cut, as well as the right-hand side frame border.. | A simple solution All you have to do is to add a style attribute to your prefwindow and make the width a localizable entity. Translors will have to determine the optimum value to give to this entity in their locale, they will adjust after some tests so that it matches perfectly for their own language. Here is one code example in prefs.xul <!DOCTYPE prefwindow SYSTEM "chrome://attachmentextractor/locale/attachmentextractor-prefs.dtd" > <prefwindow type="prefwindow" id="attachmentextractorPreferences" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" windowtype="attachmentextractor:preferences" title="&attachmentextractor.settings.windowtitle;" style = "width:&attachmentextractor.settings.width;; height: 55em;">
in attachmentextractor-prefs.dtd in en-US locale <!ENTITY attachmentextractor.settings.width "80ex"> 80 ex is not enough for French language, it needs "100ex" in the fr-FR locale, so now the sentence is complete Note about units Width (or height) can be set in various units and is generally in px or em, but it seems it is recommended to use ex. See this article in Mozilla Knowledge Base a Goofy mini-howto
|
Last Updated ( Wednesday, 27 June 2007 )
|