# Keyboard shortcuts direction

**URL:** https://meta.discourse.org/t/keyboard-shortcuts-direction/117182
**Category:** Translations
**Tags:** keyboard-shortcuts
**Created:** [May 8, 2019, 3:18pm UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182 "2019-05-08T15:18:58Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![yaron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yaron/32/119812_2.png) [@yaron](https://meta.discourse.org/u/yaron)
#### Post date: [May 8, 2019, 3:18pm UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/1 "2019-05-08T15:18:58Z")

</div>

Hi,  
I ran into the translation of the keyboard shortcuts (g h is home,etc.).

Two issues I’d like to cover:

1. Is there an option to translate the key bindings?
2. In RTL they it looks different than LTR since it’s two characters in LTR and then RTL, so the user might think the key bindings are h g instead of g h, is there a way to make is more comprehensive for Hebrew/Arabic/Farsi etc.?

EDIT: The text there is Z + Shift instead of Shift + Z for example.

Thank you!

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 8, 2019, 10:25pm UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/2 "2019-05-08T22:25:07Z")

</div>

> [@yaron](#):
>
> Is there an option to translate the key bindings?

No, there isn’t. The shortcuts were carefully selected so they do not clash with any browser shortcuts. And we mostly use shortcuts similar to other popular web apps like Gmail.

> [@yaron](#):
>
> the user might think the key bindings are h g instead of g h

This is what I’m seeing when I switch to Hebrew:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/e/b/ebdc96ee38fd5acb57ee5d807a684bf71e006eee.png)

Would replacing the comma with an arrow help? You could change that on [Transifex](http://transifex.com/discourse/discourse-org).  
Home h ← g

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 9, 2019, 5:27am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/3 "2019-05-09T05:27:01Z")

</div>

No, it’s not printing correctly for Hebrew, and I imagine Arabic as well. It gets very confusing when you rearrange English like this; it’s unexpected—we never flip English.

It should be:

GH בית

I assume Arabic has the same issue, @Osama? Maybe you can sort this out.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [May 9, 2019, 7:13am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/6 "2019-05-09T07:13:51Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/3X/e/2/e26e15848824ce262e3811a2ca2395bbacc8eb01.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/f/6fc72c651f6497afdcc77b4214ea5148d221d507.png)

I got the correct order by applying `direction: ltr;` to the rows, but to me this doesn’t seem like the right fix here. I looked at the translation files and I noticed this:

> <https://github.com/discourse/discourse/blob/d1860536bc4b1e3beb67bc132adb1f22a8554c4a/config/locales/client.ar.yml#L2456-L2459>

In the translation file the order is correct, but when `direction: rtl;` is applied the order is flipped and it appears as if RTL was never applied.

So unless I’m misunderstanding something here, this seems to be a translation error? I could special-case the keyboard shortcuts but I worry there might be other places with similar problems.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 9, 2019, 8:22am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/7 "2019-05-09T08:22:59Z")

</div>

Hmmm this is a tricky pickle. We could pull `<b>g</b>, <b>h</b>` out of the translation I guess to make this less confusing. But then there is a giant amount of new translations to do.

I guess if `he`, `ar` and `fr_IR` all made the same mistake already we might as well just special case this.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [May 9, 2019, 9:04am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/8 "2019-05-09T09:04:05Z")

</div>

Persian and Urdu have the same problem as well. I’m going to apply LTR on the keyboard shortcuts for now, and see if there are other places with the same problem.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 9, 2019, 9:38am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/9 "2019-05-09T09:38:17Z")

</div>

The technical correct solution would be to use the `<bdi>` HTML tag, but [browser support](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi#Browser_compatibility) is really bad. ☹

```html
בית <bdi><b>g</b>, <b>h</b></bdi>

```

In Chrome it looks like this:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/c/0/c05dfbeb20fcb953d213d7d3c5a25d5af32e014a.png)

The following produces the same result and should be [supported in all browsers](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir#Browser_compatibility):

```html
בית <span dir="ltr"><b>g</b>, <b>h</b></span>

```

---

<div class="post-metadata">

### Author: ![matotubol](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@matotubol](https://meta.discourse.org/u/matotubol)
#### Post date: [May 9, 2019, 10:19am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/10 "2019-05-09T10:19:32Z")

</div>

> **[unicode-bidi CSS property - CSS | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/unicode-bidi)**
>
> The unicode-bidi CSS property, together with the direction property, determines how bidirectional text in a document is handled. For example, if a block of content contains both left-to-right and right-to-left text, the user-agent uses a complex...

maybe this will help?

---

<div class="post-metadata">

### Author: ![yaron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yaron/32/119812_2.png) [@yaron](https://meta.discourse.org/u/yaron)
#### Post date: [May 12, 2019, 3:32pm UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/15 "2019-05-12T15:32:04Z")

</div>

Doesn’t change the fact that it doesn’t work so well on other browsers 🙂

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 12, 2019, 11:11pm UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/16 "2019-05-12T23:11:09Z")

</div>

We are going to sort this out, discussing with @gerhard and @Osama what the best fix is.

Probably going to just break the translation into 2 pieces (English and non-English) so the value no longer has `<b>g</b>, <b>h</b>` in it. The reason this will take a tiny bit is cause we want to use the transifex API to correct all the already translated stuff so we don’t force translators to work through all keyboard shortcuts again.

---

<div class="post-metadata">

### Author: ![yaron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yaron/32/119812_2.png) [@yaron](https://meta.discourse.org/u/yaron)
#### Post date: [May 13, 2019, 4:00am UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/17 "2019-05-13T04:00:55Z")

</div>

My general approach is that if the keys cannot be translated anyways they should not be nominated for translation, except for the Shift+X case where “Shift” key name might be different in other languages.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [June 26, 2019, 7:55pm UTC](https://meta.discourse.org/t/keyboard-shortcuts-direction/117182/18 "2019-06-26T19:55:54Z")

</div>

This was fixed a while ago.

> [@yaron](#):
>
> except for the Shift+X case where “Shift” key name might be different in other languages.

We have now translations for modifier keys in `client.en.yml` which you can translate via Transifex.

> <https://github.com/discourse/discourse/blob/50e4ecc77ef1b878642120c69f05705d820ebeeb/config/locales/client.en.yml#L1487-L1491>
