Bug 1295914, improve the label of the button of folder picker, r=baku,mstange,karlt,jimm

This commit is contained in:
Olli Pettay
2016-08-24 02:07:21 +03:00
parent ebd3b63b09
commit d06eced574
12 changed files with 61 additions and 6 deletions

View File

@@ -938,9 +938,14 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
// Get Loc title
nsXPIDLString title;
nsXPIDLString okButtonLabel;
if (aType == FILE_PICKER_DIRECTORY) {
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"DirectoryUpload", title);
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"DirectoryPickerOkButtonLabel",
okButtonLabel);
} else {
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"FileUpload", title);
@@ -963,6 +968,10 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
nsresult rv = filePicker->Init(win, title, mode);
NS_ENSURE_SUCCESS(rv, rv);
if (!okButtonLabel.IsEmpty()) {
filePicker->SetOkButtonLabel(okButtonLabel);
}
// Native directory pickers ignore file type filters, so we don't spend
// cycles adding them for FILE_PICKER_DIRECTORY.
if (HasAttr(kNameSpaceID_None, nsGkAtoms::accept) &&