#Firefox Extension Utilities
This collection of scripts is a handy toolkit for Firefox extension developers. I created them out of frustration for doing repetitive tasks during extension development, and they have since made my life much easier. Hopefully someone else will find them just as useful. I hope to add to this toolkit as I develop scripts worth sharing.
The following scripts are currently available:
Compares all of the locales it finds against a "master" locale (
en-US by default)
and reports the number of exact duplicate entries for each. This is useful for
figuring out which locales have not been updated.
Converts a given list of locale entities into corresponding properties. Handy
for migrating existing entity localizations into a
This script looks for entities from DTD files that aren't used anywhere in corresponding XUL files. Handy for locating strings that have been deprecated.
This script removes a given list of entries from all of the locale folders it finds in the current working directory and below. Useful for cleaning up strings that are no longer needed.
Script Usage Statements
Here is the expanded usage information for each of these scripts. Note that you
should always look at the usage information for each script (with
ensure what the script expects. This README file is likely to be out of date.
Script Usage: compareLocales.pl [Options] [Locale_Root_Directory] This script is used to compare the locales for Firefox extensions, providing data on how many strings are untranslated between the "master" (or root) locale, and all others that the script finds. Useful for determining which specific locales are not keeping up with updates. Strings that are 1 character in length are ignored from the comparison. LIMITATIONS At the moment, this script only works on DTD files, not .properties files [Locale_Root_Directory] If provided, specifies the absolute location of the 'locale' folder (defaults to the current working directory if not provided) [Options] --master LOCALE-NAME Sets the master locale folder to compare against; defaults to 'en-US' --verbose Displays the duplicate entries that are found for each locale
Script Usage: findOrphanedEntities.pl [Options] This script is used to find entities in Firefox extension locale files that are not used anywhere in the project. Handy for determining what entities can be dropped going forward. LIMITATIONS At the moment, this script only works on DTD files, not .properties files [Options] --master LOCALE-NAME Specifies the name of the master locale to compare against; defaults to 'en-US'
Script Usage: removeLocaleEntries.pl [Options] [Entities] Description: This script is used to remove specified entities from all locales in a Firefox extension's locale folder structure, making it very easy to remove deprecated strings from a project. [Entities] A space separated list of entity IDs to be removed from the various locale files. [Options] --prefix SOME_STRING If specified, prepends SOME_STRING to each entity ID that needs to be removed, saving you from having to type the same prefix a number of times. --input FILENAME Specifies the input filename from which to read entity IDs to remove Example: removeLocaleEntries.pl --prefix gblite.confirm. title label.yes ak.yes The above example will remove the following entities from each DTD file found in the project: * <!ENTITY gblite.confirm.title "..."> * <!ENTITY gblite.confirm.label.yes "..."> * <!ENTITY gblite.confirm.ak.yes "...">