Repository navigation
feat(l10n): localize clipboard import errors by type - #163
Merged
Merged
Conversation
The clipboard paste path (ClipboardSerializer.DeserializeSteps) raised
free-text Result.Fail/new Error for every parse failure, so a paste error
rendered raw English regardless of culture. It reaches the panel via
ClipboardViewModel.PasteStepsAsync -> ReportFailure, which localizes by type.
Type the clipboard path, reusing the shared tabular-parse errors 5b
introduced (AtRowError, AtColumnError, ActionColumnEmptyError,
ActionValueNotIntegerError, ActionByIdNotFoundError, ActionColumnNotFoundError)
and adding three clipboard-specific classes:
- ClipboardParseFailedError -- Rule-B exception-envelope for the top-level
parse catch. Inject ILogger<ClipboardSerializer> and LogWarning the
exception detail (mirrors CsvService), since the localized headline drops
ex.Message; the catch is real (CsvHelper throws on malformed pastes).
- ColumnCountMismatchError and NoValidStepsError -- leaves, byte-identical
English.
The value chain composes AtRowError -> AtColumnError -> PropertyValueParseError:
pasting a non-numeric cell into a float column renders, under ru,
"Строка 1: Столбец «task»: Не удалось разобрать «abc» как float" -- Russian
end to end (was just "Row 1"). This completes the CSV+clipboard ingress:
after it, only the config-load-culture boundary is English by design.
English is behavior-preserving except three flagged changes (same as 5b):
AtRowError gains ": {inner}", the ActionByIdNotFoundError reuse rewords
unknown-action, and ClipboardParseFailedError drops ": {ex.Message}" (kept
in the log).
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
The clipboard paste path (
ClipboardSerializer.DeserializeSteps) raised free-textResult.Fail(string)/new Error(string)for every parse failure, so a paste error rendered raw English regardless of culture. It reaches the panel viaClipboardViewModel.PasteStepsAsync → ReportFailure, which localizes by type.What changed
Type the clipboard path, reusing the shared tabular-parse errors 5b introduced (
AtRowError,AtColumnError,ActionColumnEmptyError,ActionValueNotIntegerError,ActionByIdNotFoundError,ActionColumnNotFoundError) and adding three clipboard-specific classes:ClipboardParseFailedError— Rule-B exception-envelope for the top-level parse catch. InjectsILogger<ClipboardSerializer>andLogWarnings the exception detail (mirrorsCsvService), since the localized headline dropsex.Message; the catch is real (CsvHelper throwsBadDataExceptionon malformed pastes).ColumnCountMismatchErrorandNoValidStepsError— leaves, byte-identical English.The value chain composes
AtRowError → AtColumnError → PropertyValueParseError: pasting a non-numeric cell into a float column renders, underru,Строка 1: Столбец «task»: Не удалось разобрать «abc» как float— Russian end to end (was just "Row 1"). This completes the CSV+clipboard ingress: after it, only the config-load-culture boundary is English by design.Behavior-preserving for English except three flagged changes (same shape as 5b):
AtRowErrorgains: {inner}, theActionByIdNotFoundErrorreuse rewords unknown-action, andClipboardParseFailedErrordrops: {ex.Message}(kept in the log vialogger.LogWarning).Verification
dotnet build SemiStep.slnx— 0 warnings.dotnet test SemiStep/SemiStep.Tests/SemiStep.Tests.csproj— 1638 passed, 0 failed.CsvDeserializationTestsdeserializes20\t5.0\tabc\tcthrough the realClipboardSerializer.DeserializeStepsand asserts the full Russian chain underru. The three new types are each pinned end-to-end:ClipboardParseFailedError(unescaped-quote →BadDataExceptioncatch),NoValidStepsError(empty input),ColumnCountMismatchError(too-many-columns).ReasonLocalizerTestspins the 3 ru renders + the enLocalize == .Message.Per-task commits before collapse
🤖 Generated with Claude Code