Bug 1898576 - adjust retailer name localization for .fr and .de, r=shopping-reviewers,fluent-reviewers,Gijs,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D214158
This commit is contained in:
@@ -84,22 +84,22 @@ class AnalysisExplainer extends MozLitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
// It turns out we must always return a non-empty string: if not, the fluent
|
||||
// resolver will complain that the variable value is missing. We use the
|
||||
// placeholder "retailer", which should never be visible to users.
|
||||
getRetailerDisplayName() {
|
||||
let defaultName = "retailer";
|
||||
if (!this.productUrl) {
|
||||
return defaultName;
|
||||
return null;
|
||||
}
|
||||
let url = new URL(this.productUrl);
|
||||
let hostname = url.hostname;
|
||||
let displayNames = {
|
||||
"www.amazon.com": "Amazon",
|
||||
"www.amazon.de": "Amazon",
|
||||
"www.amazon.fr": "Amazon",
|
||||
// only other regional domain is bestbuy.ca
|
||||
"www.bestbuy.com": "Best Buy",
|
||||
// regional urls redirect to walmart.com
|
||||
"www.walmart.com": "Walmart",
|
||||
};
|
||||
return displayNames[hostname] ?? defaultName;
|
||||
return displayNames[hostname];
|
||||
}
|
||||
|
||||
handleReviewQualityUrlClicked(e) {
|
||||
@@ -108,6 +108,25 @@ class AnalysisExplainer extends MozLitElement {
|
||||
}
|
||||
}
|
||||
|
||||
createReviewsExplainer() {
|
||||
const retailer = this.getRetailerDisplayName();
|
||||
|
||||
if (retailer) {
|
||||
return html`
|
||||
<p
|
||||
data-l10n-id="shopping-analysis-explainer-highlights-description"
|
||||
data-l10n-args="${JSON.stringify({ retailer })}"
|
||||
></p>
|
||||
`;
|
||||
}
|
||||
|
||||
return html`
|
||||
<p
|
||||
data-l10n-id="shopping-analysis-explainer-highlights-description-unknown-retailer"
|
||||
></p>
|
||||
`;
|
||||
}
|
||||
|
||||
// Bug 1857620: rather than manually set the utm parameters on the SUMO link,
|
||||
// we should instead update moz-support-link to allow arbitrary utm parameters.
|
||||
render() {
|
||||
@@ -129,12 +148,7 @@ class AnalysisExplainer extends MozLitElement {
|
||||
<p
|
||||
data-l10n-id="shopping-analysis-explainer-adjusted-rating-description"
|
||||
></p>
|
||||
<p
|
||||
data-l10n-id="shopping-analysis-explainer-highlights-description"
|
||||
data-l10n-args="${JSON.stringify({
|
||||
retailer: this.getRetailerDisplayName(),
|
||||
})}"
|
||||
></p>
|
||||
${this.createReviewsExplainer()}
|
||||
<p
|
||||
data-l10n-id="shopping-analysis-explainer-learn-more2"
|
||||
@click=${this.handleReviewQualityUrlClicked}
|
||||
|
||||
@@ -157,6 +157,10 @@ shopping-analysis-explainer-learn-more2 =
|
||||
shopping-analysis-explainer-highlights-description =
|
||||
<strong>Highlights</strong> are from { $retailer } reviews within the last 80 days that we believe to be reliable.
|
||||
|
||||
# Fallback for analysis highlights explainer if the retailer is ever unknown
|
||||
shopping-analysis-explainer-highlights-description-unknown-retailer =
|
||||
<strong>Highlights</strong> are from reviews within the last 80 days that we believe to be reliable.
|
||||
|
||||
shopping-analysis-explainer-review-grading-scale-reliable = Reliable reviews. We believe the reviews are likely from real customers who left honest, unbiased reviews.
|
||||
shopping-analysis-explainer-review-grading-scale-mixed = We believe there’s a mix of reliable and unreliable reviews.
|
||||
shopping-analysis-explainer-review-grading-scale-unreliable = Unreliable reviews. We believe the reviews are likely fake or from biased reviewers.
|
||||
|
||||
Reference in New Issue
Block a user