User:Sardisson/Localizing Gecko Strings Redux

From Camino Wiki
< User:Sardisson
Revision as of 21:59, 18 March 2011 by Sardisson (talk | contribs) (→‎Gecko .properties files: remove the 2.0 stuff, since it made the page long; I can just open the other page to compare)
Jump to navigation Jump to search

Beginning with Camino 2.1b1, all of the strings used by Gecko should be able to be exposed to our localizers. For more details on this, see Bug 248160, Bug 394105, and Bug 457290.

Contents of en-US.jar

unzip -t ../dist/bin/chrome/en-US.jar | grep -Ev "No errors" | grep -Ev "../dist" | cut -d ":" -f 2 | cut -d " " -f 2 | edit

Gecko .dtd files

Bug 457290 will be adding a way to localize Gecko .dtd files within Camino (as .dtd files).

Files used by Camino

locale/branding/brand.dtd * (this only says "Camino", though)
locale/en-US/global/config.dtd *
locale/en-US/global/global.dtd (used only for directionality)
locale/en-US/global/mozilla.dtd
locale/en-US/global/netError.dtd *
locale/en-US/global/xml/prettyprint.dtd
locale/en-US/mozapps/plugins/plugins.dtd *

Files not used by Camino or which need no localization

locale/en-US/cookie/cookieAcceptDialog.dtd
locale/en-US/global-region/region.dtd
locale/en-US/global/about.dtd
locale/en-US/global/aboutRights.dtd
locale/en-US/global/appPicker.dtd
locale/en-US/global/brand.dtd
locale/en-US/global/charsetOverlay.dtd
locale/en-US/global/commonDialog.dtd
locale/en-US/global/console.dtd
locale/en-US/global/crashes.dtd
locale/en-US/global/customizeCharset.dtd
locale/en-US/global/customizeToolbar.dtd
locale/en-US/global/datetimepicker.dtd
locale/en-US/global/dialogOverlay.dtd
locale/en-US/global/editMenuOverlay.dtd
locale/en-US/global/filepicker.dtd
locale/en-US/global/findbar.dtd
locale/en-US/global/finddialog.dtd
locale/en-US/global/globalKeys.dtd
locale/en-US/global/license.dtd
locale/en-US/global/netErrorApp.dtd
locale/en-US/global/notification.dtd
locale/en-US/global/nsHelperAppDlg.dtd
locale/en-US/global/nsProgressDialog.dtd
locale/en-US/global/preferences.dtd
locale/en-US/global/printdialog.dtd
locale/en-US/global/printjoboptions.dtd
locale/en-US/global/printPageSetup.dtd
locale/en-US/global/printPreview.dtd
locale/en-US/global/printPreviewProgress.dtd
locale/en-US/global/printProgress.dtd
locale/en-US/global/textcontext.dtd
locale/en-US/global/tree.dtd
locale/en-US/global/videocontrols.dtd
locale/en-US/global/viewSource.dtd
locale/en-US/global/wizard.dtd
locale/en-US/mozapps/downloads/downloads.dtd
locale/en-US/mozapps/downloads/settingsChange.dtd
locale/en-US/mozapps/downloads/unknownContentType.dtd
locale/en-US/mozapps/extensions/about.dtd
locale/en-US/mozapps/extensions/blocklist.dtd
locale/en-US/mozapps/extensions/errors.dtd
locale/en-US/mozapps/extensions/extensions.dtd
locale/en-US/mozapps/extensions/update.dtd
locale/en-US/mozapps/handling/handling.dtd
locale/en-US/mozapps/preferences/changemp.dtd
locale/en-US/mozapps/preferences/ocsp.dtd
locale/en-US/mozapps/preferences/removemp.dtd
locale/en-US/mozapps/profile/createProfileWizard.dtd
locale/en-US/mozapps/profile/profileSelection.dtd
locale/en-US/mozapps/update/history.dtd
locale/en-US/mozapps/update/incompatible.dtd
locale/en-US/mozapps/update/updates.dtd
locale/en-US/mozapps/xpinstall/xpinstallConfirm.dtd
locale/en-US/passwordmgr/passwordManager.dtd
locale/en-US/pippki/certManager.dtd
locale/en-US/pippki/deviceManager.dtd
locale/en-US/pippki/pippki.dtd
locale/en-US/pippki/validation.dtd

* Denotes a file forked by either Camino or Firefox for which strings from the corresponding .properties file from the l10n-mozilla1.9.2 repository cannot be used. This list is not yet complete.

Gecko .properties files

Bug 248160 and Bug 394105 enabled support for localizing Gecko .properties files in Camino 2. This added 36 new .strings files and hundreds of strings. Unfortunately, not all of these files are used—some of the files are for code not used at all by Camino, and some of the files are used by Camino, but the code that calls those strings does not work with the Gecko stringbundle override service, meaning localized versions of those files are ignored.

In order to eliminate useless strings for localizers, I have begun testing each file. The testing methodology is thus:

  1. Copy the English.lproj of a Camino 2pre build to French.lproj
    • N.B. It is also useful to use a build of Camino that adds a call to NSLog(tableName); just before the call to NSString* overrideStr = NSLocalizedStringFromTable(keyStr, tableName, nil); here, in order to determine if the stringbundle override service is telling us it wants to access one of our files
  2. Find one or more places that call the original Gecko .properties file (e.g., chrome://global/locale/dom/dom.properties) using MXR
    1. Examine the caller(s) and/or .properties file to determine if that code/those strings are used in Camino
    2. If the code/strings appear to be used, determine actions to perform to test the usage of the file
  3. Localize one or more strings in the .strings file
  4. Launch Camino with the French language active and perform the steps established in 2.2 above
  5. Check to see if the localized string from 3 above appears
    • If so, the file is used
    • If not, check the Console to see if a tableName was logged and the name matches the name of the .strings file you were testing
      • If there is no tableName, then the code that uses those strings ignores the stringbundle override service
      • If the tableName does not match, fix the name, test again, and file a bug to get the .strings file renamed if renaming the file allows the strings to be used

Camino 2.1

All of the _properties.strings files added by Camino 2 need to be audited to check for updates, and those files need to be updated.

find $HOME/Camino/dev/192branch/mozilla -name "*.properties" -path "*locale*" -not \( -path "*/browser/*" -or -path "*/testing/*" -or -path "*other-licenses*" -or -path "*/reporter/*" -or -path "*camino*" \) -print0 -exec hg log -l 1 {} \; | edit will list all the locale properties files and list the information about the file's last revision.

In addition, the lists of files below needs to be compared against the existing _properties.strings files; any new files that are used in Camino will need to be added (and any removed files should be removed).

locale/branding/brand.properties *
locale/en-US/cookie/cookieAcceptDialog.properties
locale/en-US/global-platform/mac/intl.properties
locale/en-US/global-platform/unix/intl.properties
locale/en-US/global-platform/win/intl.properties
locale/en-US/global/aboutRights.properties
locale/en-US/global/appstrings.properties
locale/en-US/global/browser.properties
locale/en-US/global/charsetTitles.properties
locale/en-US/global/contentAreaCommands.properties
locale/en-US/global/crashes.properties
locale/en-US/global/css.properties
locale/en-US/global/customizeToolbar.properties
locale/en-US/global/dateFormat.properties
locale/en-US/global/dialog.properties
locale/en-US/global/dom/dom.properties
locale/en-US/global/filefield.properties
locale/en-US/global/filepicker.properties
locale/en-US/global/findbar.properties
locale/en-US/global/gnomeprintdialog.properties
locale/en-US/global/intl.properties
locale/en-US/global/keys.properties
locale/en-US/global/languageNames.properties
locale/en-US/global/layout_errors.properties
locale/en-US/global/layout/HtmlForm.properties
locale/en-US/global/layout/MediaDocument.properties
locale/en-US/global/nsHelperAppDlg.properties
locale/en-US/global/plugins.properties
locale/en-US/global/prompts.properties
locale/en-US/global/regionNames.properties
locale/en-US/global/search/search.properties
locale/en-US/global/security/caps.properties
locale/en-US/global/typeaheadfind.properties *
locale/en-US/global/xbl.properties
locale/en-US/global/xpinstall/xpinstall.properties
locale/en-US/global/xul.properties
locale/en-US/mozapps/downloads/downloads.properties
locale/en-US/mozapps/downloads/unknownContentType.properties
locale/en-US/mozapps/extensions/extensions.properties
locale/en-US/mozapps/handling/handling.properties
locale/en-US/mozapps/plugins/plugins.properties *
locale/en-US/mozapps/preferences/preferences.properties
locale/en-US/mozapps/update/updates.properties
locale/en-US/mozapps/xpinstall/xpinstallConfirm.properties
locale/en-US/necko/necko.properties
locale/en-US/passwordmgr/passwordmgr.properties
locale/en-US/pipnss/nsserrors.properties
locale/en-US/pipnss/pipnss.properties
locale/en-US/pippki/pippki.properties
locale/en-US/places/places.properties

Unchanged since Hg (still needs checking for use in Camino)

locale/en-US/global-platform/mac/accessible.properties
locale/en-US/global-platform/unix/accessible.properties
locale/en-US/global-platform/win/accessible.properties
locale/en-US/global/global-strres.properties
locale/en-US/global/nsWebBrowserPersist.properties
locale/en-US/global/printdialog.properties
locale/en-US/global/storage.properties
locale/en-US/global/svg/svg.properties
locale/en-US/global/webservices/security.properties
locale/en-US/autoconfig/autoconfig.properties
locale/en-US/global/finddialog.properties
locale/en-US/global/viewSource.properties
locale/en-US/global/wizard.properties
locale/en-US/global-platform/mac/platformKeys.properties
locale/en-US/global-platform/unix/platformKeys.properties
locale/en-US/global-platform/win/platformKeys.properties
locale/en-US/global-region/region.properties
locale/en-US/mozapps/extensions/update.properties
locale/en-US/mozapps/profile/profileSelection.properties
locale/en-US/global/console.properties
locale/en-US/global/downloadProgress.properties
locale/en-US/global/nsProgressDialog.properties
locale/en-US/alerts/notificationNames.properties
locale/en-US/global/printing.properties

Unchanged since Hg, used in Camino 2

locale/en-US/global/layout/xmlparser.properties
locale/en-US/global/xslt/xslt.properties
locale/en-US/pipnss/security.properties
locale/en-US/global/commonDialogs.properties
locale/en-US/global/config.properties

Unchanged since Hg, not used in Camino

* Denotes a file forked by either Camino or Firefox for which strings from the corresponding .properties file from the l10n-mozilla1.9.2 repository cannot be used. This list is not yet complete.

For global_locale_appstrings_properties.strings, the text from appstrings.properties in dom/locales/ can be used, but text from the version in browser/locales/ must not be used.

Camino 2.0

See User:Sardisson/Localizing_Gecko_Strings for the lists of files examined for Camino 2.0.


sed+iconv rule from a Makefile for transforming the content of translated Core files and producing a UTF-16-encoded file (will not rename files):

sed -E -e "s/^#(.*)$$/\/\* #\1 \*\//" \
       -e 's/\"/\\\"/g' \
    -E -e "s/^([^\"#= ]*)([[:space:]]*)=([[:space:]]*)(.*)$$/\"\1\" = \"\4\";/" $< | \
iconv -f UTF-8 -t UTF-16 > $@

$< should be replaced by the input file and $@ by the output file.