Problem/Motivation
Machine names are always in ASCII (Latin) character sets, and therefore will always be read LTR. However, the content type machine name's directionality currently changes to RTL for pages in an RTL language.
Steps to reproduce
- Enable locale.
- Add an RTL language, e.g. Arabic, and set it as the default language.
- Go to a content type edit page.
- Enter a value in the machine name field.
Expected result
The field should display LTR since only Latin characters are allowed.
Actual result
The field is still RTL.
Proposed resolution
Make LTR directionality the default for machine name elements in form_process_machine_name(). Allow specific forms to override this default as desired.
Remaining tasks
None.
User interface changes
Machine-name fields are now rendered LTR by default.
API changes
None.
Original report by @elcuco
The content type name is always an English text - it must have directionality set to LTR.
I am attaching here a patch that fixes it.
| Comment | File | Size | Author |
|---|---|---|---|
| #40 | ltr-d7-381994-40.patch | 2.26 KB | xjm |
| #40 | interdiff-37-40.txt | 539 bytes | xjm |
| #37 | ltr-d7-381994-37.patch | 2.27 KB | xjm |
| #34 | ltr-381994-34-tests-only.patch | 1.65 KB | xjm |
| #34 | ltr-381994-34-combined.patch | 2.32 KB | xjm |
Comments
Comment #1
elcuco commentedUpdate patch to reflect D6.10
Comment #2
elcuco commentedComment #3
yhager commentedtrivial patch - works as described.
Comment #4
brianV commentedPatch rerolled against D6 HEAD.
Also included D7 version.
Comment #5
gábor hojtsyNeeds more whitespace (one space at both before and after =>). Also, first get it committed to Drupal 7.
Comment #6
yhager commentedhere
Comment #7
elcuco commentedYes, still the same code. Changing to "reviewed & tested by the community".
Comment #8
dries commentedHow to reproduce this problem? Please clarify the problem -- you're only describing the solution.
Can we write a D7 test for it?
Comment #9
yhager commentedThe problem is that when your $language->direction is LANGAUGE_RTL, then the content type input field is also presented right-to-left. This does not make sense on its own, since the text must be in English, thus LTR.
I'm not sure how to write a test for it.
Comment #10
elcuco commentedSorry. I am always under the impression that RTL/LTR issues are known to all :)
The problem is simple - you currently spit this HTML
and I need (even in RTL pages)
The reason is that even in RTL pages, that input line will always contain English text (a php variable). This will look weird when you type a string like "blabla___". To understand how bad it looks, just press control+shift+x while you have the focus on the input line (if you are in firefox), under IE or Konqueror press control+shift on the right side of the keyboard.
This is more or less a display issue, no data is modified - so writing a test for D7 is IMHO a waste of bits.
Comment #11
elcuco commentedAny updates on this? This patch is very trivial and it's still not applied. Are you having any problems? How can I help?
Comment #12
good_man commented@Dries: There is not patch for this, it's UI thing, just changing the direction of content type machine name field, because it's always Latin characters i.e. always should be LTR.
Reproduce:
- Enable locale, add RTL language e.g. Arabic
- Go to content type edit page, click on edit machine name, the text field is RTL where it should be always LTR because it's only Latin characters allowed.
The above patches are ready for D7 and D6, the attached patch for D8.
All please for every RTL issue try to provide screenshots, before and after to see the difference.
Comment #13
catchComment #14
xjmComment #15
xjmSorry, first title was a bit anglocentric. :)
Comment #15.0
xjmUpdated issue summary.
Comment #16
xjmAdded issue summary. The D8 patch needs to be rerolled/renamed so it goes through testbot, and I'm sure the D6 and D7 versions are stale by now. We should also check for whether there are other machine name fields that need this fix.
Comment #17
xjmTesting D8 patch. Edit: This patch also applies cleanly to D7.
Comment #18
xjmMaybe this should just be added to the type defaults in
form_process_machine_name()? Edit: got it.Comment #19
xjmI count five core machine name fields that all should have this setting, so it seems reasonable to make it a default.
Please review and test the attached variant, which merges ltr directionality into the element defaults for all machine name fields. Specific forms may still override this.
I confirmed that it correctly makes the machine name field ltr under rtl languages for all five core forms that have this field type:
Comment #19.0
xjmMarkup fail.
Comment #19.1
xjmProposed a more global solution.
Comment #19.2
xjmLink to API function in patch.
Comment #19.3
xjmUpdated tasks.
Comment #19.4
xjmMore markup fail.
Comment #20
xjmD6 doesn't have the machine_name field type, so here's the original D6 patch, rerolled for current codebase.
Comment #21
xjmTagging novice for review and manual testing. Follow the steps to reproduce from the summary both with and without the patch for all five of the forms mentioned in #19, and note the change. You can post (cropped) before and after screenshots to illustrate the change.
Since three people active on this issue speak a RTL language I believe it's clear that the change itself is desired for RTL UX, so we just need to review the latest patch from a technical perspective.
Comment #22
good_man commented#19: all-machine-names-381994-19.patch queued for re-testing.
Comment #24
good_man commentedRerolled for D8 /core. Also attached D7 patch. D6 is in #20.
Comment #25
good_man commentedScreenshots of the five areas mentioned #19. They are the only areas (in core) that have machinename. So manual testing them is a guarantee that it's working.
Comment #26
xjmThanks @good_man!
Comment #27
xjmOops, forgot this was my patch, so I can't RTBC it. :P
Anyone else can, though! The reroll above looks fine to me, and the screenshots demonstrate the solution works.
Comment #28
xjmtim.plunkett suggested this simpler version.
Comment #29
xjmAnd just confirming that the revised code works the same way:

Comment #30
tim.plunkettLooks good to me.
Comment #31
catchAny reason we shouldn't add a test for this?
Comment #32
gábor hojtsyWhat would the test do? Ensure that machine names have the LTR direction set regardless of page direction? Not sure this is the complexity level we should test for. Its a "one line" change in the FAPI function for machine names...
Comment #33
xjmIt didn't occur to me to test it, but looking in locale's tests, I guess it wouldn't be too hard to add. I'll write one.
Comment #34
xjmComment #35
gábor hojtsyLooks like as complete test coverage as possible. :) Thanks!
Comment #35.0
gábor hojtsyMissed step in instructions.
Comment #36
catchThanks for the test, looks great. Committed/pushed to 8.x. Moving back to 7.x for backport.
Comment #37
xjmSo I could not reroll this patch and had to recreate it manually, because of differences in the next test's docblock between D7 and D8. So, NR.
Comment #39
xjmAh, the form has also changed. I noticed this earlier but forgot. So the test will need to be adjusted as well.
Comment #40
xjmJust changing the name of the select box to its D7 version.
Comment #41
gábor hojtsyLooks good to me.
Comment #42
webchickCommitted and pushed to 7.x. Thanks!
Moving down to 6.x.
Comment #43
gábor hojtsyTagging for base language system.
Comment #43.0
gábor hojtsyUpdated issue summary.