ax_enum_localization_util.cc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/accessibility/ax_enum_localization_util.h"
  5. #include "ui/accessibility/ax_enums.mojom.h"
  6. #include "ui/base/l10n/l10n_util.h"
  7. #include "ui/strings/grit/ax_strings.h"
  8. namespace ui {
  9. std::string ToLocalizedString(ax::mojom::DefaultActionVerb action_verb) {
  10. switch (action_verb) {
  11. case ax::mojom::DefaultActionVerb::kNone:
  12. return "";
  13. case ax::mojom::DefaultActionVerb::kActivate:
  14. return l10n_util::GetStringUTF8(IDS_AX_ACTIVATE_ACTION_VERB);
  15. case ax::mojom::DefaultActionVerb::kCheck:
  16. return l10n_util::GetStringUTF8(IDS_AX_CHECK_ACTION_VERB);
  17. case ax::mojom::DefaultActionVerb::kClick:
  18. return l10n_util::GetStringUTF8(IDS_AX_CLICK_ACTION_VERB);
  19. case ax::mojom::DefaultActionVerb::kClickAncestor:
  20. return l10n_util::GetStringUTF8(IDS_AX_CLICK_ANCESTOR_ACTION_VERB);
  21. case ax::mojom::DefaultActionVerb::kJump:
  22. return l10n_util::GetStringUTF8(IDS_AX_JUMP_ACTION_VERB);
  23. case ax::mojom::DefaultActionVerb::kOpen:
  24. return l10n_util::GetStringUTF8(IDS_AX_OPEN_ACTION_VERB);
  25. case ax::mojom::DefaultActionVerb::kPress:
  26. return l10n_util::GetStringUTF8(IDS_AX_PRESS_ACTION_VERB);
  27. case ax::mojom::DefaultActionVerb::kSelect:
  28. return l10n_util::GetStringUTF8(IDS_AX_SELECT_ACTION_VERB);
  29. case ax::mojom::DefaultActionVerb::kUncheck:
  30. return l10n_util::GetStringUTF8(IDS_AX_UNCHECK_ACTION_VERB);
  31. }
  32. return "";
  33. }
  34. } // namespace ui