Skip to content

Add multi-language (i18n) support and fix UTF-8 base64 decoding bug in claude-trace#14

Open
yician0629 wants to merge 9 commits intobadlogic:mainfrom
yician0629:main
Open

Add multi-language (i18n) support and fix UTF-8 base64 decoding bug in claude-trace#14
yician0629 wants to merge 9 commits intobadlogic:mainfrom
yician0629:main

Conversation

@yician0629
Copy link

@yician0629 yician0629 commented Jun 24, 2025

This pull request includes the following major updates:

1. Internationalization (i18n) Support

  • Adds a type-safe i18n system for CLI and frontend messages
  • Provides full translations for English, Spanish, Japanese, Traditional Chinese, and Simplified Chinese
  • Enables language selection via environment variable or system locale, with graceful fallback
  • Refactors all CLI help, error, and output messages to use i18n
  • Includes translation validation scripts, documentation, and comprehensive tests

2. Bug Fix: UTF-8 Base64 Decoding in Frontend

  • Fixes a bug where base64-decoded data in the frontend was not properly handled as UTF-8, which could cause issues with non-ASCII characters
  • Replaces plain atob decoding with a safe TextDecoder-based approach to ensure correct character handling

3. Additional Improvements

  • Refactors CLI and HTML generator for maintainability and consistency
  • Updates build/dev scripts to ensure translation files are always included and validated
  • Cleans up and improves test coverage, especially for i18n features

These changes improve internationalization, code quality, and robustness for all users.

#7

Copilot AI and others added 9 commits June 24, 2025 00:08
Co-authored-by: yician0629 <212482781+yician0629@users.noreply.github.com>
Co-authored-by: yician0629 <212482781+yician0629@users.noreply.github.com>
Co-authored-by: yician0629 <212482781+yician0629@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Added full CLI and error translations for Traditional Chinese (zh-TW) and Simplified Chinese (zh-CN)
- Updated i18n system to detect and support zh-TW and zh-CN via environment variable or system locale
- Updated documentation and usage examples to include both Chinese variants
- Extended test suite to verify correct switching and translation for zh-TW and zh-CN
- Ensured 100% translation coverage and type safety for all supported languages
  The atob() function returns a binary string that wasn't being properly
  decoded as UTF-8, causing non-ASCII characters (Chinese, Japanese, etc.)
  to display incorrectly. Added a base64ToUtf8 function that uses
  TextDecoder to properly handle UTF-8 encoded text.
Implement multilingual support (i18n) for claude-trace CLI with quality validation.
The UTF-8 character encoding fix for the HTML log viewer.
@anarcher
Copy link

https://github.com/badlogic/lemmy/pull/14/files#diff-05faa64e52503759aba293ff4302b07745688d5ab49055d043d991a8c5083267R12-R22

For now, I think it would be enough to just add this part. :-)

@badlogic
Copy link
Owner

lgtm, could you resolve the conflicts? happy to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants