Closed Bug 32666 Opened 20 years ago Closed 20 years ago

[FIX][i18n] Cannot localize file upload dialog (string is hardcode)

Categories

(Core :: Layout: Form Controls, defect, P3, major)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: m_kato, Assigned: rods)

References

()

Details

(Whiteboard: [nsbeta2+][6/15]Fix is in my tree)

REPRO STEP
==========
1. view http://hp.vector.co.jp/authors/VA008030/mozilla/file.html.
2. click [Browse...] button.

DESCRIPTION
===========
'nsString title("File Upload");' and 'nsString titles[] = {"all files"};' 
should not hardcode!!

- In mozilla/layout/html/forms/src/nsFileControlFrame.cpp

nsresult 
nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
{
  nsIView* textView;
  mTextFrame->GetView(mPresContext, &textView);
  if (nsnull == textView) {
    return NS_OK;
  }

  nsresult result = NS_OK;
  nsIView*   parentView;
  textView->GetParent(parentView);
  nsIWidget* parentWidget = GetWindowTemp(parentView);
 
  nsIFileWidget *fileWidget = nsnull;
  
  nsString title("File Upload");
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, 
(void**)&fileWidget);
  
  if (fileWidget) {
    nsString titles[] = {"all files"};
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    nsString filters[] = {"*.*"};
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fileWidget->SetFilterList(1, titles, filters);

    fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
    result = fileWidget->Show();

    if (result) {
      nsFileSpec fileSpec;
      fileWidget->GetFile(fileSpec);
      nsAutoString  pathName;
      fileSpec.GetNativePathString(pathName);
      mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value, pathName);
    }
    NS_RELEASE(fileWidget);
  }
  NS_RELEASE(parentWidget);

  return NS_OK;
}
We should use IFilePicker.  FileWidget is obsolute.
Reassigned to ftang. Component changed to I18N.
Assignee: rchen → ftang
Component: Localization → Internationalization
rchen/tao- please attach informatio about "how to make your code localizable" 
and some pointer to sample code in SeaMonkey
karnaze- we don't know who own nsFileControlFrame.cpp these day. Please reassign 
this the the right person to make it use stringbundle so it is localizable. 
Thanks
Assignee: ftang → karnaze
Status: UNCONFIRMED → NEW
Component: Internationalization → HTML Form Controls
Ever confirmed: true
Reassigning to Rod.
Assignee: karnaze → rods
We need to do the same thing we did for submit, reset, browse.
Severity: normal → major
Status: NEW → ASSIGNED
Target Milestone: --- → M17
nsbeta2. product UI i18n/l10n blocker.
Keywords: nsbeta2
Summary: Cannot localize file upload dialog (string is hardcode) → [i18n] Cannot localize file upload dialog (string is hardcode)
Summary: [i18n] Cannot localize file upload dialog (string is hardcode) → [FIX][i18n] Cannot localize file upload dialog (string is hardcode)
Whiteboard: Fix is in my tree
changing milestone to M16
Target Milestone: M17 → M16
Putting on [nsbeta2+][6/15] radar for beta2 fix. 
Whiteboard: Fix is in my tree → [nsbeta2+][6/15]Fix is in my tree
fixed
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Blocks: 12394
reopen.  the dialog title "File Upload" cannot Localize...
And nsIFileWidget is obsolete.  you should rewritten to nsIFilePicker!!
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Ok, so that is embaressing, it was right there and I missed it. I will check 
in a fix soon.
Status: REOPENED → ASSIGNED
fixed
Status: ASSIGNED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
VERIFIED!

The strings have been moved to HtmlForm.properties. 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.