Skip to content

fix(coverage): detect minority-locale translations and honor --doc-locale - #100

Merged
dacharyc merged 1 commit into
mainfrom
fix/locale-detection-minority-translations
Aug 9, 2026
Merged

fix(coverage): detect minority-locale translations and honor --doc-locale#100
dacharyc merged 1 commit into
mainfrom
fix/locale-detection-minority-translations

Conversation

@dacharyc

@dacharyc dacharyc commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • detectLocalePosition only 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 the llms-txt-coverage denominator
  • Generalizes the structural-duplication fallback from the single-code case to any number of locale codes: a position counts as a locale position if stripping one of its codes produces paths that match unprefixed URLs in the same set, so locale-like topic segments (e.g. /it/ for IT docs) still aren't filtered
  • Honors 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
  • Documents locale handling in docs/checks/observability.md

Closes #98

Test plan

  • Unit tests for detectLocalePosition (majority, minority-with-duplication, locale-like-without-duplication, none)
  • Integration tests: Datadog-style minority-locale filtering, topic-segment non-filtering, explicit --doc-locale (prefixed and unprefixed-default)
  • npm test (1303 tests), npm run lint, prettier clean

…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
@dacharyc
dacharyc merged commit 4465753 into main Aug 9, 2026
2 checks passed
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.

Locale detection misses multi-locale sites when localized URLs are under 50% of the sitemap

1 participant