Skip to content

Conversation

@abhinavohri
Copy link
Contributor

Fixes #14798

When translating on category or project level, make user aware if the component of unit changes.

@abhinavohri abhinavohri requested a review from nijel as a code owner May 19, 2025 13:27
Copy link
Member

@nijel nijel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see a reasonable way to make it work without passing this info in request? The long-term plan is to use unit URLs while navigating (see #9953).

messages.error(request, gettext("Invalid search string!"))
return redirect(obj)

from_offset = int(request.GET.get("from_offset", offset - 1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will crash with a blank value (form_offset=).

gettext("You have shifted from %(previous)s to %(current)s.")
% {
"previous": previous_unit.translation.component.name,
"current": unit.translation.component.name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name is not good enough here as it does not have to be unique, at least categories should be included. Perhaps using full component name including project would be better for consistency with other views.

@codecov
Copy link

codecov bot commented May 19, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.14%. Comparing base (8b8a288) to head (3594817).
⚠️ Report is 3376 commits behind head on main.

Files with missing lines Patch % Lines
weblate/trans/views/edit.py 33.33% 3 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14921      +/-   ##
==========================================
+ Coverage   91.10%   91.14%   +0.03%     
==========================================
  Files         624      626       +2     
  Lines       65338    65476     +138     
  Branches     6746     6753       +7     
==========================================
+ Hits        59527    59676     +149     
+ Misses       4077     4069       -8     
+ Partials     1734     1731       -3     
Files with missing lines Coverage Δ
weblate/trans/views/edit.py 81.17% <33.33%> (-0.56%) ⬇️

... and 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

int(request.session["previous_unit_id"])
if "previous_unit_id" in request.session
else None
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be pinned to the search result; otherwise it will have too many corner cases:

  • Translating one project, then starting translating another project would yield the message.
  • Opening multiple translation tabs they will fight for the same previous_unit_id.

It could be stored inside the search data, which we already have in the search function above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@nijel nijel self-assigned this Jun 12, 2025
@nijel nijel added this to the 5.12 milestone Jun 12, 2025
@nijel nijel merged commit 37a8d0a into WeblateOrg:main Jun 12, 2025
48 of 50 checks passed
@nijel
Copy link
Member

nijel commented Jun 12, 2025

Merged, thanks for your contribution!

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.

Show message when moving between components while translating

2 participants