Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

This PR implements internationalization for exception messages in Platform.Ranges, addressing issue #12. The implementation follows the team's decision to start with English language but in a structured way that enables future multi-language support.

Key Changes

  • Resource-based localization system: Created ExceptionMessages.resx file with structured message definitions
  • Replaced hardcoded messages: Updated EnsureExtensions.cs to use localized messages instead of hardcoded English strings
  • Public API for messages: Made ExceptionMessages class public so consumers can access message strings programmatically
  • Comprehensive testing: Added unit tests to verify localized messages work correctly in exception scenarios
  • Unicode compatibility: All messages now support Unicode characters as requested in the original issue

Messages Internationalized

  1. "Maximum should be greater or equal to minimum." - Used in range validation
  2. "Argument value [{0}] is out of range {1}." - Used in argument validation with formatting

Technical Implementation

  • Uses .NET's built-in resource system (.resx files) for future extensibility
  • Maintains backward compatibility - all existing code continues to work
  • Messages are embedded as resources in the assembly
  • Follows .NET conventions for resource organization and access

Future Extensibility

This foundation enables adding additional languages by:

  1. Creating culture-specific .resx files (e.g., ExceptionMessages.ru.resx)
  2. Setting CultureInfo to control which language is used
  3. Adding new exception messages to the resource system

Test plan

  • All existing tests continue to pass
  • New tests verify localized messages are used in exceptions
  • Build succeeds without errors or warnings
  • Resource files are properly embedded in assembly
  • Public API provides access to message strings

🤖 Generated with Claude Code


Resolves #12

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #12
@konard konard self-assigned this Sep 14, 2025
- Create resource-based localization system using .resx files
- Replace hardcoded English exception messages with localized versions
- Add ExceptionMessages.resx with structured message definitions
- Update EnsureExtensions to use localized messages from resources
- Add comprehensive unit tests to verify localized messages work correctly
- Make ExceptionMessages class public for programmatic access
- Support future multi-language capabilities through .NET resource system

All exception messages now use Unicode-compatible resource strings instead of hardcoded English text, addressing issue #12.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Internationalization of exception messages Implement internationalization of exception messages Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 09:41
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.

Internationalization of exception messages

2 participants