1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
ash / quick_insert / views / quick_insert_strings.cc [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/quick_insert/views/quick_insert_strings.h"
#include <string>
#include "ash/quick_insert/model/quick_insert_search_results_section.h"
#include "ash/quick_insert/quick_insert_category.h"
#include "ash/quick_insert/views/quick_insert_category_type.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/notreached.h"
#include "build/branding_buildflags.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "ui/base/l10n/l10n_util.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chromeos/ash/resources/internal/strings/grit/ash_internal_strings.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace ash {
std::u16string GetLabelForQuickInsertCategory(QuickInsertCategory category) {
switch (category) {
case QuickInsertCategory::kEditorWrite:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return l10n_util::GetStringUTF16(IDS_EDITOR_MENU_WRITE_CARD_TITLE);
#else
return u"Editor";
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
case QuickInsertCategory::kEditorRewrite:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return l10n_util::GetStringUTF16(IDS_EDITOR_MENU_REWRITE_CARD_TITLE);
#else
return u"Editor";
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
case QuickInsertCategory::kLobsterWithNoSelectedText:
case QuickInsertCategory::kLobsterWithSelectedText:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return l10n_util::GetStringUTF16(IDS_PICKER_LOBSTER_SELECTION_LABEL);
#else
return u"Lobster";
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
case QuickInsertCategory::kLinks:
return l10n_util::GetStringUTF16(IDS_PICKER_LINKS_CATEGORY_LABEL);
case QuickInsertCategory::kEmojisGifs:
return l10n_util::GetStringUTF16(IDS_PICKER_EXPRESSIONS_CATEGORY_LABEL);
case QuickInsertCategory::kEmojis:
return l10n_util::GetStringUTF16(IDS_PICKER_EMOJIS_CATEGORY_LABEL);
case QuickInsertCategory::kGifs:
// The label is not translated to keep the width of the GIF button
// constant. It is treated like an icon.
return u"GIF";
case QuickInsertCategory::kClipboard:
return l10n_util::GetStringUTF16(IDS_PICKER_CLIPBOARD_CATEGORY_LABEL);
case QuickInsertCategory::kDriveFiles:
return l10n_util::GetStringUTF16(IDS_PICKER_DRIVE_FILES_CATEGORY_LABEL);
case QuickInsertCategory::kLocalFiles:
return l10n_util::GetStringUTF16(IDS_PICKER_LOCAL_FILES_CATEGORY_LABEL);
case QuickInsertCategory::kDatesTimes:
return l10n_util::GetStringUTF16(IDS_PICKER_DATES_TIMES_CATEGORY_LABEL);
case QuickInsertCategory::kUnitsMaths:
return l10n_util::GetStringUTF16(IDS_PICKER_UNITS_MATHS_CATEGORY_LABEL);
}
}
std::u16string GetSearchFieldPlaceholderTextForQuickInsertCategory(
QuickInsertCategory category) {
switch (category) {
case QuickInsertCategory::kLinks:
return l10n_util::GetStringUTF16(
IDS_PICKER_LINKS_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
case QuickInsertCategory::kClipboard:
return l10n_util::GetStringUTF16(
IDS_PICKER_CLIPBOARD_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
case QuickInsertCategory::kDriveFiles:
return l10n_util::GetStringUTF16(
IDS_PICKER_DRIVE_FILES_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
case QuickInsertCategory::kLocalFiles:
return l10n_util::GetStringUTF16(
IDS_PICKER_LOCAL_FILES_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
case QuickInsertCategory::kDatesTimes:
return l10n_util::GetStringUTF16(
IDS_PICKER_DATES_TIMES_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
case QuickInsertCategory::kUnitsMaths:
return l10n_util::GetStringUTF16(
IDS_PICKER_UNITS_MATHS_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
case QuickInsertCategory::kEditorWrite:
case QuickInsertCategory::kEditorRewrite:
case QuickInsertCategory::kLobsterWithNoSelectedText:
case QuickInsertCategory::kLobsterWithSelectedText:
case QuickInsertCategory::kEmojisGifs:
case QuickInsertCategory::kEmojis:
NOTREACHED();
case QuickInsertCategory::kGifs:
return l10n_util::GetStringUTF16(
IDS_QUICK_INSERT_GIFS_CATEGORY_SEARCH_FIELD_PLACEHOLDER_TEXT);
}
}
std::u16string GetSectionTitleForQuickInsertCategoryType(
QuickInsertCategoryType category_type) {
switch (category_type) {
case QuickInsertCategoryType::kEditorWrite:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return l10n_util::GetStringUTF16(
IDS_PICKER_EDITOR_WRITE_CATEGORY_TYPE_SECTION_TITLE);
#else
return u"";
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
case QuickInsertCategoryType::kEditorRewrite:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return l10n_util::GetStringUTF16(
IDS_PICKER_EDITOR_REWRITE_CATEGORY_TYPE_SECTION_TITLE);
#else
return u"";
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
case QuickInsertCategoryType::kLobster:
return u"";
case QuickInsertCategoryType::kGeneral:
return l10n_util::GetStringUTF16(
IDS_PICKER_GENERAL_CATEGORY_TYPE_SECTION_TITLE);
case QuickInsertCategoryType::kMore:
return l10n_util::GetStringUTF16(
IDS_PICKER_MORE_CATEGORY_TYPE_SECTION_TITLE);
case QuickInsertCategoryType::kCaseTransformations:
return l10n_util::GetStringUTF16(
IDS_PICKER_EDIT_TEXT_CATEGORY_TYPE_SECTION_TITLE);
case QuickInsertCategoryType::kNone:
return u"";
}
}
std::u16string GetSectionTitleForQuickInsertSectionType(
QuickInsertSectionType section_type) {
switch (section_type) {
case QuickInsertSectionType::kNone:
return u"";
case QuickInsertSectionType::kClipboard:
return l10n_util::GetStringUTF16(IDS_PICKER_CLIPBOARD_CATEGORY_LABEL);
case QuickInsertSectionType::kExamples:
return l10n_util::GetStringUTF16(
IDS_PICKER_EXAMPLES_CATEGORY_TYPE_SECTION_TITLE);
case QuickInsertSectionType::kContentEditor:
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// TODO: b/369726248 - Rename the IDS variable name to a generic name.
return l10n_util::GetStringUTF16(
IDS_PICKER_EDITOR_WRITE_CATEGORY_TYPE_SECTION_TITLE);
#else
return u"";
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
case QuickInsertSectionType::kLinks:
return l10n_util::GetStringUTF16(IDS_PICKER_LINKS_CATEGORY_LABEL);
case QuickInsertSectionType::kLocalFiles:
return l10n_util::GetStringUTF16(IDS_PICKER_LOCAL_FILES_CATEGORY_LABEL);
case QuickInsertSectionType::kDriveFiles:
return l10n_util::GetStringUTF16(IDS_PICKER_DRIVE_FILES_CATEGORY_LABEL);
case QuickInsertSectionType::kFeaturedGifs:
return l10n_util::GetStringUTF16(
IDS_QUICK_INSERT_FEATURED_GIFS_CATEGORY_TYPE_SECTION_TITLE);
case QuickInsertSectionType::kSearchedGifs:
return u"";
}
}
} // namespace ash