Skip to content

chore(i18n): achieve 100% English translation coverage and fix localization issues

Ahlad Pataparla requested to merge chore/update-translations into develop

Overview

This MR achieves 100% translation coverage for the English locale by consolidating duplicate and unused translation keys, while also fixing spacing issues in the UI and updating tests to match the new translation structure.

What does this MR do and why?

  • Achieve 100% English translation count - Removed duplicate and hardcoded strings that were causing incomplete translation coverage
  • Fix spacing issues - Corrected layout issues in the login page footer and dashboard
  • Improve i18n consistency - Consolidated redundant translation keys across English, Hindi, and Telugu locales
  • Update tests - Fixed test assertions to follow new translation keys

Changes Made

Translation Files

  • src/locales/en/translations.json - Removed ~30+ duplicate/redundant translation keys that existed at both nested and root levels
  • src/locales/hi/translations.json - Minor cleanup
  • src/locales/te/translations.json - Minor cleanup

UI Fixes

  • src/pages/LoginPage.tsx - Fixed spacing issue in footer by restructuring how the new user prompt is rendered
  • src/pages/DashboardPage.tsx - Updated to use correct translation key (patient.vitalsQueue instead of patient.vitalsQueueLabel)

Test Updates

Updated 20+ test files to reflect the consolidated translation structure:

  • tests/admin/ManageDoctorsPage.test.tsx
  • tests/admin/ManageMedicinesPage.test.tsx
  • tests/pages/DashboardPage.test.tsx
  • tests/pages/DonationPage.test.tsx
  • tests/pages/JoinVolunteerPage.test.tsx
  • tests/unit/components/AssignDoctorPage.test.tsx
  • tests/unit/components/CorpusUploadForm.test.tsx
  • tests/unit/components/PatientRegistrationPage.test.tsx
  • tests/unit/components/PreviousCampPrescriptionsCard.test.tsx
  • tests/unit/components/QueueManagementPage.test.tsx
  • tests/unit/components/StaffAttendancePage.test.tsx
  • tests/unit/components/profile/VitalsHistory.test.tsx
  • tests/unit/pages/coordinator/QueueManagementPage.test.tsx
  • tests/unit/pages/volunteer/UpdatePrescriptionPage.test.tsx
  • tests/useQueueSocket.test.ts
  • tests/volunteers/QRGenerationPage.test.tsx
  • tests/volunteers/RecordVitalsPage.test.tsx
  • tests/volunteers/UpdatePrescriptionPage.test.tsx
  • tests/volunteers/VerifyMedicinesPage.test.tsx
  • tests/pages/AttendanceMarker.test.tsx

Technical Details

Root Cause

The English translation file had duplicate keys existing at multiple levels:

  • Keys like bookNumberNotFound, activeConsultationsCount, noComplaint existed both nested (e.g., patient.registration.bookNumberNotFound) AND at the parent level (e.g., patient.assignDoctor.bookNumberNotFound)
  • This caused i18n linting checks to fail and created maintenance overhead
  • Some UI components were using incorrect or outdated translation keys

Approach

  1. Identified duplicates - Found all translation keys that existed at multiple nesting levels
  2. Consolidated to nested structure - Kept keys in their proper nested namespaces and removed root-level duplicates
  3. Updated component references - Ensured all components use the correct nested keys
  4. Fixed UI issues - Corrected spacing problems while updating translation usage
  5. Updated tests - Modified all affected tests to use the consolidated translation paths

Trade-offs

  • Some translation keys were removed entirely if they were truly unused (e.g., searchError, checkError, bookNumberInvalid)
  • Tests had to be updated to match the new structure, but this improves test accuracy

Type of Change

  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • ️ Refactor (no functional changes)
  • 🧪 Test update

How to Set Up and Validate Locally

  1. Pull this branch:

    git pull origin chore/update-translations
  2. Install dependencies (if any changed):

    bun install
  3. Run development server:

    bun dev
  4. Validate changes:

    • Visit http://localhost:5173/login - Check footer spacing looks correct
    • Visit http://localhost:5173/dashboard - Verify vitals queue label displays properly
    • Switch between languages (EN/HI/TE) - Ensure all translations work
    • Run i18n check to verify 100% coverage:
      # Run your i18n linting/check command
  5. Run tests:

    bun run test

Testing Done

  • Manual testing completed
  • Test suite updated and passing

Test Cases Covered:

Scenario Expected Result Status
English translations load All UI text displays correctly in English
Login page footer spacing No spacing/layout issues in footer links
Dashboard vitals queue label Displays "Vitals Queue" correctly
All test suites pass No broken test assertions
Language switching works EN/HI/TE all load without errors

Code Quality Checklist

Code Standards

  • Code follows project conventions (naming, structure, formatting)
  • No console.log() or debugger statements left in code
  • No unused imports, variables, or functions
  • No duplicate code and use of existing components for reusability
  • i18n check passed with no hardcoded strings in codebase for i18n support
  • TypeScript types are properly defined (no any unless justified)
  • ESLint and Prettier checks pass
    bun run lint

Known Limitations / Technical Debt

None. This change is purely organizational and cleanup.

Edited by Ahlad Pataparla

Merge request reports

Loading