Skip to content

Fix FilenamesToAddToCache yielding duplicates when UseLanguageCodeFolders=true#145

Merged
imnasnainaec merged 7 commits into
masterfrom
fix/135-filenames-to-cache
Jun 15, 2026
Merged

Fix FilenamesToAddToCache yielding duplicates when UseLanguageCodeFolders=true#145
imnasnainaec merged 7 commits into
masterfrom
fix/135-filenames-to-cache

Conversation

@imnasnainaec

@imnasnainaec imnasnainaec commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #140 (part of #135)

When UseLanguageCodeFolders is true, the loop over the installed XLIFF folder was missing the !langIdsOfCustomizedLocales.Contains(langId) guard that the non-UseLanguageCodeFolders branch already applies correctly. The result was that both the custom and installed XLIFF files for the same language were yielded, causing whichever loaded last to silently overwrite the other in the string cache.

Also, when adding a regression test to src/L10NSharp.Tests/LocalizationManagerTestsBase.cs, I removed the try-finally block from 2 existing tests, since they are redundant with the teardown.


This change is Reviewable

Devin review: https://app.devin.ai/review/sillsdev/l10nsharp/pull/145

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Test Results

    7 files  ±0  104 suites  ±0   30s ⏱️ +7s
167 tests +1  162 ✔️ +1    5 💤 ±0  0 ±0 
634 runs  +4  619 ✔️ +4  15 💤 ±0  0 ±0 

Results for commit e6bc0d4. ± Comparison against base commit 7c4190e.

♻️ This comment has been updated with latest results.

@imnasnainaec imnasnainaec self-assigned this Jun 5, 2026
@imnasnainaec imnasnainaec marked this pull request as ready for review June 5, 2026 15:15
@imnasnainaec imnasnainaec marked this pull request as draft June 5, 2026 15:23
imnasnainaec and others added 4 commits June 8, 2026 09:09
…ders=true (#140)

The UseLanguageCodeFolders branch for the installed folder was missing
the !langIdsOfCustomizedLocales.Contains(langId) guard that the
non-UseLanguageCodeFolders branch already applies. Without it, both the
custom and installed XLIFF for the same language were yielded, and
whichever loaded last silently overwrote the other in the cache.
…anguageCodeFolders (#140)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imnasnainaec imnasnainaec force-pushed the fix/135-filenames-to-cache branch from a882e18 to cbb9546 Compare June 8, 2026 13:09
imnasnainaec and others added 2 commits June 8, 2026 09:43
TearDown already resets UseLanguageCodeFolders to false, making the
finally clauses in GetUiLanguages_FindsAllWithFolders,
GetDynamicStringInEnglish_NoDefault_FindsEnglishWithFolders, and
CustomTranslation_TakesPrecedenceOverInstalled_WithLanguageCodeFolders
redundant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imnasnainaec imnasnainaec marked this pull request as ready for review June 8, 2026 13:53

@andrew-polk andrew-polk 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.

@andrew-polk reviewed 3 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@imnasnainaec imnasnainaec enabled auto-merge (squash) June 15, 2026 18:05
@imnasnainaec imnasnainaec merged commit b6db31f into master Jun 15, 2026
4 of 5 checks passed
@imnasnainaec imnasnainaec deleted the fix/135-filenames-to-cache branch June 15, 2026 18:07
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.

Fix FilenamesToAddToCache yielding duplicate files when UseLanguageCodeFolders=true

2 participants