Skip to content

Implement internationalization of exception messages#99

Open
konard wants to merge 3 commits intomainfrom
issue-9-d3d7ec5f
Open

Implement internationalization of exception messages#99
konard wants to merge 3 commits intomainfrom
issue-9-d3d7ec5f

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

Implements internationalization (i18n) for exception messages in the Platform.Disposables library to support multiple languages.

Changes Made

  • Created resource files:

    • Resources.resx - Default English exception messages
    • Resources.ru.resx - Russian translation
    • Resources.Designer.cs - Strongly-typed resource access class
  • Updated DisposableBase.cs:

    • Replaced hardcoded English exception message with localized resource string
    • Uses Resources.MultipleDisposeCallsNotAllowed for culture-specific messages
  • Added comprehensive test:

    • MultipleDisposeExceptionMessageInternationalizationTest verifies proper localization
    • Tests both English (en-US) and Russian (ru-RU) cultures
    • Ensures messages are correctly localized based on CultureInfo.CurrentUICulture
  • Fixed existing test:

    • Updated DisposalOrderTest from net7 to net8 framework reference

Technical Details

The implementation follows standard .NET resource file patterns:

  • Resource files are automatically embedded as resources during build
  • The strongly-typed Resources class provides compile-time safety
  • Exception messages are resolved at runtime based on current UI culture
  • Falls back to default English message if specific culture resource is unavailable

Testing

All tests pass, including the new internationalization test that verifies:

  • English message: "Multiple dispose calls are not allowed. Override AllowMultipleDisposeCalls property to modify behavior."
  • Russian message: "Множественные вызовы Dispose не разрешены. Переопределите свойство AllowMultipleDisposeCalls для изменения поведения."

🤖 Generated with Claude Code


Resolves #9

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

Issue: #9
@konard konard self-assigned this Sep 14, 2025
- Add Resources.resx and Resources.ru.resx for English and Russian localization
- Create strongly-typed Resources.Designer.cs for accessing localized strings
- Update DisposableBase.cs to use localized exception message for multiple dispose calls
- Add comprehensive unit test for verifying internationalization works across cultures
- Fix test framework reference from net7 to net8 to resolve DisposalOrderTest failure

🤖 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 11:29
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

1 participant