fix(coverage): detect minority-locale translations and honor --doc-locale - #100
Merged
Merged
Conversation
…cale detectLocalePosition only recognized multi-locale prefixes when locale codes covered >50% of sitemap URLs, so sites whose default language is unprefixed and whose translations are a minority (e.g. Datadog's /fr/, /ja/, /ko/, /es/ at ~42%) kept translated pages in the llms-txt-coverage denominator. Generalize the structural-duplication fallback from the single-code case to any number of locale codes: a position is a locale position if stripping one of its codes produces paths that match unprefixed URLs. Also honor an explicit --doc-locale / preferredLocale in the coverage check: it wins over inference from llms.txt URLs, and a preferred locale with no prefixed sitemap URLs is treated as the unprefixed default. Closes #98
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.
Summary
detectLocalePositiononly recognized multi-locale prefixes when locale codes covered >50% of sitemap URLs, so sites with an unprefixed default language and minority translations (Datadog's/fr/,/ja/,/ko/,/es/at ~42%) kept translated pages in thellms-txt-coveragedenominator/it/for IT docs) still aren't filtered--doc-locale/preferredLocalein the coverage check: it wins over inference from llms.txt URLs, and a preferred locale with no prefixed sitemap URLs is treated as the unprefixed defaultdocs/checks/observability.mdCloses #98
Test plan
detectLocalePosition(majority, minority-with-duplication, locale-like-without-duplication, none)--doc-locale(prefixed and unprefixed-default)npm test(1303 tests),npm run lint, prettier clean