feat: Implement comprehensive i18n support using LanguageContext #92
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.