Baoyuantop opened a new pull request, #3382:
URL: https://github.com/apache/apisix-dashboard/pull/3382

   ## Problem
   
   When switching languages in the dashboard, selecting Turkish (tr) causes a 
runtime error: `TypeError: Cannot read properties of undefined (reading 
'percent')`.
   
   ## Root Cause
   
   `vite.config.ts` configures the i18nProgress plugin with `langs: ['en', 
'es', 'de', 'zh']`, but `LangMap` in `LanguageMenu.tsx` defines 5 languages 
including `'tr'` (Turkish). When the component accesses `i18nProgress['tr']`, 
it returns `undefined`, causing the crash when reading `.percent`.
   
   ## Changes
   
   1. **Root cause fix**: Add `'tr'` to the `langs` array in `vite.config.ts` 
so the i18nProgress plugin generates progress data for all supported languages.
   2. **Defensive guard**: Add optional chaining (`?.`) in `LanguageMenu.tsx` 
to prevent crashes if a language is missing from the progress data in the 
future.
   
   ## Related Issues
   
   Fixes #3300
   
   Supersedes #3380 (which only addressed the defensive guard without fixing 
the root cause)
   
   ## Checklist
   
   - [x] Did you explain what problem does this PR solve? Or what new features 
have been added?
   - [ ] Have you added corresponding test cases?
   - [ ] Have you modified the corresponding document?
   - [x] Is this PR backward compatible? If it is not backward compatible, 
please discuss on the mailing list first


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to