fix: i18n of gtk msgbox buttons (#19904)

* fix: i18n of gtk msgbox buttons

similar to #19756 (12df0e8) but for messageboxes

* refactor: DRY the gtk+ button mnemonics

* fix: don't compile gtk_util on non-Linux platforms

rename from `gtk_util.[cc,h]` to `util_gtk.[cc,h]` so that it gets
picked up by the `extra_source_filters` rule in `BUILD.gn`.

* fix: make linter happy

It really shows that I cannot build locally atm... :P
This commit is contained in:
Charles Kerr 2019-08-27 09:57:12 -05:00 committed by GitHub
parent 2542c51c48
commit 7e61cd0dfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 32 deletions

View file

@ -3,8 +3,7 @@
// found in the LICENSE file.
#include "shell/browser/ui/message_box.h"
#include <glib/gi18n.h>
#include "shell/browser/ui/util_gtk.h"
#include "base/callback.h"
#include "base/strings/string_util.h"
@ -123,13 +122,13 @@ class GtkMessageBox : public NativeWindowObserver {
const char* TranslateToStock(int id, const std::string& text) {
const std::string lower = base::ToLowerASCII(text);
if (lower == "cancel")
return _("_Cancel");
return gtk_util::kCancelLabel;
if (lower == "no")
return _("_No");
return gtk_util::kNoLabel;
if (lower == "ok")
return _("_OK");
return gtk_util::kOkLabel;
if (lower == "yes")
return _("_Yes");
return gtk_util::kYesLabel;
return text.c_str();
}