"Googlebar: Translation Documentation"

Translation Documentation

Page last updated


One of the goals of the Googlebar is to be available in as many languages as possible, and to that end we have implemented the use of localizations. Essentially, this places all the text that might appear on the Googlebar (tooltips, titles, captions on pref panel, etc) in a few easy-to-access files ("googlebar.dtd", "googlebar.properties", and "locale.inf"), which are located in the appropriate locale folder for that language. The actual "overlays" that contain the code for the Googlebar do not contain the exact text- instead, they contain references to the character entities (form of &entityname; ) which hold the actual values displayed. By changing these values in the appropriate language folder once, anyone interested in translating the Googlebar to another language will have a file that can be created once and used in each new version of the googlebar (with updates for new entries, but this is much easier than re-translating each version). This documentation will allow anyone interested in translating the Googlebar to do so (starting with version 0.5, where this feature first appeared). We always recommend that new translators start with the latest "experimental" xpi from CVS, because new text strings are introduced for every new feature and any translation missing these text strings will not work with newer versions.

Steps to translate

  1. Download the XPI containing the latest copy of Googlebar. At any time, this version many have some bugs, but will contain the newest locale files needed.

  2. Locate the directory where the Googlebar is installed (depending on your install, this will be either in your profile or the Mozilla program directory). Inside will be a locale folder containing en-US -> Googlebar directories. The googlebar.dtd and googlebar.properties files, found here, contain the English language localization.
  3. To translate the Googlebar, create another folder in the locale directory with the appropriate code for your country (for example, a french translation would go in a folder named fr). Copy the googlebar folder found inside en-US to the new directory, including all the files inside.
  4. Now, edit contents.rdf. Essentially, this involves changing all those references to en-US to that of your own translation.
  5. Translate each of the text strings in Googlebar.dtd, paying attention to any comments inside. This changes the actual text of things on the Googlebar- button labels, menu items, etc.
    For example, when you see <!ENTITY googlebar.name "Google Toolbar">, translate just the words "Google Toolbar".
  6. There is also another file, googlebar.properties, which contains the text of things used by javascript, like error messages and the country domains for international google searches (such as when someone chooses the preference to search via google.co.uk). Do not translate the country codes, but if you would like to separately translate our project and help pages, feel free to change the relevant URLs to those in your language.
    For example, when you see gb.button.nav.prev.tooltip=Previous result, translate the phrase "Previous result". But when you see gb.country.x=CountryName, do nothing.
  7. At the moment, there is no easy way to change the default country for Google to search- it is set to google.com but may be changed by the user. Currently, changing the default country requires editing googlebaroverlay.js, but because these changes would be lost with every upgrade, we hope to soon add a way for the default country to be set along with the rest of the locale file.
  8. You may also want to translate the locale.inf file, located in the XPI in the same directory as the install script- this will allow the installation process to appear in your language as well, and should also be translated.
  9. Finally! It's time to test your translation. First, you need to tell the Googlebar it's there. Edit installed-chrome.txt (in your chrome folder where mozilla is installed) and change the en-US in the "locale,install,url,resource:/chrome/googlebar/locale/en-US/googlebar/" line (probably near the bottom of the file) to the name of your translation. Start mozilla and marvel at your own brilliance (hopefully). The localizations work by matching the languages you have installed with the language you chose as the default language for mozilla, so once you install your new language pack, it should take effect- so long as that language is the one you selected in Mozilla.
  10. If you have problems with the translation, post a note below and we will try to assist you. Otherwise, the Googlebarl10n project has been set up as a home for translated versions of the Googlebar, so visit the project page for information on how to submit yours. Thanks for the interest and hard work!!.

Danger, Will Robinson! Danger!

A word of caution: as mentioned, each new version will likely require some maintenance of the translation. Everything that has been translated stays translated, but new text entities, properties, etc are often added with a new version, and must be included in the translation if it is to work with the newest version- make sure to update it once a release comes about. Using these entities to store text makes translation easier, but it also allows us to create custom fields for other XUL attributes and values that developers may want, allowing developers an easy way to customize the Googlebar beyond translation alone. As we get feedback from those interested as to what kinds of settings and values they may want to change in the Googlebar, this file will probably change to allow this sort of customization as well.

If there are questions or problems regading the documentation, let us know! Thanks for your interest.