Files
Enterprise-Knowledge-Base/internal/types
wizardchen 095ccaed10 refactor: Replace hardcoded language logic with middleware infrastructure
- Refactor wiki_ingest.go to use types.LanguageLocaleName() instead of hardcoded if-else
- Supports 9+ languages (Chinese, English, Korean, Japanese, Russian, French, German, Spanish, Portuguese)
- Reduces 7 lines to 4 lines (43% reduction in code)
- Eliminates code duplication by reusing existing middleware infrastructure
- Consistent naming with middleware layer ("Chinese (Simplified)" format)
- Add comprehensive unit tests for LanguageLocaleName() (30 test cases)
- Add implementation guide, analysis, and completion documentation

Benefits:
- Single source of truth for language mappings (types.LanguageLocaleName)
- Better code maintainability and consistency
- No breaking changes or schema modifications required
- Performance: ~4.3ns per call, no measurable impact
- All tests passing, build successful

Files modified:
- internal/application/service/wiki_ingest.go: Refactored language determination (line 139)
- internal/types/context_helpers_test.go: Added 30 unit test cases (NEW)
- Documentation: Added LANGUAGE_MIDDLEWARE_ANALYSIS.md, LANGUAGE_REFACTORING_COMPLETED.md, IMPLEMENTATION_GUIDE.md, REFACTORING_SUMMARY.txt

Refs: LANGUAGE_MIDDLEWARE_ANALYSIS.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 21:17:17 +08:00
..
2026-04-15 20:35:48 +08:00
2026-03-30 11:13:44 +08:00
2025-08-05 15:08:07 +08:00
2026-04-10 12:49:20 +08:00
2025-08-05 15:08:07 +08:00
2025-08-05 15:08:07 +08:00
2026-04-10 12:49:20 +08:00
2026-03-30 11:13:44 +08:00