User:Sardisson/Localizing Gecko Strings Redux

From Camino Wiki
< User:Sardisson
Revision as of 19:49, 27 January 2011 by Sardisson (talk | contribs) (whee!)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 *
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.

In addition, the list 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/alerts/notificationNames.properties
locale/en-US/autoconfig/autoconfig.properties
locale/en-US/cookie/cookieAcceptDialog.properties
locale/en-US/global-platform/mac/accessible.properties
locale/en-US/global-platform/mac/intl.properties
locale/en-US/global-platform/mac/platformKeys.properties
locale/en-US/global-platform/unix/accessible.properties
locale/en-US/global-platform/unix/intl.properties
locale/en-US/global-platform/unix/platformKeys.properties
locale/en-US/global-platform/win/accessible.properties
locale/en-US/global-platform/win/intl.properties
locale/en-US/global-platform/win/platformKeys.properties
locale/en-US/global-region/region.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/commonDialogs.properties
locale/en-US/global/config.properties
locale/en-US/global/console.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/downloadProgress.properties
locale/en-US/global/filefield.properties
locale/en-US/global/filepicker.properties
locale/en-US/global/findbar.properties
locale/en-US/global/finddialog.properties
locale/en-US/global/global-strres.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/layout/xmlparser.properties
locale/en-US/global/nsHelperAppDlg.properties
locale/en-US/global/nsProgressDialog.properties
locale/en-US/global/nsWebBrowserPersist.properties
locale/en-US/global/plugins.properties
locale/en-US/global/printdialog.properties
locale/en-US/global/printing.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/storage.properties
locale/en-US/global/svg/svg.properties
locale/en-US/global/typeaheadfind.properties *
locale/en-US/global/viewSource.properties
locale/en-US/global/webservices/security.properties
locale/en-US/global/wizard.properties
locale/en-US/global/xbl.properties
locale/en-US/global/xpinstall/xpinstall.properties
locale/en-US/global/xslt/xslt.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/extensions/update.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/profile/profileSelection.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/pipnss/security.properties
locale/en-US/pippki/pippki.properties
locale/en-US/places/places.properties

* 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

Untested files

Zarro!

File works

global-platform_locale_intl_properties.strings (new to GECKO_STRINGS in b4)
global-region_locale_region_properties.strings *
global_locale_appstrings_properties.strings *
global_locale_commonDialogs_properties.strings
global_locale_config_properties.strings *
global_locale_crashes_properties.strings *
global_locale_css_properties.strings
global_locale_dom_dom_properties.strings
global_locale_layout_errors_properties.strings
global_locale_layout_HtmlForm_properties.strings
global_locale_layout_MediaDocument_properties.strings
global_locale_layout_xmlparser_properties.strings
global_locale_plugins_properties.strings
global_locale_prompts_properties.strings
global_locale_xslt_xslt_properties.strings
necko_locale_necko_properties.strings
pipnss_locale_pipnss_properties.strings
pipnss_locale_nsserrors_properties.strings
pipnss_locale_security_properties.strings

File used in Camino but calling code ignores nsIStringBundleOverride, removed in b4

communicator_locale_typeaheadfind_properties.strings *
global_locale_security_caps_properties.strings

File unused in Camino, removed in b4

global_locale_charsetTitles_properties.strings
global_locale_dialog_properties.strings
global_locale_global-strres_properties.strings
global_locale_keys_properties.strings
global_locale_languageNames_properties.strings
global_locale_nsHelperAppDlg_properties.strings
global_locale_nsProgressDialog_properties.strings
global_locale_nsTreeSorting_properties.strings
global_locale_nsWebBrowserPersist_properties.strings
global_locale_printdialog_properties.strings
global_locale_printing_properties.strings
global_locale_printPageSetup_properties.strings
global_locale_regionNames_properties.strings
global_locale_storage_properties.strings
global_locale_tabbrowser_properties.strings
global_locale_xul_properties.strings (may be used, but only for XUL error messages logged to console)
global_locale_xbl_properties.strings (may be used, but only for XUL error messages logged to console)

* Denotes a file forked by either Camino or Firefox for which strings from the corresponding .properties file from the l10n 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.


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.