feat: Implement comprehensive i18n support using LanguageContext#92
Open
feat: Implement comprehensive i18n support using LanguageContext#92
Conversation
- Created centralized translation file at src/locales/en.js with 230 strings - Organized translations into 49 namespaces (file-based + common) - Updated 47 files across components, screens, and navigation - All user-facing strings now use t() function from useLanguage hook - Maintained backward compatibility with existing LanguageContext - Updated src/utils/localize.js to import from new en.js file Components updated (25): - AdhocOrderCard, Buttons, CameraCapture, ChatKeyboard, ChatParticipants - Comment, CommentThread, CurrentDestinationSelect, DestinationChangedAlert - FuelReportForm, InstanceLinkHandler, IssueForm, LocationPicker, MoneyInput - MultipleCustomerAvatars, OrderActivitySelect, OrderCard, OrderCustomerCard - OrderDocumentFiles, OrderPayloadEntities, OrderProofOfDelivery, PastOrderCard - PhoneInput, QrCodeScanner, UnitInput Screens updated (20): - ChatHomeScreen, ChatParticipantsScreen, CreateAccountScreen - CreateAccountVerifyScreen, CreateChatChannelScreen, DriverDashboardScreen - DriverFleetScreen, DriverReportScreen, EditAccountPropertyScreen - EditLocationCoordScreen, EditLocationScreen, EntityScreen, FleetScreen - FuelReportScreen, InstanceLinkScreen, IssueScreen, PhoneLoginScreen - PhoneLoginVerifyScreen, TestScreen, VehicleScreen Navigation updated (2): - DriverNavigator, CoreStack Translation structure: - common: Shared strings (save, cancel, delete, edit, etc.) - File-based namespaces: Each component/screen has its own namespace - CamelCase keys: Consistent naming convention throughout - Ready for multi-language support: Easy to add mn.js, es.js, etc. This implementation provides a solid foundation for internationalization and makes it easy to add support for additional languages in the future.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements comprehensive internationalization (i18n) support for the Navigator app using the existing
LanguageContextanduseLanguage()hook system. All user-facing strings have been extracted to a centralized translation file and replaced witht()function calls throughout the codebase.Changes Summary
📊 Statistics
common)🎯 What Was Done
1. Created Translation File
src/locales/en.jscommonnamespace2. Updated All Source Files
Every modified file now:
useLanguagefrom LanguageContextt()function viaconst { t } = useLanguage();t('Namespace.key')callscommonnamespace for frequently used strings (Save, Cancel, Delete, etc.)3. Updated Localization Utility
src/utils/localize.jsto import fromsrc/locales/en.jsinstead oftranslations/en.json📝 Translation Structure
🔍 Example Changes
Before:
After:
📦 Files Modified
Components (25 files)
AdhocOrderCard, Buttons, CameraCapture, ChatKeyboard, ChatParticipants, Comment, CommentThread, CurrentDestinationSelect, DestinationChangedAlert, FuelReportForm, InstanceLinkHandler, IssueForm, LocationPicker, MoneyInput, MultipleCustomerAvatars, OrderActivitySelect, OrderCard, OrderCustomerCard, OrderDocumentFiles, OrderPayloadEntities, OrderProofOfDelivery, PastOrderCard, PhoneInput, QrCodeScanner, UnitInput
Screens (20 files)
ChatHomeScreen, ChatParticipantsScreen, CreateAccountScreen, CreateAccountVerifyScreen, CreateChatChannelScreen, DriverDashboardScreen, DriverFleetScreen, DriverReportScreen, EditAccountPropertyScreen, EditLocationCoordScreen, EditLocationScreen, EntityScreen, FleetScreen, FuelReportScreen, InstanceLinkScreen, IssueScreen, PhoneLoginScreen, PhoneLoginVerifyScreen, TestScreen, VehicleScreen
Navigation (2 files)
DriverNavigator, CoreStack
Utilities (1 file)
localize.js
✅ Benefits
mn.js,es.js)🚀 Next Steps
🔒 What Was NOT Extracted
The following were intentionally left as hardcoded strings:
🧪 Testing Recommendations
This implementation provides a solid foundation for internationalization and makes it easy to add support for additional languages in the future.