weblate icon indicating copy to clipboard operation
weblate copied to clipboard

Glossary: Add `context` to glossary form and change permission check

Open Xzonn opened this issue 1 year ago • 3 comments

Proposed changes

Add an input box for context to glossary form in the translation UI (#10969), based on NewMonolingualUnitForm:

https://github.com/WeblateOrg/weblate/blob/8f105d79a47b28c333d01d20ff4b4b9f27d8baad/weblate/trans/forms.py#L2375-L2391

I also noticed that there is a significant difference between NewMonolingualUnitForm and NewBilingualSourceUnitForm. Should we unify them?

I also changed the permission check from unit.add to glossary.add. Before this commit, terms can not be directly added to the glossary because of this check:

https://github.com/WeblateOrg/weblate/blob/4774584fd9e6d3795a0c40bb0c3520bf2a21875a/weblate/auth/permissions.py#L273-L274

Checklist

  • [x] Lint and unit tests pass locally with my changes.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have added documentation to describe my feature.
  • [x] I have squashed my commits into logic units.
  • [x] I have described the changes in the commit messages.

Other information

Screenshot

image

Xzonn avatar Feb 21 '24 06:02 Xzonn

I changed TermForm to inherit NewBilingerGlossaryUnitForm in order to avoid the field description and help texts:

Screenshot

image

The font size for .highlighted-output should be set to 16px, but I'm not sure which CSS file to add to.

Xzonn avatar Feb 21 '24 09:02 Xzonn

This pull request has been automatically marked as stale because there wasn’t any recent activity.

It will be closed soon if no further action occurs.

Thank you for your contributions!

github-actions[bot] avatar Mar 28 '24 01:03 github-actions[bot]

Codecov Report

Attention: Patch coverage is 75.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 90.62%. Comparing base (6aee586) to head (994edb7). Report is 1656 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11063      +/-   ##
==========================================
- Coverage   90.82%   90.62%   -0.21%     
==========================================
  Files         554      570      +16     
  Lines       57306    58599    +1293     
  Branches     9122     9373     +251     
==========================================
+ Hits        52046    53103    +1057     
- Misses       3640     3810     +170     
- Partials     1620     1686      +66     
Files Coverage Δ
weblate/glossary/tests.py 100.00% <ø> (ø)
weblate/glossary/forms.py 74.13% <81.81%> (-1.58%) :arrow_down:
weblate/trans/forms.py 87.84% <69.23%> (-0.03%) :arrow_down:

... and 241 files with indirect coverage changes

codecov[bot] avatar Apr 12 '24 17:04 codecov[bot]

Merged, thanks for your contribution!

nijel avatar May 15 '24 06:05 nijel