Problem/Motivation
When adding a boolean base field to an entity and add that field to a View and I want to use a custom text for the on/off labels, those labels cannot be translated.
This was fixed for normal fields in #2849529: Unable to translate boolean custom true and false strings in views
Steps to reproduce
Add a boolean base field to an entity
Create a view of that entity
Add the base field as a field to the view
Set the output format to Custom
Add a custom on label
Save the View
Go to translate the View
Expected behaviour:
The custom label can be translated
Actual behaviour:
The custom label doesn't appear in the translation interface
Proposed resolution
Set the custom texts to be labels and not strings in the schema
Remaining tasks
Discuss if this needs tests, previous changes to switch schema from untranslatable to translatable didn't need tests for those particular strings
User interface changes
Configurable strings can be translated
API changes
None
Data model changes
None
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3336414-10.1.x-11.patch | 1.24 KB | mrinalini9 |
| #8 | 3336414-10.0.x-8.patch | 1.16 KB | gauravvvv |
| #5 | 3336414-5.patch | 1.23 KB | lendude |
| #5 | interdiff-3336414-2-5.txt | 536 bytes | lendude |
| #2 | 3336414-2.patch | 613 bytes | lendude |
Comments
Comment #2
lendudeHere we go, this makes these strings translatable.
Comment #3
lendudeComment #4
smustgrave commentedCould we add a simple test case to show those fields are now translatable?
Also will this require an update path for existing sites or no since it's updating the schema not adding new values?
Comment #5
lendude@smustgrave thanks for the review!
We generally don't do tests for these schema type changes, since the test would be testing the translation interface and not so much the change we are making here (they are also very hard to test properly). With that in mind, I've changed this to a task and not a bug.
It does indeed need an update to clear the schema cache, so added that.
Comment #6
smustgrave commentedSeems to have a build failure
error: patch failed: core/modules/views/views.post_update.php:63
error: core/modules/views/views.post_update.php: patch does not apply
Comment #7
lendudeAh, I rolled it against 10.1, lets stick it in there first, worry about backports later
Comment #8
gauravvvv commentedAttached patch for 10.0.x
Comment #9
nod_Comment #10
smustgrave commentedTargeting 10.1 on this one first.
Comment #11
mrinalini9 commentedRerolled patch #8 for 10.1.x branch, please review it.
Thanks & Regards,
Mrinalini
Comment #12
smustgrave commentedchanges look good
Comment #14
longwaveCommitted and pushed to 10.1.x, thanks! This one doesn't seem critical to backport and we don't usually backport anything with a post-update hook.