Skip to content

Add a :fuzzy project option for mix gettext.merge - #459

Closed
oliver-kriska wants to merge 1 commit into
elixir-gettext:mainfrom
oliver-kriska:merge-fuzzy-config
Closed

oliver-kriska wants to merge 1 commit into
elixir-gettext:mainfrom
oliver-kriska:merge-fuzzy-config

Conversation

@oliver-kriska

Copy link
Copy Markdown
Contributor
  • Adds a :fuzzy option to the :gettext project configuration. fuzzy: false turns off fuzzy matching for mix gettext.merge, and so for mix gettext.extract --merge.
  • --fuzzy and --no-fuzzy still override it.
  • The default does not change: fuzzy matching stays on when the option is absent.

A project that never wants fuzzy matches has to pass --no-fuzzy on every call today, usually through a Mix alias. Any call that goes around the alias fuzzy matches without notice. :fuzzy_threshold already has a project option; this is the on/off counterpart.

mix.exs Flag Before After
no :fuzzy none fuzzy matching fuzzy matching
fuzzy: false none fuzzy matching (option unknown) no fuzzy matching
fuzzy: false --fuzzy fuzzy matching fuzzy matching
fuzzy: true --no-fuzzy no fuzzy matching no fuzzy matching

Checks

  • Three new tests in gettext.merge_test.exs for the last three rows; the fuzzy: false one fails on main. The first row is covered by the existing tests.
  • mix gettext.extract --merge has no test of its own here: it calls Mix.Tasks.Gettext.Merge.run/1, which reads the project configuration itself, as it does for :fuzzy_threshold.
  • mix format --check-formatted, mix compile --warnings-as-errors and mix test pass (197 passed).

Note

This touches the same function and test file as #458. I'll rebase whichever one is merged second.

🤖 Generated with Claude Code

Setting `fuzzy: false` in the :gettext project configuration turns off
fuzzy matching for mix gettext.merge, and so for
mix gettext.extract --merge. The --fuzzy and --no-fuzzy flags still
override it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@oliver-kriska

Copy link
Copy Markdown
Contributor Author

Closing this given the feedback on #458 about avoiding new project configuration. --no-fuzzy on the task, or in a Mix alias, already covers it.

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.

1 participant