Skip to content

Fix bad merge in MSTest.Analyzers xlf files#8636

Merged
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/fix-xlf-duplicate-target
May 27, 2026
Merged

Fix bad merge in MSTest.Analyzers xlf files#8636
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/fix-xlf-duplicate-target

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Problem

Two recent OneLocBuild check-ins corrupted the TestContextShouldBeValidDescription trans-unit in all 13 language xlf files for MSTest.Analyzers, breaking the build with:

xlf\Resources.cs.xlf : error : The element 'trans-unit' in namespace 'urn:oasis:names:tc:xliff:document:1.2' has invalid child element 'target' in namespace 'urn:oasis:names:tc:xliff:document:1.2'. List of possible elements expected: 'context-group, count-group, prop-group, note, alt-trans' in namespace 'urn:oasis:names:tc:xliff:document:1.2' as well as any element in namespace '##other'. [D:\a\_work\1\s\src\Analyzers\MSTest.Analyzers\MSTest.Analyzers.csproj]

Root cause

Fix

Restore the TestContextShouldBeValidDescription trans-unit to its pristine pre-bad-merge state (taken from commit 561ebf7) for all 13 affected files. This:

  • Removes the duplicate <target> so each <trans-unit> has exactly one target (fixes the XSD validation error).
  • Restores the proper per-language translation that was overwritten with Czech.

Verification

  • Built MSTest.Analyzers.csproj locally: 0 warnings, 0 errors.
  • XML-parsed every .xlf file under src/ and test/ and verified that no <trans-unit> has more than one <target>.

Two OneLocBuild check-ins corrupted the `TestContextShouldBeValidDescription` trans-unit
in all 13 language xlf files for `MSTest.Analyzers`:

- 41fd1ac added a stray `<target state=""new"">English text</target>` element,
  producing two `<target>` elements in a single `<trans-unit>`. This violates
  the xliff 1.2 schema and broke the build with:
  `error : The element 'trans-unit' ... has invalid child element 'target' ...`
- c27a8f1 then overwrote the existing localized translation with the Czech text
  in all 12 non-Czech language files.

Restore the trans-unit to its pristine pre-bad-merge state (from 561ebf7) for
all 13 affected files. This:
- Removes the duplicate `<target>` so each `<trans-unit>` has exactly one
  target (fixes the XSD validation error).
- Restores the proper per-language translation that was overwritten with Czech.

Verified by building `MSTest.Analyzers.csproj` (0 warnings, 0 errors) and by
XML-parsing every xlf file in the repository to confirm no `<trans-unit>` has
more than one `<target>`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 27, 2026 15:55
@Evangelink
Evangelink enabled auto-merge (squash) May 27, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a corrupted TestContextShouldBeValidDescription trans-unit in the MSTest.Analyzers localized .xlf files (introduced by bad OneLocBuild merges), restoring schema-valid XLIFF 1.2 structure and per-language translations so the analyzers project builds again.

Changes:

  • Removes the duplicate <target> element from the affected trans-unit (restoring XLIFF 1.2 validity).
  • Restores the correct per-language localized <target> content that had been overwritten across multiple languages.
Show a summary per file
File Description
src/Analyzers/MSTest.Analyzers/xlf/Resources.cs.xlf Removes the stray duplicate <target> in the affected trans-unit.
src/Analyzers/MSTest.Analyzers/xlf/Resources.de.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct German translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.es.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Spanish translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct French translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.it.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Italian translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.ja.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Japanese translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.ko.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Korean translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.pl.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Polish translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.pt-BR.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Portuguese (Brazil) translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.ru.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Russian translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.tr.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Turkish translation.
src/Analyzers/MSTest.Analyzers/xlf/Resources.zh-Hans.xlf Restores TestContextShouldBeValidDescription to a single <target> (but see review comment about incorrect wording).
src/Analyzers/MSTest.Analyzers/xlf/Resources.zh-Hant.xlf Restores TestContextShouldBeValidDescription to a single <target> with correct Traditional Chinese translation.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 1

Comment thread src/Analyzers/MSTest.Analyzers/xlf/Resources.zh-Hans.xlf

@Evangelink Evangelink left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21/21 dimensions clean — no findings.

This PR correctly fixes a critical build-blocking schema violation in 13 localization files. The fix:

  • Removes duplicate <target> elements that violated XLIFF 1.2 schema
  • Restores proper per-language translations (removes Czech text from 12 non-Czech files)
  • Verified via XML parsing: All trans-units now have exactly 0 or 1 target elements
  • Proper scope: Only the 13 affected .xlf files, no unrelated changes
  • Well-documented: Clear root cause analysis and verification steps

Note on manual .xlf editing: While the codebase rule is "never manually edit *.xlf files — build generates them," this PR is a justified exception. The automated OneLocBuild tooling introduced corruption that broke the build. Manual restoration to a known-good state is the correct fix for this scenario.

The fix has been validated:

  • All 13 language files have exactly 1 <target> per TestContextShouldBeValidDescription trans-unit
  • Czech file retains Czech text, all other files have their proper language-specific translations
  • No schema violations remain

Generated by Expert Code Review (on open) for issue #8636 · ● 8.5M

@Evangelink
Evangelink merged commit 9692f92 into main May 27, 2026
32 checks passed
@Evangelink
Evangelink deleted the dev/amauryleve/fix-xlf-duplicate-target branch May 27, 2026 18: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.

4 participants