Skip to content

Add git-native terminology toggle#13

Open
dsandall wants to merge 1 commit into
eblanshey:masterfrom
dsandall:git-terminology-toggle
Open

Add git-native terminology toggle#13
dsandall wants to merge 1 commit into
eblanshey:masterfrom
dsandall:git-terminology-toggle

Conversation

@dsandall

@dsandall dsandall commented Jun 22, 2026

Copy link
Copy Markdown

Note:

Thanks for putting this together! Let me know if you need someone to wade through slop PRs, or help out with the project - I'd love to be involved.

Claude:

Adds an opt-in 'Use git terminology' preference that relabels the UI with the underlying git terms (Iteration->Commit, Project->Repository, Reviewed->Staged, Current Files->Working Tree, etc.).

  • vocabulary.py: param-backed toggle + ordered, word-boundary friendly->git substitution (terms with no git analog, e.g. Snapshot, pass through).
  • utils.translate(): routes runtime strings through the remap (central, no-op when disabled).
  • commands.py: _LocalizedCommand wraps GetResources so QT_TRANSLATE_NOOP menu labels (which bypass translate()) are remapped too.
  • preferences page: 'Use git terminology' checkbox under a Terminology group.
  • tests: 15 cases covering mapping, longest-match, word boundaries, no-op.

@eblanshey

Copy link
Copy Markdown
Owner

Thanks for the PR. I was thinking about making this functionality myself.

Couple issues:

  1. The main issue is that it performs like 20 regex substitutions against every single translated text. That's a lot. Maybe there's a more efficient way? Perhaps using placeholders for the replaced words, and somehow using a helper function to insert the correct term would be better. Just an idea.

  2. The code doesn't abide by the layered architecture. Since you used AI, could you please point Claude to the AGENTS.md, as well as the Architecture.md doc to let it put responsibilities where they belong. E.g. the setting value should be retrieved from the SettingsRepository, which already has a caching mechanism. You can move to_git_terminology() to the utils.py file, and delete vocabulary.py, as most of it is related to freecad settings anyway. Should be pretty straightforward changes.

Thank you.

Adds an opt-in 'Use git terminology' preference that relabels the UI with
the underlying git terms (Iteration->Commit, Project->Repository,
Reviewed->Staged, Current Files->Working Tree, etc.).

- SettingsRepository owns the toggle: git_terminology_enabled() /
  set_git_terminology_enabled() on the domain port and
  FreeCADSettingsRepository, reusing the repo's existing cache.
- utils.term(cad, git): selects the CAD-friendly or git phrase per the
  toggle. Both args are translate()/QT_TRANSLATE_NOOP literals.
- Display sites pass both variants through term() at the call site.
- Command labels are built at Initialize (before the container exists), so
  they read the pref via settings_repo.read_git_terminology_enabled();
  everything else uses the container-cached repo.
- preferences page: 'Use git terminology' checkbox under a Terminology group.
- tests: settings-repo toggle + cache, term() selection, preferences wiring.

Design notes:
- No runtime regex remap. The earlier approach ran ~20 regex substitutions
  on every translated string; term() does a single boolean check and
  returns one of two prepared strings, so untoggled paths cost nothing and
  toggled paths do no scanning.
- No inline single-word substitution (f-string or %1 placeholder). Each
  terminology variant is written as a full translate()/QT_TRANSLATE_NOOP
  literal at its display site, for two reasons: Qt's lupdate can only
  extract static literals, so both variants stay translatable; and
  sentences are never fragmented around an inserted word, which would break
  grammar/agreement in inflected locales. The near-duplicate CAD/git
  phrases are the deliberate cost of keeping every user-facing string
  translatable at the point it is shown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AY7KZvGbYkCem92P3oVkQd
@dsandall

dsandall commented Jun 23, 2026

Copy link
Copy Markdown
Author

Fair notes, that is a lot of regex.

My initial reasoning (likely cause of the excessive regex) was to keep the PR as minimal as possible.

I had Claude address your points, and it ended up with a lot of code/string duplication - I pushed back, but you can make the final call. Claude listed it's thoughts on the issue in the new commit message.

@dsandall dsandall force-pushed the git-terminology-toggle branch from 3dfbff9 to 45fcb12 Compare June 23, 2026 04:02
@eblanshey

Copy link
Copy Markdown
Owner

Yeah it's way too verbose. I definitely don't want to add that much complexity just to show different text. I'll see if I can find a better compromise.

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.

2 participants