# gpui: Introduce \`PlatformKeyboardLayout\` trait for human-friendly keyboard layout names \(\#29049\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f0ef3110d3f54c0cbe4ee3d920cdaecd81efde78)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f0ef3110d3f54c0cbe4ee3d920cdaecd81efde78

Requested commit: f0ef3110d3f54c0cbe4ee3d920cdaecd81efde78

Commit: f0ef3110d3f54c0cbe4ee3d920cdaecd81efde78

Tree: 1aa306613b3dc5bca80daec8ae9ef41f1b32fb8d

Author: 张小白

Committer: GitHub

## Message

```
gpui: Introduce `PlatformKeyboardLayout` trait for human-friendly keyboard layout names (#29049)

This PR adds a new `PlatformKeyboardLayout` trait with two methods:
`id(&self) -> &str` and `name(&self) -> &str`. The `id()` method returns
a unique identifier for the keyboard layout, while `name()` provides a
human-readable name. This distinction is especially important on
Windows, where the `id` and `name` can be quite different. For example,
the French layout has an `id` of `0000040C`, which is not
human-readable, whereas the `name` would simply be `French`. Currently,
the existing `keyboard_layout()` method returns what's essentially the
same as `id()` in this new design.

This PR implements the `name()` method for both Windows and macOS. On
Linux, for now, `name()` still returns the same value as `id()`.

Release Notes:

- N/A
```

## Parents

- [0454e7a22e7d4df8914604c3fa29c930d0e54f3c](https://git.cafe/gitcafe/zed/commit/0454e7a22e7d4df8914604c3fa29c930d0e54f3c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f0ef3110d3f54c0cbe4ee3d920cdaecd81efde78?format=markdown)
