Text Localization #30
Reference in New Issue
Block a user
Delete Branch "adilallo/feature/TextLocalization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement Page-Specific Localization with Hybrid Content Management
Overview
This PR implements a comprehensive text localization and content management system that extracts all hardcoded UI strings into maintainable JSON files. The implementation follows a hybrid approach combining globalized, shared UI elements with context-aware, localized content pages—a recognized best practice for scalable i18n architectures.
Background: Previously, all UI text was hardcoded directly in components, making it difficult for content creators to update text without modifying code. This PR establishes a foundation for content management that allows non-technical contributors to edit UI text through JSON files.
Key Achievement: All user-facing text is now externalized and editable, with clear separation between page-specific content and reusable component defaults.
Changes
Core Infrastructure
MessagesContextwithMessagesProvideranduseTranslation()hook to replacenext-intl(which had persistent configuration issues)getTranslation()helper for server-side message accessTranslation File Structure
messages/en/pages/):home.json- Home page content (heroBanner, numberedCards, featureGrid, askOrganizer, ruleStack)learn.json- Learn page content (contentLockup, askOrganizer)messages/en/components/):heroBanner.json,askOrganizer.json,numberedCards.json,featureGrid.json,ruleStack.jsonmessages/en/index.tsto export page translations underpagesnamespaceComponent Migrations
app/page.tsx): Updated to usepages.home.*translation keysapp/learn/page.tsx): Migrated hardcoded strings topages.learn.*keysuseTranslation()hook:HeroBanner,NumberedCards,FeatureGrid,AskOrganizer,FooterRuleStack,QuoteBlock,Header,HomeHeader,MenuBar,RuleCardTest Infrastructure
tests/utils/test-utils.tsxwithrenderWithProviders()functioncomponentTestSuiteto use custom render functionMessagesProvider:Documentation
docs/guides/i18n-translation-workflow.mdwith:pages/vscomponents/guidelinesBug Fixes
app/components/Header/index.tsx(removed non-existentnavigationItemsexport)Screenshots
How to Test
npm run dev
adilallo/feature/TextLocalizationto Text Localization