Search code examples
javascriptfirefox-addonfirefox-addon-sdk

How to work with locale-file for language settings and simple-prefs for options window with add-on builder


I am developing an add-on with the Mozilla Add-on Builder. There are 3 problems that I cannot find a solution for:

  1. To be able to provide a user dependent language I have to add properties-files to the locale-file - i.e. en-US.properties. But how do I implement this using the Add-on Builder? I can use the ln10-module but I have no clue how to create the property files since the only visible (to me) folders are lib, data and libraries - and not locale.

  2. Other extensions that I have installed open a small preferences-window when I click on "Options" in the Add-on Manager. But when I use the module simple-prefs the prefs are displayed on the same site as all other informations displayed when clicking on "more". How do I achieve a small seperate "window" for my prefs? And are there othere options for me to style it besides the spartanic "type"-"value"-thingy?

  3. I know how to use Erik Vold's toolbarbutton module but how can I achieve such nice options windows that open when I click i.e. on the toolbar icon or on "options" in the menu like other extensions?


Solution

  • I want to get rid of the basic misconception first. There are two very different types of Firefox extensions: the classic XUL-based extensions and the extensions based on the Add-on SDK. The Add-on Builder works with the latter, pretty much all of the extensions documentation on MDN applies to the former.

    I can use the ln10-module but I have no clue how to create the property files since the only visible (to me) folders are lib, data and libraries - and not locale.

    It seems that the Add-on Builder doesn't support localized add-ons yet. You can download the Add-on SDK and build your extension from the command line - this will give you more options.

    Other extensions that I have installed open a small preferences-window when I click on "Options" in the Add-on Manager.

    These are XUL-based extensions. The Add-on SDK doesn't support opening new windows, merely panels. However, even opening a panel for the add-on options would require some very creative hacking.

    how can I achieve such nice options windows that open when I click i.e. on the toolbar icon or on "options" in the menu like other extensions?

    Same here - the Add-on SDK supports HTML-based panels, no real (XUL-based) application windows.