Subject: Re: improved install.js for Language packs



Robert Kaiser wrote:
> (snip...)
OK, here's it in more detail (probably interesting for more people)...

Now, the XPI pack has the following structure
(using '/' as directory seperator, name with a trailing / is a subdirectory):

----------------
install.js
bin/
chrome/
*.jar
defaults/
profile/
<XX>/
<files for default profile>
searchplugins/
<search-engine-icon>.gif
<search-engine-definition>.src
----------------
in bin/chrome/ you have the translated files for language and content pack, bin/defaults/profile/<XX>/ contains the files to use for the default profile when it's created with your content pack (<XX> is the name of your content pack, e.g. AT), and searchplugins may contain local search engines that should be available to people using your content pack (e.g. German Google or similar).

(As I just saw, MT5 only uses the bin/chrome/ directory, it leaves out the others, that's what might have irritated you.)

My new packs have the following structure:
----------------
install.js
install.properties
chrome/
*.jar
defaults/
profile/
<XX>/
<files for default profile>
searchplugins/
<search-engine-icon>.gif
<search-engine-definition>.src
----------------

So you see that install.properties is added, containing the strings used by install.js - and the bin/ directory disappeared, chrome/, defaults/ and searchplugins/ are directly in the main folder.

In install.js, the following parts concern those changes:

| // searchplugins directory detection
| if (platformNode == 'mac') {
| fSearchPlugins = getFolder("Program", "Search Plugins");
| }
| else {
| fSearchPlugins = getFolder("Program", "searchplugins");
| }
| logComment("searchplugins path detected as: " + fSearchPlugins);

this part (detect in which directory the search plugins should be installed) is unchanged, but unneeded if you don't use searchplugins.

| // install search plugins first
| err = addDirectory("", "searchplugins", fSearchPlugins, "");
| logComment("addDirectory() for searchplugins returned: " + ErrWithCode(err));
| resetError();

same as above. (this installs the search plugins)

| err = addDirectory("", "chrome", fProgram, "chrome");
| logComment("addDirectory() for chrome returned: " + ErrWithCode(err));

This installs the chrome parts from the chrome/ directory (also needed for what MT5 has)

| err = addDirectory("", "defaults", fProgram, "defaults");
| logComment("addDirectory() for defaults returned: " + ErrWithCode(err));

This installs the defaults part from the defaults/ subdirectory (only needed if there is a defaults/ directory to install).


When we're installing in the profile directory, we can't install defaults or search plugins anyway, so we only install chrome in that case.

I hope this gives a more in-depth look of those changes.
From what I see, you just have to change the structure (use chrome/ instead of bin/chrome/ and include install.properties) to get this working in MT5, and you should delete the sections about searchplugins and defaults from install.js as you don't use them.
This should be all needed changes for MT5, as far as I see.


Greetings from Vienna,

Robert Kaiser


This is great, especially the install.properties file...
We are not using Mozilla Translator as we have a system where
we convert the .dtd, .properties files to gettext .po so that
our translators can use KBabel, which they are familiar with.
What I would like to know is, is there a reference set of install.js
for localizations, that has been checked to work on all platforms
with different versions of Mozilla (it seems that there are changes
needed). This is because we might still release translation packs
for old versions...
I think a central repository of such files would probably be helpful
to other people too. It would prevent many errors for those not using
MozillaTranslator. We could help set it up/maintain it if neccessary.
What does everyone think...?
David (translate.org.za)








Privacy