forked from zed-industries/zed
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add I18n support example by use rust-i18n #3
Draft
huacnlee
wants to merge
3
commits into
main
Choose a base branch
from
i18n
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
huacnlee
changed the title
Draft I18n support
Draft I18n support example by use rust-i18n
Jun 1, 2024
huacnlee
added a commit
to longbridge/rust-i18n
that referenced
this pull request
Jun 3, 2024
Based on real world uses: huacnlee/zed#3 Update example to embed I18n in single crate, and share it in entire workspace.
huacnlee
pushed a commit
that referenced
this pull request
Nov 7, 2024
Closes zed-industries#17388 Release Notes: - N/A We are using gpui to build a project, and we want to render SVGs with the `<text>` tag. We use `resvg` and `usvg` with the same version as gpui, like `0.41.0`. However, when we enable the feature `text`, we get an error from `usvg`. ```shell error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> /Users/madcodelife/.cargo/git/checkouts/zed-23e65a6dff445450/e681a4b/crates/gpui/src/svg_renderer.rs:49:20 | 49 | let tree = usvg::Tree::from_data(bytes, &usvg::Options::default())?; | ^^^^^^^^^^^^^^^^^^^^^---------------------------------- argument #3 of type `&Database` is missing | ``` This error occurs because when the `text` feature is enabled, the `form_data` function needs an extra argument, `fontdb`. [The code is here](https://github.com/linebender/resvg/blob/fb7e28513f561ed847acbf4a6fb8b743474837a0/crates/usvg/src/parser/mod.rs#L98). They changed the API in version [`0.42.0`](https://github.com/linebender/resvg/blob/b1d06e9463a3b089fbd70e7c38aebbfc811311ff/crates/usvg/src/parser/mod.rs#L98). So, I updated the versions to the latest (0.44.0). This is our demo: ## Before: <img width="620" alt="image" src="https://github.com/user-attachments/assets/7c71f8b1-e5fe-4e60-8f21-bb3bd9924e03"> ## After: <img width="620" alt="image" src="https://github.com/user-attachments/assets/4b0a0602-928f-4017-b5df-859eeb5f6b4a">
huacnlee
changed the title
Draft I18n support example by use rust-i18n
Add I18n support example by use rust-i18n
Nov 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce
Use the rust-i18n crate (This is implemented by myself) to add I18n support to Zed.
Tasks
i18n
crate into zed workspace, to manage locales load, and export rust_i18n method again.i18n::t
macro to get translate text.locale
settings to set the UI language.locales
from Zed workdir, for support to install other locales at the Zed runtime from Zed server (like an extension).t!
macro.Screenshot
Ref: