New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add translated search doctypes to hooks #16197
Conversation
@Mergifyio backport version-13-hotfix |
🟠 Waiting for conditions to match
|
Codecov Report
@@ Coverage Diff @@
## develop #16197 +/- ##
===========================================
- Coverage 56.74% 54.81% -1.94%
===========================================
Files 758 758
Lines 67344 67337 -7
Branches 5795 5795
===========================================
- Hits 38214 36910 -1304
- Misses 25603 26882 +1279
- Partials 3527 3545 +18
Flags with carried forward coverage won't be shown. Click here to find out more. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
@hasnain2808 I'd appreciate your feedback on this PR, if you can find any time. Thanks in advance! :) |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing. |
Gender is in Frappe. Maybe we should add it by default? Salutation as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor suggestions and thoughts. Rest LGTM.
Co-authored-by: Sagar Vora <sagar@resilient.tech>
Co-authored-by: Sagar Vora <sagar@resilient.tech>
✅ Backports have been created
|
In `search.py` it was hardcoded that **DocType** and **Role** get translated before matching against the search text. This way, a user can type in his local language and still see correct results. This feature is useful for other DocTypes as well. The criterion would be: there is a small, fairly static number of records, so that the performance impact of translating all names first is not too bad. This PR adds a hook `translated_search_doctypes` that determines which DocType names get translated before search. I also added **Country** to `translated_search_doctypes` for frappe. The link to **Country** is frequently used in **Address**, but until now there was no way to use it in the local language. There are ~70% less Countries than DocTypes (including ERPNext), so the performance should be fine. ERPNext could, for example, add the **Gender** DocType to this hook. As there are very few genders, translating them is fast and improves the UX. Docs: https://frappeframework.com/docs/v13/user/en/python-api/hooks/edit?wiki_page_patch=b4d7c8d6fc (cherry picked from commit f80a16e)
In
search.py
it was hardcoded that DocType and Role get translated before matching against the search text. This way, a user can type in his local language and still see correct results.This feature is useful for other DocTypes as well. The criterion would be: there is a small, fairly static number of records, so that the performance impact of translating all names first is not too bad.
This PR adds a hook
translated_search_doctypes
that determines which DocType names get translated before search.I also added Country to
translated_search_doctypes
for frappe. The link to Country is frequently used in Address, but until now there was no way to use it in the local language. There are ~70% less Countries than DocTypes (including ERPNext), so the performance should be fine.ERPNext could, for example, add the Gender DocType to this hook. As there are very few genders, translating them is fast and improves the UX.
Docs: https://frappeframework.com/docs/v13/user/en/python-api/hooks/edit?wiki_page_patch=b4d7c8d6fc