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
fix: set translated text to link field #15451
Conversation
Bildschirmaufnahme.2021-12-28.um.15.46.44.mov |
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. |
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.
@hrwX this is working great! A big improvement of localized user experience 🚀
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.
Looks like cypress tests for the link field need to be updated as well
9ceddea
to
590970b
Compare
Codecov Report
@@ Coverage Diff @@
## develop #15451 +/- ##
===========================================
+ Coverage 58.18% 58.22% +0.03%
===========================================
Files 768 768
Lines 68783 68811 +28
Branches 5977 5985 +8
===========================================
+ Hits 40020 40062 +42
+ Misses 25134 25133 -1
+ Partials 3629 3616 -13
Flags with carried forward coverage won't be shown. Click here to find out more. |
79b46be
to
b8e44ae
Compare
b8e44ae
to
ad58497
Compare
|
Hi, @barredterra @hrwX this would be backported to v13? |
@fproldan that's the goal. But I can't promise we'll make it, as tricky as this PR is. :D |
Functionality LGTM now |
@hrwX please make sure the tests are working and add docs for this feature and it's delimination to / interaction with |
Test with DocType Country: "Translate Link Fields" checked in doctype definition and "Country" in country.movTest with DocType Module Def: "Translate Link Fields" not checked in doctype definition and "Module Def" not in Bildschirmaufnahme.2022-05-16.um.14.56.07.mov |
- Fixes [Issue/15324](frappe#15324) - When selecting a value for Link Field, the English text was set as link field value. - This PR aims to fix it by setting the translated text as link field value on selection. Todo: - [x] Show translated text in the select dropdown - [x] Set translated value to Link field on select - [x] Show original value when link field is in focus - [x] Add option to toggle this behaviour - Link field loses focus: show the translated name. - Link field is focused - If old value is present - If options **are** one of [Role, DocType]: show the translated name - Else: show the name (untranslated) to enable search in untranslated values - Else: show what the user typed (untranslated) to enable search in untranslated values - Value is selected: link field loses focus The UOM names are in english, so the search needs to happen in english. When possible, the translation is displayed. https://user-images.githubusercontent.com/14891507/156415248-e5e80d05-53dc-4ca8-89c7-998986ff6e99.mov https://user-images.githubusercontent.com/14891507/156410386-a874430c-f340-43ed-9c3a-92e8d4d50fc9.mov The DocType names get translated before being searched. This is a preexisting hack in the framework for DocType and Role. In this case, we can search in the translations. https://user-images.githubusercontent.com/14891507/156414648-8e505f8c-9dee-4358-8182-3b358c28bb62.mov https://user-images.githubusercontent.com/14891507/156411881-c4ca22e1-1397-4e13-9768-5e16b72f8d6d.mov https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/customize-form/edit?wiki_page_patch=fdafee2715
@fproldan you can find the backport to |
Todo:
Behaviour
Demo
Link to UOM in a custom Item DocType
The UOM names are in english, so the search needs to happen in english. When possible, the translation is displayed.
Before
Bildschirmaufnahme.2022-03-02.um.18.26.01.mov
After
Bildschirmaufnahme.2022-03-02.um.17.58.34.mov
Link to DocType in Customize Form
The DocType names get translated before being searched. This is a preexisting hack in the framework for DocType and Role. In this case, we can search in the translations.
Before
Bildschirmaufnahme.2022-03-02.um.18.22.22.mov
After
Bildschirmaufnahme.2022-03-02.um.18.07.02.mov
https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/customize-form/edit?wiki_page_patch=fdafee2715