Closed Bug 939791 Opened 11 years ago Closed 10 years ago

[settings] keyboard: {{type}} in mustHaveOneKeyboard is empty for text keyboards

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-v2.0 fixed)

VERIFIED FIXED
2.0 S1 (9may)
Tracking Status
b2g-v2.0 --- fixed

People

(Reporter: aryx, Assigned: flod)

Details

(Keywords: l12y)

Attachments

(1 file)

Boot2Gecko 1.2.0.0-prerelease 20131117224236 on Keon

When going to Settings > Keyboards > Selected Keyboards > Add more keyboards > And disabling all text keyboards, {{type}} in
At least one {{type}} keyboard should be selected
is an empty string which is troublesome for localization because some languages like German use concatenation and show "[...] -Tastatur [...]"

keyboardType-text should be used here.
This should be the code
https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/js/keyboard.js#L457

It uses keyboardType-' + layout.inputManifest.types.sort()[0] to generate the name of the key that has to be used to localize {{type}}. So the problem should be with the keyboard not having a type "text" associated, but the code is kind of hard to figure out.
Summary: [settings] keyboard: {{type}} in mustHaveOneKeyboard should not be optional → [settings] keyboard: {{type}} in mustHaveOneKeyboard is empty for text keyboards
Actually, the problem is that keyboard layouts are defined like this (this is from en.js)

> types: ['text', 'url', 'email']

That line of JavaScript sorts the types, so instead of using 'text' it uses 'email', generating a warning for missing key.

Removing .sort() and adding the missing 'email' type should solve both issues.
Attached file Pull request on Github
Attachment #8392898 - Flags: review?(ehung)
Comment on attachment 8392898 [details] [review]
Pull request on Github

Arthur is the author of this part, he knows more on the sorting here. Redirect the review to him. I also left a comment on Github.
Attachment #8392898 - Flags: review?(ehung) → review?(arthur.chen)
One other thought: is it possible for a keyboard layout to be defined without "types" and trigger this dialog with an empty {{type}}?
Assignee: nobody → francesco.lodolo
Comment on attachment 8392898 [details] [review]
Pull request on Github

Thanks for the patch! The original seems buggy. I've proposed a proper fix in github, let me know if that makes sense.
Attachment #8392898 - Flags: review?(arthur.chen)
I commented on GitHub too: you're right about "text" being used also when I disable the last "url" keyboard, but I'm not sure I follow the suggestion (code is definitely beyond my current understanding of JavaScript, I get lost in callbacks).

From what I understand, when that code is reached, "layout" is already "en.js" and the default keyboard has been already re-enabled, so:
* I have no way to tell the type of (disabled) keyboard that triggered this dialog.
* A call to keyboardHelper.checkDefaults wouldn't give me any results.
Comment on attachment 8392898 [details] [review]
Pull request on Github

Resetting review. Patch works on my system and tests pass.
Attachment #8392898 - Flags: review?(arthur.chen)
Comment on attachment 8392898 [details] [review]
Pull request on Github

Looks good to me. Thank you for the effort!
Attachment #8392898 - Flags: review?(arthur.chen) → review+
Thanks, setting keyword for checkin.
Keywords: checkin-needed
Master: https://github.com/mozilla-b2g/gaia/commit/5bf8e888d7e2f7581b75662205356f1c47276ab6
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 1.5 S1 (9may)
Verified on Keon with build 2014-03-25
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: