# Translating Key Tokens to text

**URL:** <https://discourse.glfw.org/t/translating-key-tokens-to-text/600>\
**Category:** support\
**Created:** [August 7, 2013, 11:15am UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600 "2013-08-07T11:15:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 7, 2013, 11:15am UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/1 "2013-08-07T11:15:49Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Wednesday, August 07, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#cd1e):

I need to be able to prompt users with the correct key names to press for actions, and also to allow them to configure their key bindings and display the correct key name rather than the Key Token.

I can’t see this functionality present in GLFW 3, and it would be very useful. I’d be willing to help program and test this if it was thought an appropriate addition to GLFW.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 7, 2013, 4:22pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/2 "2013-08-07T16:22:09Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Wednesday, August 07, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#33b6):

This is a planned feature for 3.x. I’d welcome a pull request for this. Here’s an initial design:

```
GLFWAPI const char* glfwGetKeyName(int key);
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 7, 2013, 4:36pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/3 "2013-08-07T16:36:36Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Wednesday, August 07, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#3913):

Great, thanks - I’ll look into this next week (busy this week), starting with Windows which I’m more familiar with for this. Anyone with any hints on links to documentation on Linux/OS X feel free to post on this thread.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 7, 2013, 4:50pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/4 "2013-08-07T16:50:49Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Wednesday, August 07, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#d2a0):

[XKB](http://www.x.org/wiki/XKB/) for X.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 14, 2013, 12:36pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/5 "2013-08-14T12:36:47Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Wednesday, August 14, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#48f1):

I have a working Windows version here: [https://github.com/dougbinks/glfw/commit/f4ed02f6c87d2689cb313c1911d846c0f6f1f7cc](https://github.com/dougbinks/glfw/commit/f4ed02f6c87d2689cb313c1911d846c0f6f1f7cc)

Note that I’ve not yet put stub functions in for the other OSs, but will move on to this and then the OS X and Linux implementations.

The Windows function may need to be changed if this issue is resolved: [https://github.com/glfw/glfw/issues/114](https://github.com/glfw/glfw/issues/114)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 14, 2013, 12:42pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/6 "2013-08-14T12:42:34Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Wednesday, August 14, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#d957):

Stub methods for OS X and Linux now in: [https://github.com/dougbinks/glfw/commit/6edcc75a6bbe6f358a2ba5d5101c6872472cc211](https://github.com/dougbinks/glfw/commit/6edcc75a6bbe6f358a2ba5d5101c6872472cc211)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 14, 2013, 3:17pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/7 "2013-08-14T15:17:47Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Wednesday, August 14, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#2b8f):

OS X / Cocoa version now working: [https://github.com/dougbinks/glfw/commit/9c68e11f2fee44b867bf4d2291399a1915bfd08d](https://github.com/dougbinks/glfw/commit/9c68e11f2fee44b867bf4d2291399a1915bfd08d)

Note this adds a dependency to Carbon framework, so have added this to CMakelists.txt.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 15, 2013, 4:43pm UTC](https://discourse.glfw.org/t/translating-key-tokens-to-text/600/8 "2013-08-15T16:43:10Z")

</div>

**[dougbinks](https://sourceforge.net/u/dougbinks/)** wrote on [Thursday, August 15, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/c9bd5374/#cb85):

I’ve now completed this on X11 and also updated the Windows and Cocoa versions to be more consistent.
