Skip to content

Add KickTalk Internationalization (i18n) Implementation#45

Open
PabloB07 wants to merge 8 commits intoKickTalkOrg:mainfrom
PabloB07:main
Open

Add KickTalk Internationalization (i18n) Implementation#45
PabloB07 wants to merge 8 commits intoKickTalkOrg:mainfrom
PabloB07:main

Conversation

@PabloB07
Copy link

@PabloB07 PabloB07 commented Aug 4, 2025

KickTalk Internationalization implementation

Overview

This pull request implements a comprehensive internationalization system for KickTalk, enabling multi-language support with Spanish, English, and Portuguese translations.

🌍 Features Implemented

Core i18n System

  • react-i18next integration: Complete setup with namespace support and dynamic language switching
  • Multi-language support: Spanish (es), English (en), and Portuguese (pt) translations
  • Dual persistence: localStorage + electron-store for cross-session language retention
  • Cross-window synchronization: Language changes sync across all application windows
  • Fallback system: Automatic fallback to English for missing translations

Component Translation Coverage (17+ Components)

  • Navbar: Complete navigation translation with tabs, dialogs, and status messages
  • Chat Components: All chat-related UI elements and messages
  • Settings Dialog: Language selector with theme integration
  • Authentication: Login/logout flows and user management
  • Cosmetics: Badges, emotes, and visual customization elements
  • Dialogs: Modal windows and popup interfaces
  • Messages: Chat messages, replies, and threading
  • Error Handling: User-friendly error messages in all languages
  • Status Indicators: Connection states and loading messages
  • User Interface: Buttons, labels, and interactive elements
  • Notifications: System and chat notifications
  • Moderation: Timeout, ban, and moderation tools
  • Search: Chat search functionality
  • File Operations: Upload and download interfaces
  • Tooltips: Contextual help and information
  • Forms: Input validation and submission messages
  • Accessibility: Screen reader and accessibility features

Theme Integration

  • CSS Variables Integration: Language selector adapts to all 6 application themes
  • Theme Compatibility: Works seamlessly with Green (default), Dark, Blue, Purple, Red, and Light themes
  • Visual Consistency: Maintains design language across all theme variations
  • Responsive Design: Proper styling for different screen sizes and resolutions

📁 Files Added/Modified

Core i18n Files

  • src/renderer/src/utils/i18n.js - Core internationalization configuration
  • src/renderer/src/utils/useLanguage.js - Language management hook
  • src/renderer/src/utils/languageSync.js - Cross-window synchronization utility

Translation Files

  • src/renderer/src/locales/en.json - English translations (250+ keys)
  • src/renderer/src/locales/es.json - Spanish translations (250+ keys)
  • src/renderer/src/locales/pt.json - Portuguese translations (250+ keys)

Components Enhanced

  • src/renderer/src/components/Navbar.jsx - Added complete navigation translations
  • src/renderer/src/components/LanguageSelector.jsx - Language switching component
  • src/renderer/src/dialogs/Settings.jsx - Settings dialog with language section
  • Multiple chat, dialog, and UI components with useTranslation hooks

Styling Updates

  • src/renderer/src/components/LanguageSelector.scss - Theme-adaptive language selector styling
  • src/renderer/src/dialogs/Settings.scss - Enhanced settings dialog styling with proper theme integration

Documentation

  • I18N_IMPLEMENTATION_GUIDE.md - Spanish implementation guide
  • I18N_IMPLEMENTATION_GUIDE_EN.md - English implementation guide

🔧 Technical Implementation

Architecture

  • Namespace Organization: Translations organized by component/feature areas
  • Lazy Loading: Efficient loading of translation resources
  • Memory Management: Optimized for desktop application performance
  • Error Boundaries: Graceful handling of translation failures

Performance Features

  • Efficient Updates: Only re-renders components when language changes
  • Caching Strategy: Translation files cached for optimal performance
  • Bundle Optimization: Minimal impact on application bundle size
  • Resource Management: Smart loading and unloading of language resources

Persistence System

// Dual persistence ensures language settings survive app restarts
const language = localStorage.getItem('language') || 
                 window.app?.store?.get('language') || 
                 'en';

Cross-Window Synchronization

// Language changes propagate across all application windows
i18n.on('languageChanged', (lng) => {
    localStorage.setItem('language', lng);
    window.app?.store?.set('language', lng);
});

🎨 UI/UX Improvements

Visual Integration

  • Language selector matches application theme colors
  • Consistent styling across all components
  • Smooth transitions between languages
  • Accessibility-compliant design

User Experience

  • Instant language switching without restart
  • Persistent language preferences
  • Intuitive language selection interface
  • Complete localization of user-facing text

📊 Translation Statistics

  • Total Translation Keys: 250+
  • Languages Supported: 3 (Spanish, English, Portuguese)
  • Components Translated: 17+
  • Quality: Native speaker reviewed for Spanish and Portuguese

🧪 Testing Completed

Functionality Testing

  • ✅ Language switching across all components
  • ✅ Persistence across application restarts
  • ✅ Cross-window synchronization
  • ✅ Theme compatibility verification
  • ✅ Error handling for missing translations

Browser/Electron Testing

  • ✅ Main window language switching
  • ✅ Dialog window translations
  • ✅ Settings persistence in electron-store
  • ✅ IPC communication for language sync

- Added LanguageSelector component for selecting application language.
- Integrated i18next for internationalization with English, Spanish, and Portuguese translations.
- Created corresponding SCSS styles for the LanguageSelector component.
- Updated locale files for English, Spanish, and Portuguese with necessary translations.
- Implemented useLanguage utility for managing language state and persistence in localStorage.
…omponents

- Added i18n support to Navbar, LanguageSelector, Updater, and other components for multilingual support.
- Integrated language persistence using localStorage and updated settings provider to handle language changes.
- Created a language synchronization utility to ensure consistent language across multiple windows.
- Updated localization files (en, es, pt) with new translations for navbar, settings, and other UI elements.
- Enhanced user experience by providing language change feedback and ensuring accessibility.
@ftk789
Copy link
Contributor

ftk789 commented Oct 14, 2025

Wanna resolve conflicts and then I'll merge after you do so?

BP602 and others added 5 commits October 14, 2025 12:14
* Fix cross-platform icon compatibility

- Add cross-platform icon handling for Linux/macOS support
- Convert Windows .ico to .png for non-Windows platforms
- Update tray and thumbar icons to use platform-appropriate format

Fixes application crashes on Linux due to unsupported .ico format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add configurable auto-update settings

- Add auto-update toggle in General settings (enabled by default)
- Check settings before performing automatic update checks on startup
- Skip auto-updater when disabled in settings
- Add IPC handler for runtime setting changes
- Maintain existing manual update functionality

Users can now disable automatic update checking while keeping the ability to manually check for updates through the UI.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Improve auto-update settings: dismiss notifications when disabled

- Add immediate dismissal of update notifications when auto-update is disabled in settings
- No longer need to restart app to hide existing update notifications
- Add onDismiss method to update API in preload script
- Listen for autoUpdate setting changes in main process
- Update Updater component to handle dismiss events

Now when users disable auto-update in settings, any active update notifications disappear immediately instead of persisting until restart.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Implement optimistic message sending

- Add immediate visual feedback when users send messages
- Messages appear grey/dim while waiting for server confirmation
- Messages turn full color when confirmed by server
- Failed messages show red tint with warning indicator
- Prevent duplicate messages when confirmation arrives
- Add message state management (optimistic/confirmed/failed)

Users now see their messages immediately instead of waiting for server response, making chat feel much more responsive while maintaining accuracy.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix optimistic message styling to affect entire message content

- Apply opacity to entire message container instead of individual elements
- Use global opacity so all content (text, emotes, links) appears dimmed
- Simplify failed message styling with red filter effect
- Ensure complete visual feedback for optimistic/failed states

Now the entire message content appears grey when optimistic, not just the username.

* Fix optimistic message styling by applying classes at correct level

- Move optimistic/failed classes from chatMessageContainer to chatMessageItem
- chatMessageItem is the actual wrapper that controls message visual styling
- Now entire message content (text, emotes, etc.) will appear grey when optimistic
- Remove redundant classes from RegularMessage component

This fixes the issue where only the username was being styled instead of the complete message content.

* Improve optimistic messaging: adjust opacity and add reply support

- Reduce optimistic opacity from 0.6 to 0.75 for better readability
- Add optimistic messaging support for reply messages
- Create createOptimisticReply helper function
- Update sendReply to use optimistic messaging pattern
- Enhance confirmation logic to handle both messages and replies
- Reply messages now appear grey when optimistic, full color when confirmed

Both regular messages and replies now have consistent optimistic behavior with improved visual feedback.

* Enhance optimistic messaging with comprehensive improvements

## Major Enhancements

### 🚀 Performance Optimizations
- **Pre-cache user info** on chatroom connection for instant message display
- **Eliminate 1-second delay** before optimistic messages appear
- **Smart user color preservation** from existing messages

### 🎨 Visual & UX Improvements
- **Replace opacity dimming** with subtle border and background indicators
- **Add pulsing animation** for pending messages
- **Theme-compatible username colors** using CSS variables
- **Enhanced failed message styling** with clear retry indicators

### 🔧 Reliability Features
- **30-second timeout handling** for orphaned optimistic messages
- **Click-to-retry functionality** for failed messages with visual feedback
- **Smart message ordering** by timestamp for edge cases
- **Comprehensive error recovery** with proper state management

### 🐛 Bug Fixes
- **Fix black username issue** by preserving identity colors and proper fallbacks
- **Fix visual styling scope** to avoid CSS inheritance conflicts
- **Improve failed message visibility** with red tinting instead of black overlay

## Technical Details

- Enhanced `createOptimisticMessage()` and `createOptimisticReply()` with color preservation
- Added `retryFailedMessage()`, `cacheCurrentUser()`, and timeout management
- Improved CSS with loading animations and theme-compatible variables
- Added proper click handlers and visual feedback for failed messages

Users now experience instant, reliable messaging with clear visual feedback and robust error recovery.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Final optimistic messaging improvements

- Use proper Phosphor arrow-clockwise-fill icon for retry actions
- Add copy button alongside retry for failed messages
- Remove redundant "An error occurred" system messages
- Remove hover transform that caused horizontal scrollbars
- Add proper console error logging for debugging

Failed messages now show retry + copy buttons with clear visual feedback.
Users can choose to auto-retry or copy content for manual handling.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add missing arrow-clockwise-fill icon and cleanup

- Add Phosphor arrow-clockwise-fill.svg icon file for retry functionality
- Remove unused retry handler from Message component
- Clean up message container click handlers

Icon was referenced in code but not committed to repository.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix TitleBar auth integration with optimistic messaging

- Use cached currentUser from chat store instead of local state
- Ensure TitleBar auth state stays in sync with optimistic messaging
- Auto-cache user info if not already cached
- Consistent authentication state across the app

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ftk789 <57598907+ftk789@users.noreply.github.com>
* Fix cross-platform icon compatibility

- Add cross-platform icon handling for Linux/macOS support
- Convert Windows .ico to .png for non-Windows platforms
- Update tray and thumbar icons to use platform-appropriate format

Fixes application crashes on Linux due to unsupported .ico format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add configurable auto-update settings

- Add auto-update toggle in General settings (enabled by default)
- Check settings before performing automatic update checks on startup
- Skip auto-updater when disabled in settings
- Add IPC handler for runtime setting changes
- Maintain existing manual update functionality

Users can now disable automatic update checking while keeping the ability to manually check for updates through the UI.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Improve auto-update settings: dismiss notifications when disabled

- Add immediate dismissal of update notifications when auto-update is disabled in settings
- No longer need to restart app to hide existing update notifications
- Add onDismiss method to update API in preload script
- Listen for autoUpdate setting changes in main process
- Update Updater component to handle dismiss events

Now when users disable auto-update in settings, any active update notifications disappear immediately instead of persisting until restart.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Implement optimistic message sending

- Add immediate visual feedback when users send messages
- Messages appear grey/dim while waiting for server confirmation
- Messages turn full color when confirmed by server
- Failed messages show red tint with warning indicator
- Prevent duplicate messages when confirmation arrives
- Add message state management (optimistic/confirmed/failed)

Users now see their messages immediately instead of waiting for server response, making chat feel much more responsive while maintaining accuracy.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix optimistic message styling to affect entire message content

- Apply opacity to entire message container instead of individual elements
- Use global opacity so all content (text, emotes, links) appears dimmed
- Simplify failed message styling with red filter effect
- Ensure complete visual feedback for optimistic/failed states

Now the entire message content appears grey when optimistic, not just the username.

* Fix optimistic message styling by applying classes at correct level

- Move optimistic/failed classes from chatMessageContainer to chatMessageItem
- chatMessageItem is the actual wrapper that controls message visual styling
- Now entire message content (text, emotes, etc.) will appear grey when optimistic
- Remove redundant classes from RegularMessage component

This fixes the issue where only the username was being styled instead of the complete message content.

* Improve optimistic messaging: adjust opacity and add reply support

- Reduce optimistic opacity from 0.6 to 0.75 for better readability
- Add optimistic messaging support for reply messages
- Create createOptimisticReply helper function
- Update sendReply to use optimistic messaging pattern
- Enhance confirmation logic to handle both messages and replies
- Reply messages now appear grey when optimistic, full color when confirmed

Both regular messages and replies now have consistent optimistic behavior with improved visual feedback.

* Enhance optimistic messaging with comprehensive improvements

## Major Enhancements

### 🚀 Performance Optimizations
- **Pre-cache user info** on chatroom connection for instant message display
- **Eliminate 1-second delay** before optimistic messages appear
- **Smart user color preservation** from existing messages

### 🎨 Visual & UX Improvements
- **Replace opacity dimming** with subtle border and background indicators
- **Add pulsing animation** for pending messages
- **Theme-compatible username colors** using CSS variables
- **Enhanced failed message styling** with clear retry indicators

### 🔧 Reliability Features
- **30-second timeout handling** for orphaned optimistic messages
- **Click-to-retry functionality** for failed messages with visual feedback
- **Smart message ordering** by timestamp for edge cases
- **Comprehensive error recovery** with proper state management

### 🐛 Bug Fixes
- **Fix black username issue** by preserving identity colors and proper fallbacks
- **Fix visual styling scope** to avoid CSS inheritance conflicts
- **Improve failed message visibility** with red tinting instead of black overlay

## Technical Details

- Enhanced `createOptimisticMessage()` and `createOptimisticReply()` with color preservation
- Added `retryFailedMessage()`, `cacheCurrentUser()`, and timeout management
- Improved CSS with loading animations and theme-compatible variables
- Added proper click handlers and visual feedback for failed messages

Users now experience instant, reliable messaging with clear visual feedback and robust error recovery.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Final optimistic messaging improvements

- Use proper Phosphor arrow-clockwise-fill icon for retry actions
- Add copy button alongside retry for failed messages
- Remove redundant "An error occurred" system messages
- Remove hover transform that caused horizontal scrollbars
- Add proper console error logging for debugging

Failed messages now show retry + copy buttons with clear visual feedback.
Users can choose to auto-retry or copy content for manual handling.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add missing arrow-clockwise-fill icon and cleanup

- Add Phosphor arrow-clockwise-fill.svg icon file for retry functionality
- Remove unused retry handler from Message component
- Clean up message container click handlers

Icon was referenced in code but not committed to repository.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add compact chatroom list feature

- Add toggle in General settings for compact chatroom layout
- Implement compact mode with icon-only tabs (40px width)
- Add notification bell icon for mentions tab in compact mode
- Update navbar styling with :has() selector for clean implementation
- Increase chatroom limit from 5 to 25

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ftk789 <57598907+ftk789@users.noreply.github.com>
* Fix cross-platform icon compatibility

- Add cross-platform icon handling for Linux/macOS support
- Convert Windows .ico to .png for non-Windows platforms
- Update tray and thumbar icons to use platform-appropriate format

Fixes application crashes on Linux due to unsupported .ico format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Implement draft message persistence between chatroom switches

- Add draft storage to ChatProvider state using Map for per-chatroom drafts
- Create DraftManager component to handle automatic saving and restoration
- Save draft content on editor changes using Lexical update listeners
- Restore draft content when switching back to chatrooms
- Clear drafts when messages are sent successfully
- Fix Lexical node structure by properly using paragraph nodes

Fixes KickTalkOrg#23

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ftk789 <57598907+ftk789@users.noreply.github.com>
…urate metrics (KickTalkOrg#44)

* feat(telemetry): Integrate OpenTelemetry for comprehensive observability

This commit introduces a full-featured OpenTelemetry implementation to provide deep, actionable insights into the application's performance, reliability, and resource usage. It establishes a robust foundation for monitoring, debugging, and future performance tuning.

Core Implementation:

End-to-End Tracing: Implemented distributed tracing for critical user flows, including WebSocket connections, message sending, and API requests, providing a clear view of how operations flow through the system.
Application Metrics: Introduced key metrics for monitoring chat activity, such as active connections, message send/receive rates, and API performance.
Structured Telemetry Module: Created a new src/telemetry module to encapsulate all OpenTelemetry logic, including instrumentation, custom metrics, and tracing helpers.
Main & Renderer Process Integration: Correctly initialized the OpenTelemetry SDK in the main process and securely exposed telemetry functions to the renderer process via the preload script.
Dependencies: Added all necessary @opentelemetry packages to package.json.
Debugging Enhancements:

To address existing stability issues, this implementation also includes targeted metrics for diagnosing memory leaks and process shutdown problems:

Garbage Collection Monitoring: Tracks the duration and frequency of GC events to identify memory pressure.
Renderer Memory & DOM Metrics: Periodically captures renderer memory usage and the total DOM node count to pinpoint UI-related leaks.
Process Shutdown Diagnostics: Added tracking for all open windows to ensure they are properly closed on application exit.
This observability stack will be instrumental in improving the stability and performance of the KickTalk application.

* Fix cross-platform icon compatibility

- Add cross-platform icon handling for Linux/macOS support
- Convert Windows .ico to .png for non-Windows platforms
- Update tray and thumbar icons to use platform-appropriate format

Fixes application crashes on Linux due to unsupported .ico format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(telemetry): overhaul observability with manual instrumentation

This commit completely refactors the OpenTelemetry implementation to improve stability and significantly expand observability capabilities. The previous automatic instrumentation using NodeSDK is replaced with a manual approach, which is more reliable within the Electron environment.

Key changes include:
- Replaced automatic instrumentation with a manual OpenTelemetry setup for tracing and metrics, preventing context-related issues in Electron.
- Introduced a Prometheus scrape endpoint to expose detailed application metrics for direct collection.
- Added a user setting in the General tab, allowing users to enable or disable telemetry collection.
- Massively expanded the Grafana dashboard with new panels for CPU, memory, API latency, connection health, and message throughput.
- Implemented robust error handling and fallbacks for the telemetry module to prevent application crashes.
- Updated the development OTEL stack script to support Podman, increasing developer flexibility.
- Added new IPC-based telemetry events for granular tracking of WebSocket connections, API calls, and errors from the renderer.

* feat(testing): add WebSocket connection testing infrastructure

Add comprehensive scripts for testing WebSocket connection resilience and recovery:

• scripts/block-websockets-firewalld.sh - nftables-based IPv4/IPv6 blocking with real AWS/Cloudflare ranges
• scripts/block-websockets-hosts.sh - DNS-level blocking via /etc/hosts manipulation

These scripts enable testing of WebSocket reconnection behavior during network failures,
validating the built-in auto-reconnect mechanisms in KickPusher and 7TV services.
Created while investigating issue KickTalkOrg#41.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(telemetry): comprehensive Grafana dashboard improvements

- Fix DOM node count metrics showing 0 by implementing proper OpenTelemetry integration
- Add 6 new monitoring panels: GC Performance, DOM Node Count, Error Rates, Memory Efficiency, Handle Efficiency, Message Success Rate
- Implement streamer name support across all metrics for cleaner legend displays
- Convert Message Throughput and WebSocket Connections panels to stacked charts
- Fix WebSocket connection counter using ObservableGauge instead of UpDownCounter for accurate real-time counts
- Install and integrate @opentelemetry/exporter-prometheus for proper metrics export
- Remove debug logging for cleaner console output
- Enhance message and WebSocket telemetry with streamer name attributes

Dashboard now provides comprehensive application monitoring with accurate metrics and clean visualizations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ftk789 <57598907+ftk789@users.noreply.github.com>
ftk789 pushed a commit that referenced this pull request Oct 14, 2025
fix(7tv): use correct user ID for cosmetic subscriptions
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.

3 participants