Skip to content

Commit

Permalink
Merge pull request #82 from NextCafeteria/fix/search-on-translated-text
Browse files Browse the repository at this point in the history
Search on translated texts
  • Loading branch information
vietanhdev committed Sep 6, 2023
2 parents 7ad1bb5 + 5c813a5 commit 88e4983
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/[lng]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export default function Home({ params: { lng } }) {
return;
}

products.forEach((product) => {
product.translated_name = t(product.name);
product.translated_description = t(product.description);
});

const fuse = new Fuse(products, {
keys: ["name", "description"],
keys: ["translated_name", "translated_description"],
});

const results = fuse.search(value);
Expand Down

0 comments on commit 88e4983

Please sign in to comment.