Skip to content

Commit

Permalink
Fix translation and fallback issues (#5775)
Browse files Browse the repository at this point in the history
  • Loading branch information
gilluminate authored Feb 20, 2025
1 parent 5296658 commit 6568433
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 1 addition & 5 deletions clients/fides-js/src/components/tcf/RecordsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ const RecordsList = <T extends RecordListItem>({
{items.map((item) => (
<DataUseToggle
key={item.id}
title={
item.bestTranslation
? item.bestTranslation.title || ""
: getNameForItem(item)
}
title={item.bestTranslation?.title || getNameForItem(item)}
noticeKey={`${item.id}`}
onToggle={() => {
handleToggle(item);
Expand Down
5 changes: 4 additions & 1 deletion clients/fides-js/src/components/tcf/TcfOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ export const TcfOverlay = ({
}, [experienceMinimal, experience, i18n]);

const customPurposes: (string | undefined)[] = useMemo(() => {
return privacyNoticesWithBestTranslation.map((notice) => notice.name);
const notices = privacyNoticesWithBestTranslation.map(
(notice) => notice.bestTranslation?.title || notice.name,
);
return notices;
}, [privacyNoticesWithBestTranslation]);

const purposes: string[] = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ describe("Fides-js TCF", () => {

it("can render purposes in the initial layer", () => {
cy.get("div#fides-banner").within(() => {
cy.contains("Advertising English");
cy.contains(PURPOSE_2.name);
cy.contains(PURPOSE_6.name);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"privacy_notices": [
{
"name": "Advertising",
"name": "Advertising Name",
"notice_key": "advertising",
"internal_description": null,
"origin": null,
Expand All @@ -18,7 +18,7 @@
"translations": [
{
"language": "en",
"title": "Advertising",
"title": "Advertising English",
"description": "This website uses marketing cookies and services to deliver personalized advertisements, promotions, and offers that are relevant to you. They help optimize ad delivery, measure campaign effectiveness, and enable advertisers to reach specific target audiences.",
"privacy_notice_history_id": "pri_notice-history-advertising-en-000"
},
Expand Down

0 comments on commit 6568433

Please sign in to comment.