Closed Bug 751428 Opened 13 years ago Closed 13 years ago

[AccessFu] Remove spaces and catch exceptions when localizing role names

Categories

(Core :: Disability Access APIs, defect)

ARM
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: eeejay, Assigned: eeejay)

Details

Attachments

(1 file, 1 obsolete file)

Some role names have spaces, we need to remove the spaces to make it a legal token for localization. Also, use an empty string when the role name is not localizable instead of throwing an exception.
Comment on attachment 620532 [details] [diff] [review] Remove spaces and catch exceptions when localizing role names. Oops
Attachment #620532 - Attachment is obsolete: true
Attachment #620532 - Flags: review?
Made a special new method for this, instead of doing the try/catch dance everywhere.
Attachment #620536 - Flags: review?(dbolter)
Comment on attachment 620536 [details] [diff] [review] Remove spaces and catch exceptions when localizing role names. Review of attachment 620536 [details] [diff] [review]: ----------------------------------------------------------------- r=me. Thanks for the explanation over on bug 751435 and IRC - that you need to trim whitespace so that you can use these as the key for l10n lookups. ::: accessible/src/jsat/UtteranceGenerator.jsm @@ +220,5 @@ > return [desc, name]; > } > + }, > + > + _getLocalizedRole: function(aRoleStr) { Are you using this convention for denoting mock encapsulation?
Attachment #620536 - Flags: review?(dbolter) → review+
(I mean the underscore prefix)
(In reply to David Bolter [:davidb] from comment #4) > Comment on attachment 620536 [details] [diff] [review] > Remove spaces and catch exceptions when localizing role names. > > Review of attachment 620536 [details] [diff] [review]: > ----------------------------------------------------------------- > > r=me. Thanks for the explanation over on bug 751435 and IRC - that you need > to trim whitespace so that you can use these as the key for l10n lookups. Thanks! > > ::: accessible/src/jsat/UtteranceGenerator.jsm > @@ +220,5 @@ > > return [desc, name]; > > } > > + }, > > + > > + _getLocalizedRole: function(aRoleStr) { > > Are you using this convention for denoting mock encapsulation? No, I am using it for private methods on an object that otherwise has public methods. Something from Python, although I have seen it in other mozilla js. Need to be more consistent with it.
(In reply to Eitan Isaacson [:eeejay] from comment #6) > (In reply to David Bolter [:davidb] from comment #4) > > > + _getLocalizedRole: function(aRoleStr) { > > > > Are you using this convention for denoting mock encapsulation? > > No, I am using it for private methods on an object that otherwise has public > methods. Something from Python, although I have seen it in other mozilla js. > Need to be more consistent with it. Heh. Encapsulation has two meanings (who knew?) but I meant "a language mechanism for restricting access to some of the object's components." (wikipedia) Anyways, all good. As long as you plan on consistency using _ for mock privacy it is fine with me. It isn't worth doing the Crockford tricks for actual privacy IMO.
Comment on attachment 620536 [details] [diff] [review] Remove spaces and catch exceptions when localizing role names. Review of attachment 620536 [details] [diff] [review]: ----------------------------------------------------------------- ::: accessible/src/jsat/UtteranceGenerator.jsm @@ +220,5 @@ > return [desc, name]; > } > + }, > + > + _getLocalizedRole: function(aRoleStr) { pls don't use unnamed functions @@ +222,5 @@ > + }, > + > + _getLocalizedRole: function(aRoleStr) { > + try { > + return gStringBundle.GetStringFromName(aRoleStr.replace(' ', '')); just curious if properties file is updated to this logic already
Assignee: nobody → eitan
OS: Linux → Android
Hardware: x86_64 → ARM
Target Milestone: --- → mozilla15
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: