-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gpui: Update Menu name to use SharedString
type to support more types
#14791
gpui: Update Menu name to use SharedString
type to support more types
#14791
Conversation
Sorry, I meant to submit a post on my fork first, then create a discussion to see if this suggestion is accepted, but I accidentally created it here. Let's discuss it here. |
I want to change the name type of Menu because I tried to add I18n support to Zed before, and used the rust-i18n crate that I implemented. The Here is a draft: Or sometime we use GPUI to create app, the Menu name may be a dynamic string that created in runtime, but by current design we can't store it to Menu, so I want to change the type of Menu name to Cow. |
Cow<'a, str>
to support more types.Cow<'a, str>
to support more types
c2a9722
to
b9c909a
Compare
crates/gpui/src/platform/app_menu.rs
Outdated
@@ -6,7 +6,7 @@ use util::ResultExt; | |||
/// A menu of the application, either a main menu or a submenu | |||
pub struct Menu<'a> { | |||
/// The name of the menu | |||
pub name: &'a str, | |||
pub name: Cow<'a, str>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we considered using a SharedString
here?
That type is more commonly used in GPUI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SharedString
is ok, it can handle same things.
Cow<'a, str>
to support more typesSharedString
type to support more types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this seems like a useful thing to have!
@maxdeviant And I have almost done the I18n support for Zed. Are there any plans to introduce this support at this stage? After the introduction, we need to keep using This may increase the workload of Zed development. |
We haven't really discussed it internally yet, but my guess is that it's probably a ways off. |
Okay, I'll put it aside for now. |
Release Notes: