Fix i18n locale-aware formatting and add test suite#8
Open
nickearnshaw wants to merge 5 commits intojack21:mainfrom
Open
Fix i18n locale-aware formatting and add test suite#8nickearnshaw wants to merge 5 commits intojack21:mainfrom
nickearnshaw wants to merge 5 commits intojack21:mainfrom
Conversation
- Replace hardcoded Chinese date format (YYYY年MM月) with locale-aware formatting - Add getLocaleString() helper to map i18n language codes to proper locale strings - Pass translation strings to client-side JavaScript for dynamic content - Add new translation keys: time, loading, showHourlyDetails, showDailyDetails, clickForHourlyDetails, clickForDailyDetails - Replace all hardcoded Chinese strings in webview templates and JavaScript - Fix toLocaleDateString() calls to use current locale instead of system default Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add missing translation keys: noChartData, noUsageRecords, unknownError - Fix incomplete German translations (error, currentSession) - Fix formatNumber() to respect user's language setting - Replace hardcoded English strings in extension.ts and webview.ts - Consolidate getLocaleString() into I18n class to avoid duplication Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add clickForDetails translation key for status bar tooltip - Fix all JavaScript toLocaleString() calls to use currentLocale - Fix toLocaleDateString() in chart tooltip to use currentLocale - Ensure number formatting in dynamic tables respects user's language Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add mocha, ts-node, and @types/mocha for testing - Create i18n.test.ts with 34 tests covering: - Translation completeness across all languages - Translation quality (no empty/null values) - Locale mapping validation - formatNumber and formatCurrency functions - Language detection from environment - Source code validation for locale-aware formatting - Add getSupportedLanguages() to I18n class - Add GitHub Actions workflow to run tests on push/PR Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
toLocaleString(),toLocaleDateString()calls use explicit locale parametergetSupportedLanguages()method to I18n classformatNumberandformatCurrencyfunctionsTest plan
npm test🤖 Generated with Claude Code