Skip to content

Commit 2c0fb3b

Browse files
committed
Cleanup strings
- add custom profile image replace tooltip - remove unused custom profile image preview label
1 parent 08c04d5 commit 2c0fb3b

5 files changed

Lines changed: 23 additions & 29 deletions

File tree

app/custom_profile_image_strings.grdp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
<message name="IDS_CUSTOM_PROFILE_IMAGE_REPLACE_ACTION" desc="Label for the custom profile image replace button." formatter_data="webui=BraveSettings">
1010
Replace
1111
</message>
12+
<message name="IDS_CUSTOM_PROFILE_IMAGE_REPLACE_TOOLTIP" desc="Tooltip and accessibility label for the custom profile image replace button." formatter_data="webui=BraveSettings">
13+
Replace custom profile image
14+
</message>
1215
<message name="IDS_CUSTOM_PROFILE_IMAGE_REMOVE_ACTION" desc="Label for the custom profile image remove button." formatter_data="webui=BraveSettings">
1316
Remove
1417
</message>
15-
<message name="IDS_CUSTOM_PROFILE_IMAGE_SELECTED_PREVIEW_LABEL" desc="Accessibility label for a selected custom profile image preview. PREVIEW_LABEL is the preview label." formatter_data="webui=BraveSettings">
16-
<ph name="PREVIEW_LABEL">$1<ex>Custom profile image preview</ex></ph>, selected
17-
</message>
18-
<message name="IDS_CUSTOM_PROFILE_IMAGE_PREVIEW_LABEL" desc="Accessibility label for the custom profile image preview." formatter_data="webui=BraveSettings">
19-
Custom profile image preview
18+
<message name="IDS_CUSTOM_PROFILE_IMAGE_SELECTED_PREVIEW_LABEL" desc="Accessibility label for a selected custom profile image preview." formatter_data="webui=BraveSettings">
19+
Custom profile image preview, selected
2020
</message>
2121
<message name="IDS_CUSTOM_PROFILE_IMAGE_UPLOAD_TOOLTIP" desc="Tooltip and accessibility label for the custom profile image upload control." formatter_data="webui=BraveSettings">
2222
Upload a custom profile image

browser/resources/settings/br/settings_manage_profile.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ RegisterStyleOverride(
5353
const kCustomProfileImageRowId = 'customProfileImageRow'
5454

5555
function createCustomProfileImageSection(): DocumentFragment {
56-
const previewLabel = loadTimeData.getString(
57-
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_PREVIEW_LABEL,
58-
)
59-
const selectedPreviewLabel = loadTimeData.getStringF(
60-
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_SELECTED_PREVIEW_LABEL,
61-
previewLabel,
62-
)
63-
6456
const section = document.createDocumentFragment()
6557
render(
6658
html`
@@ -83,11 +75,15 @@ function createCustomProfileImageSection(): DocumentFragment {
8375
replace-label=${loadTimeData.getString(
8476
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_REPLACE_ACTION,
8577
)}
78+
replace-tooltip=${loadTimeData.getString(
79+
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_REPLACE_TOOLTIP,
80+
)}
8681
remove-label=${loadTimeData.getString(
8782
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_REMOVE_ACTION,
8883
)}
89-
selected-preview-label=${selectedPreviewLabel}
90-
preview-label=${previewLabel}
84+
selected-preview-label=${loadTimeData.getString(
85+
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_SELECTED_PREVIEW_LABEL,
86+
)}
9187
upload-tooltip=${loadTimeData.getString(
9288
BraveSettingsStrings.CUSTOM_PROFILE_IMAGE_UPLOAD_TOOLTIP,
9389
)}

chromium_src/chrome/test/data/webui/settings/people_page_manage_profile_test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,15 @@ function braveManageProfileFeatureEnabledTests() {
269269
row.replaceLabel,
270270
)
271271
assertEquals(
272-
loadTimeData.getString('CUSTOM_PROFILE_IMAGE_REMOVE_ACTION'),
273-
row.removeLabel,
272+
loadTimeData.getString('CUSTOM_PROFILE_IMAGE_REPLACE_TOOLTIP'),
273+
row.replaceTooltip,
274274
)
275275
assertEquals(
276-
loadTimeData.getString('CUSTOM_PROFILE_IMAGE_PREVIEW_LABEL'),
277-
row.previewLabel,
276+
loadTimeData.getString('CUSTOM_PROFILE_IMAGE_REMOVE_ACTION'),
277+
row.removeLabel,
278278
)
279279
assertEquals(
280-
loadTimeData.getStringF(
281-
'CUSTOM_PROFILE_IMAGE_SELECTED_PREVIEW_LABEL',
282-
row.previewLabel,
283-
),
280+
loadTimeData.getString('CUSTOM_PROFILE_IMAGE_SELECTED_PREVIEW_LABEL'),
284281
row.selectedPreviewLabel,
285282
)
286283
assertEquals(
@@ -366,7 +363,8 @@ function braveManageProfileFeatureEnabledTests() {
366363
)
367364
assertEquals('CR-BUTTON', replaceButton.tagName)
368365
assertEquals(row.replaceLabel, replaceButton.textContent.trim())
369-
assertEquals(row.replaceLabel, replaceButton.getAttribute('aria-label'))
366+
assertEquals(row.replaceTooltip, replaceButton.getAttribute('title'))
367+
assertEquals(row.replaceTooltip, replaceButton.getAttribute('aria-label'))
370368
assertEquals(
371369
'CR-BUTTON',
372370
getRequiredElement<HTMLElement>(row.shadowRoot, '#removeButton').tagName,

ui/webui/resources/custom_profile_image_row.html.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function getHtml(this: BrCustomProfileImageRowElement) {
2727
id="preview"
2828
class="selected"
2929
role="img"
30-
aria-label="${this.selectedPreviewLabel || this.previewLabel}"
30+
aria-label="${this.selectedPreviewLabel}"
3131
>
3232
${this.localPreviewUrl_
3333
? html`<img
@@ -53,7 +53,7 @@ export function getHtml(this: BrCustomProfileImageRowElement) {
5353
class="no-overlap"
5454
iron-icon="cr:add"
5555
title="${this.uploadTooltip || nothing}"
56-
aria-label="${this.uploadTooltip || this.previewLabel}"
56+
aria-label="${this.uploadTooltip}"
5757
@click="${this.onUploadClick_}"
5858
></cr-icon-button>
5959
`}

ui/webui/resources/custom_profile_image_row.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export class BrCustomProfileImageRowElement extends CrLitElement {
3434
state: {type: String, reflect: true},
3535
hideTitle: {type: Boolean, attribute: 'hide-title'},
3636
invalidImageLabel: {type: String, attribute: 'invalid-image-label'},
37-
previewLabel: {type: String, attribute: 'preview-label'},
3837
replaceLabel: {type: String, attribute: 'replace-label'},
38+
replaceTooltip: {type: String, attribute: 'replace-tooltip'},
3939
removeLabel: {type: String, attribute: 'remove-label'},
4040
removeTooltip: {type: String, attribute: 'remove-tooltip'},
4141
selectedPreviewLabel: {
@@ -52,8 +52,8 @@ export class BrCustomProfileImageRowElement extends CrLitElement {
5252
accessor state: CustomProfileImageState = 'empty'
5353
accessor hideTitle: boolean = false
5454
accessor invalidImageLabel: string = ''
55-
accessor previewLabel: string = ''
5655
accessor replaceLabel: string = ''
56+
accessor replaceTooltip: string = ''
5757
accessor removeLabel: string = ''
5858
accessor removeTooltip: string = ''
5959
accessor selectedPreviewLabel: string = ''
@@ -73,7 +73,7 @@ export class BrCustomProfileImageRowElement extends CrLitElement {
7373
}
7474

7575
protected getUploadButtonTooltip_(): string {
76-
return this.isSaved_() ? this.replaceLabel : this.uploadTooltip
76+
return this.isSaved_() ? this.replaceTooltip : this.uploadTooltip
7777
}
7878

7979
override disconnectedCallback() {

0 commit comments

Comments
 (0)