Skip to content

Lexicon checker: cross-topic duplicate reports and element label cleanup - #16997

Open
Ibochkarev wants to merge 4 commits into
modxcms:3.xfrom
Ibochkarev:chore/14512-lexicon-topics-cleanup
Open

Lexicon checker: cross-topic duplicate reports and element label cleanup#16997
Ibochkarev wants to merge 4 commits into
modxcms:3.xfrom
Ibochkarev:chore/14512-lexicon-topics-cleanup

Conversation

@Ibochkarev

Copy link
Copy Markdown
Collaborator

What changed and why

First slice of #14512. The core lexicon checker now reports keys that appear in more than one topic (identical value vs conflicting value). English element topics no longer repeat type labels (chunk/chunks, snippet/snippets, plugin/plugins, template/templates) that already exist in default, which the manager always loads.

CheckLexicon lives in MODX\Revolution\Build, with a thin CLI entrypoint and a short README for maintainers.

How to test

php -l _build/lexicon/checklexicon.class.php
php -l _build/lexicon/checklexicon.php
cd _build/test && ../../core/vendor/bin/phpunit --filter CheckLexiconDuplicateTest
# expect: OK (3 tests, 35 assertions), exit 0

php _build/lexicon/checklexicon.php en
# expect: exit 0; reports under _build/lexicon/_*.php (gitignored)

On a running manager install, confirm Elements tree labels still resolve when cultureKey=en (depends on core:default).

Related issue(s)/PR(s)

Refs #14512
Builds on the checker from #14979

Compatibility notes

  • English core lexicons only in this PR (Crowdin for other languages).
  • Keys remain available via default. Manager and connectors already load core:default.
  • Loading an element topic alone without default no longer provides those eight type labels (documented trade-off).
  • Does not mass-delete _superfluous keys (extras may still use them).

Breaking change assessment

No public PHP API change. Lexicon key availability for the eight labels still works when default is loaded. Topic-only loads without default lose those labels.

Test coverage

  • _build/test/Tests/Build/CheckLexiconDuplicateTest.php (suite Build in phpunit.xml)
  • Gate E this session: php -l exit 0; phpunit exit 0 (3/35)

Contributors

@Ruslan-Aleev @Jako @JoshuaLuckers

AI tool use

Cursor agent assisted implementation, tests, and PR drafting under maintainer review.

…dupes

Extend the core lexicon checker with identical/conflict topic reports and
remove English chunk/snippet/plugin/template type labels that already live
in default (manager always loads core:default). Refs modxcms#14512.
Place the build checker under MODX\Revolution\Build for PSR compliance
and switch the CLI PDO errmode away from deprecated WARNING.
Wrap long CheckLexicon messages for the 120-char rule and point
modLexiconTest at default for chunk type labels moved out of the
chunk topic.
Avoid file-level require_once so phpcs PSR1 side-effects sniff stays clean.
@Ibochkarev Ibochkarev added feature Request about implementing a brand new function or possibility. area-lexicons Issues related to translations and lexicons implementation. labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-lexicons Issues related to translations and lexicons implementation. feature Request about implementing a brand new function or possibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant