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

  1. Enable locale.
  2. Add an RTL language, e.g. Arabic, and set it as the default language.
  3. Go to a content type edit page.
  4. 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.

Comments

elcuco’s picture

StatusFileSize
new816 bytes

Update patch to reflect D6.10

elcuco’s picture

Version: 6.9 » 6.10
yhager’s picture

Status: Needs review » Reviewed & tested by the community

trivial patch - works as described.

brianV’s picture

Version: 6.10 » 6.x-dev
StatusFileSize
new1.17 KB
new1.08 KB

Patch rerolled against D6 HEAD.

Also included D7 version.

gábor hojtsy’s picture

Version: 6.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Needs work

Needs more whitespace (one space at both before and after =>). Also, first get it committed to Drupal 7.

yhager’s picture

Status: Needs work » Needs review
StatusFileSize
new1.17 KB
new1.08 KB

here

elcuco’s picture

Status: Needs review » Reviewed & tested by the community

Yes, still the same code. Changing to "reviewed & tested by the community".

dries’s picture

Status: Reviewed & tested by the community » Needs work

How to reproduce this problem? Please clarify the problem -- you're only describing the solution.

Can we write a D7 test for it?

yhager’s picture

The 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.

elcuco’s picture

Sorry. 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.

elcuco’s picture

Any updates on this? This patch is very trivial and it's still not applied. Are you having any problems? How can I help?

good_man’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs work » Reviewed & tested by the community
StatusFileSize
new494 bytes
new19.95 KB
new19.97 KB

@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.

catch’s picture

xjm’s picture

Title: Content type input directionality set to LTR » Machine-name fields are always in English, and should therefore always be LTR
xjm’s picture

Title: Machine-name fields are always in English, and should therefore always be LTR » Machine-name fields are always in Latin characters, and should therefore always be LTR

Sorry, first title was a bit anglocentric. :)

xjm’s picture

Issue summary: View changes

Updated issue summary.

xjm’s picture

Added 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.

xjm’s picture

StatusFileSize
new494 bytes

Testing D8 patch. Edit: This patch also applies cleanly to D7.

xjm’s picture

Maybe this should just be added to the type defaults in form_process_machine_name()? Edit: got it.

xjm’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.19 KB

I 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:

  1. content types
  2. vocabularies
  3. menus
  4. input formats
  5. date types
xjm’s picture

Issue summary: View changes

Markup fail.

xjm’s picture

Issue summary: View changes

Proposed a more global solution.

xjm’s picture

Issue summary: View changes

Link to API function in patch.

xjm’s picture

Issue summary: View changes

Updated tasks.

xjm’s picture

Issue summary: View changes

More markup fail.

xjm’s picture

StatusFileSize
new847 bytes

D6 doesn't have the machine_name field type, so here's the original D6 patch, rerolled for current codebase.

xjm’s picture

Issue tags: +Novice, +Needs manual testing

Tagging 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.

good_man’s picture

Status: Needs review » Needs work
Issue tags: +RTL, +Needs backport to D6, +Novice, +Needs manual testing, +Needs backport to D7

The last submitted patch, all-machine-names-381994-19.patch, failed testing.

good_man’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB
new1.21 KB

Rerolled for D8 /core. Also attached D7 patch. D6 is in #20.

good_man’s picture

StatusFileSize
new17.6 KB
new15.87 KB
new23.98 KB
new16.14 KB
new31.74 KB

Screenshots 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.

xjm’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Novice, -Needs manual testing

Thanks @good_man!

xjm’s picture

Status: Reviewed & tested by the community » Needs review

Oops, 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.

xjm’s picture

StatusFileSize
new684 bytes

tim.plunkett suggested this simpler version.

xjm’s picture

StatusFileSize
new11.1 KB

And just confirming that the revised code works the same way:
machine-name.png

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Any reason we shouldn't add a test for this?

gábor hojtsy’s picture

Issue tags: +D8MI

What 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...

xjm’s picture

It 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.

xjm’s picture

StatusFileSize
new2.32 KB
new1.65 KB
gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks like as complete test coverage as possible. :) Thanks!

gábor hojtsy’s picture

Issue summary: View changes

Missed step in instructions.

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Thanks for the test, looks great. Committed/pushed to 8.x. Moving back to 7.x for backport.

xjm’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new2.27 KB

So 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.

Status: Needs review » Needs work

The last submitted patch, ltr-d7-381994-37.patch, failed testing.

xjm’s picture

Ah, the form has also changed. I noticed this earlier but forgot. So the test will need to be adjusted as well.

xjm’s picture

Status: Needs work » Needs review
StatusFileSize
new539 bytes
new2.26 KB

Just changing the name of the select box to its D7 version.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

webchick’s picture

Version: 7.x-dev » 6.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to 7.x. Thanks!

Moving down to 6.x.

gábor hojtsy’s picture

Issue tags: +language-base

Tagging for base language system.

gábor hojtsy’s picture

Issue summary: View changes

Updated issue summary.

Status: Patch (to be ported) » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.