Fix localization of default context menu labels (issue #2081)

This commit is contained in:
Marshall Greenblatt 2017-02-01 15:24:20 -05:00
parent a90b50f1ff
commit 94f604975d
4 changed files with 26 additions and 75 deletions

View File

@ -318,17 +318,18 @@ void CefMenuManager::CreateDefaultModel() {
if (params_.is_editable) {
// Editable node.
model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO));
model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO));
model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_CONTENT_CONTEXT_UNDO));
model_->AddItem(MENU_ID_REDO, GetLabel(IDS_CONTENT_CONTEXT_REDO));
model_->AddSeparator();
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE));
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE));
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_CONTENT_CONTEXT_CUT));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_CONTENT_CONTEXT_COPY));
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_CONTENT_CONTEXT_PASTE));
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_CONTENT_CONTEXT_DELETE));
model_->AddSeparator();
model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL));
model_->AddItem(MENU_ID_SELECT_ALL,
GetLabel(IDS_CONTENT_CONTEXT_SELECTALL));
if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO))
model_->SetEnabled(MENU_ID_UNDO, false);
@ -376,15 +377,16 @@ void CefMenuManager::CreateDefaultModel() {
}
} else if (!params_.selection_text.empty()) {
// Something is selected.
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_CONTENT_CONTEXT_COPY));
} else if (!params_.page_url.is_empty() || !params_.frame_url.is_empty()) {
// Page or frame.
model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK));
model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD));
model_->AddItem(MENU_ID_BACK, GetLabel(IDS_CONTENT_CONTEXT_BACK));
model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_CONTENT_CONTEXT_FORWARD));
model_->AddSeparator();
model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT));
model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE));
model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_CONTENT_CONTEXT_PRINT));
model_->AddItem(MENU_ID_VIEW_SOURCE,
GetLabel(IDS_CONTENT_CONTEXT_VIEWPAGESOURCE));
if (!browser_->CanGoBack())
model_->SetEnabled(MENU_ID_BACK, false);

View File

@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "cef/grit/cef_strings.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/common/file_chooser_params.h"
#include "net/base/mime_util.h"
#include "ui/base/l10n/l10n_util.h"
@ -30,10 +31,10 @@ base::string16 GetDescriptionFromMimeType(const std::string& mime_type) {
const char* mime_type;
int string_id;
} kWildCardMimeTypes[] = {
{ "audio", IDS_APP_AUDIO_FILES },
{ "image", IDS_APP_IMAGE_FILES },
{ "text", IDS_APP_TEXT_FILES },
{ "video", IDS_APP_VIDEO_FILES },
{ "audio", IDS_AUDIO_FILES },
{ "image", IDS_IMAGE_FILES },
{ "text", IDS_TEXT_FILES },
{ "video", IDS_VIDEO_FILES },
};
for (size_t i = 0; i < arraysize(kWildCardMimeTypes); ++i) {

View File

@ -17,6 +17,7 @@
#include "base/win/registry.h"
#include "base/win/scoped_comptr.h"
#include "cef/grit/cef_strings.h"
#include "chrome/grit/generated_resources.h"
#include "net/base/mime_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/win/shell.h"
@ -131,10 +132,10 @@ std::wstring GetDescriptionFromMimeType(const std::string& mime_type) {
const char* mime_type;
int string_id;
} kWildCardMimeTypes[] = {
{ "audio", IDS_APP_AUDIO_FILES },
{ "image", IDS_APP_IMAGE_FILES },
{ "text", IDS_APP_TEXT_FILES },
{ "video", IDS_APP_VIDEO_FILES },
{ "audio", IDS_AUDIO_FILES },
{ "image", IDS_IMAGE_FILES },
{ "text", IDS_TEXT_FILES },
{ "video", IDS_VIDEO_FILES },
};
for (size_t i = 0; i < arraysize(kWildCardMimeTypes); ++i) {

View File

@ -111,63 +111,10 @@ need to be translated for each locale.-->
<ph> element). You can also use the 'grit add' tool to help you identify
nontranslateable parts and create placeholders for them. -->
<message name="IDS_MENU_BACK" desc="The text label of the Back menu item">
&amp;Back
</message>
<message name="IDS_MENU_FORWARD" desc="The text label of the Forward menu item">
&amp;Forward
</message>
<message name="IDS_MENU_RELOAD" desc="The text label of the Reload menu item">
Re&amp;load
</message>
<message name="IDS_MENU_RELOAD_NOCACHE" desc="The text label of the Reload no cache menu item">
Reload no cache
</message>
<message name="IDS_MENU_STOPLOAD" desc="The text label of the Stop menu item">
&amp;Stop
</message>
<message name="IDS_MENU_UNDO" desc="The text label of the Undo menu item">
&amp;Undo
</message>
<message name="IDS_MENU_REDO" desc="The text label of the Redo menu item">
&amp;Redo
</message>
<message name="IDS_MENU_CUT" desc="The text label of the Cut menu item">
Cu&amp;t
</message>
<message name="IDS_MENU_COPY" desc="The text label of the Copy menu item">
&amp;Copy
</message>
<message name="IDS_MENU_PASTE" desc="The text label of the Paste menu item" meaning="'Paste' menu command in sentence case">
&amp;Paste
</message>
<message name="IDS_MENU_DELETE" desc="The text label of the Delete menu item (which deletes selected text without copying to clipboard)">
&amp;Delete
</message>
<message name="IDS_MENU_SELECT_ALL" desc="The text label of the Select All menu item">
Select &amp;all
</message>
<message name="IDS_MENU_FIND" desc="The text label of the Find... menu item">
&amp;Find...
</message>
<message name="IDS_MENU_PRINT" desc="The text label of the Print... menu item. Opens a dialog box to select print settings">
&amp;Print...
</message>
<message name="IDS_MENU_VIEW_SOURCE" desc="The text label for the View Source... menu item.">
View s&amp;ource
</message>
<message name="IDS_APP_AUDIO_FILES" desc="The text label for the Audio Files filter in file open/save dialogs.">
Audio Files
</message>
<message name="IDS_APP_IMAGE_FILES" desc="The text label for the Image Files filter in file open/save dialogs.">
Image Files
</message>
<message name="IDS_APP_TEXT_FILES" desc="The text label for the Text Files filter in file open/save dialogs.">
<!-- Other values come from chrome/app/generated_resources.grd -->
<message name="IDS_TEXT_FILES" desc="The description of the text file extensions in the select file dialog.">
Text Files
</message>
<message name="IDS_APP_VIDEO_FILES" desc="The text label for the Video Files filter in file open/save dialogs.">
Video Files
</message>
</messages>
</release>
</grit>