[UXIT-3897] Add i18n to provide-storage, build-on-filecoin, community-hub, and blog#2182
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive internationalization (i18n) support to four key pages: provide-storage, build-on-filecoin, community-hub, and blog. The implementation follows next-intl patterns, converting static data files to factory functions that accept translation functions and return localized content.
Changes:
- Added i18n to provide-storage, build-on-filecoin, community-hub, and blog pages using next-intl
- Refactored data files from static exports to functions accepting
TranslationFunctionparameter - Enhanced SearchInput component with customizable placeholder prop for i18n
- Widened
CategoriesandBlogCardprop types to accept translated string arrays - Removed unused
filecoinTools.tsdata file
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui-filecoin/src/components/SearchInput.tsx | Added optional placeholder prop for i18n support |
| packages/ui-filecoin/src/components/Search/Search.tsx | Added placeholder prop passthrough to SearchInput |
| apps/filecoin-site/src/i18n/translations/en.json | Added English translations for all four pages |
| apps/filecoin-site/src/i18n/translations/zh-cn.json | Added Chinese translations for all four pages |
| apps/filecoin-site/src/app/[locale]/provide-storage/page.tsx | Integrated translations using getTranslations |
| apps/filecoin-site/src/app/[locale]/provide-storage/data/gettingStartedWithPDP.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/provide-storage/data/scalingOperations.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/community-hub/page.tsx | Integrated translations using getTranslations |
| apps/filecoin-site/src/app/[locale]/community-hub/data/ecosystemGroups.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/community-hub/data/getInvolvedWithCommunity.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/community-hub/data/getInvolvedOptions.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/community-hub/data/networkUpgrades.ts | Converted to factory function with label/labelKey pattern for badge variants |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/page.tsx | Integrated translations using getTranslations |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/components/HeroSection.tsx | Added translation function prop |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/data/builtOnFilecoin.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/data/codeNcorgiSeries.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/data/developerResources.ts | Converted to factory function accepting translation function |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/data/filecoinFeatures.ts | Converted to factory function, removed unused description fields |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/data/filecoinTools.ts | Removed unused file |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/data/tutorialsAndGuides.ts | Converted to factory function with difficultyLabel field |
| apps/filecoin-site/src/app/[locale]/build-on-filecoin/utils/generateStructuredData.ts | Updated to accept features parameter instead of importing directly |
| apps/filecoin-site/src/app/[locale]/blog/page.tsx | Integrated translations for featured post badge and CTA |
| apps/filecoin-site/src/app/[locale]/blog/data/blogCategories.ts | Removed name field, kept only id for translation lookup |
| apps/filecoin-site/src/app/[locale]/blog/components/CategoryFilter.tsx | Added useTranslations for category names and aria labels |
| apps/filecoin-site/src/app/[locale]/blog/components/CategoryListbox.tsx | Added useTranslations for category display names |
| apps/filecoin-site/src/app/[locale]/blog/components/Categories.tsx | Widened type to accept string arrays |
| apps/filecoin-site/src/app/[locale]/blog/components/BlogCard.tsx | Changed tags prop type to Array |
| apps/filecoin-site/src/app/[locale]/blog/components/BlogPageHeader.tsx | Added badgeText and ctaText props |
| apps/filecoin-site/src/app/[locale]/blog/components/BlogPostList.tsx | Added translation for search placeholder and category tags |
| apps/filecoin-site/src/app/[locale]/blog/[slug]/page.tsx | Added translation mapping for categories |
| apps/filecoin-site/src/app/[locale]/blog/[slug]/components/BlogPostHeader.tsx | Changed categories prop type to Array |
Comments suppressed due to low confidence (1)
apps/filecoin-site/src/i18n/translations/en.json:511
- Spelling error: "Pawsibilitiess" should be "Pawsibilities" (only one 's' at the end).
"title": "Code n' Corgi: Discovering AI Pawsibilitiess",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Massive effort @CharlyMartin !!
Left a few comments...
A few other things:
- I guess we should also run changelog since there are changes
Searchinui-filecoin? - I think we should run
npm run lint? Import order doesn't seem right...
- Also I was wondering if we need to translate the Pagination (Prev, Next) - not sure if it's too much of a trouble...
| const { image, categories, author, publishedOn, title, content } = data | ||
|
|
||
| const t = await getTranslations(PATHS.BLOG.path) | ||
| const translatedCategories = categories.map((cat) => t(`categories.${cat}`)) |
There was a problem hiding this comment.
What do you think we put category instead of cat?
| type HeroSectionProps = { | ||
| t: TranslationFunction | ||
| } |
There was a problem hiding this comment.
Wondering why you decided to pass t as a prop and not use getTranslations here directly? Is it to have the translation centralised in /build-on-filecoin/page.tsx?
There was a problem hiding this comment.
Yes that was the idea, but I think you're right, it's best to call it directly in the component!
| { | ||
| title: t('developerResources.testFILFaucet.title'), | ||
| description: t('developerResources.testFILFaucet.description'), | ||
| href: 'https://faucet.calibnet.chainsafe-fil.io/', |
There was a problem hiding this comment.
Not sure if it's related to this PR, but should this link be in FILECOIN_DOCS_URLS?
| }, | ||
| { | ||
| title: t('filecoinFeatures.crossChainBridges.title'), | ||
| icon: IntersectThreeIcon, |
There was a problem hiding this comment.
I don't think we need the icon? 👀
In apps/filecoin-site/src/app/[locale]/build-on-filecoin/utils/generateStructuredData.ts
about: features.map((feature) => ({
'@type': 'Thing',
name: feature.title,
})),| }, | ||
| image: { | ||
| src: nv27GoldenWeekImage, | ||
| alt: 'Filecoin Network Upgrade announcement for nv27 Golden Week, with gold-texture background artwork.', |
There was a problem hiding this comment.
Should alt be translated as well?
| import { useCategoryState } from '../hooks/useCategoryState' | ||
|
|
||
| export function CategoryFilter() { | ||
| const t = useTranslations('/blog') |
There was a problem hiding this comment.
Should we use const t = useTranslations(PATHS.BLOG.path)?
- Update useTranslations to use PATHS.BLOG.path consistently in CategoryFilter, CategoryListbox, and blog post page for better maintainability. - Rename variable from 'cat' to 'category' in blog post mapping for clarity. - Fix className syntax in CategoryFilter buttons by correcting Tailwind variable references. - Remove unused icon imports and assignments from filecoinFeatures to simplify data structure. - Internationalize alt text for nv27 network upgrade image using translation function for better accessibility support.
573ebbf to
bdd98b4
Compare
|
@barbaraperic Thank you for all the great comments. I've addressed/implemented most of them.
We should, but in a different PR. About 25 files need linting due to the ESLINT issue from last week. I can open a PR just for that tomorrow.
Yes, we should! But it was too complex for this PR. I'm gonna open another one just for this. I forgot to mention it in the description. |
📝 Description
Add internationalization support to four pages: provide-storage, build-on-filecoin, community-hub, and blog. All static strings are now translation-key driven via
next-intl.🛠️ Key Changes
en.json/zh-cn.json, usegetTranslationsin server paget()and return translated contentuseTranslations/getTranslationsfilecoinTools.tsdata fileCategoriesandBlogCardprop types toArray<string>to accept translated strings