-
-
Notifications
You must be signed in to change notification settings - Fork 280
feat: Add a language drop-down menu in the Header component, including a link to Chinese documentation #1150
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
| }, [isOpen]) | ||
|
|
||
| return ( | ||
| <div className="relative language-selector"> |
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.
let's add some margin to the right of the selector
<div className="relative language-selector mr-6">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.
let's add some margin to the right of the selector
<div className="relative language-selector mr-6">
Done!
|
@dai-shi We'll need to figure out valtio.dev domain stuff. Right now, I think I'm still handling the nameservers for valtio.dev and am just redirecting. |
| </li> | ||
| <li> | ||
| <a | ||
| href="https://valtio-xnj9.vercel.app/zh" |
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.
This link will need to change to something like http://zh.valtio.dev or http://valtiio.dev/zh and then we'll need to configure the dns. Let's not change this yet until we get that sorted first though.
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.
I guess an alternative would be to make sure that the english link links back to the valtio.dev domain. RIght now, clicking on the new language will just redirect to the new domain and won't redirect back on change again. I think maybe the better solution here would be to make these absolute links to a new site instead of state change.
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.
This link will need to change to something like
http://zh.valtio.devorhttp://valtiio.dev/zhand then we'll need to configure the dns. Let's not change this yet until we get that sorted first though.
@overthemike
My opinion is no. We don't "host" non-English site, and it's not our responsibility. So, I prefer an external URL.
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.
RIght now, clicking on the new language will just redirect to the new domain
I think it should open a new window.
I think probably the easiest solution would be to just have me create a |
| </li> | ||
| <li> | ||
| <a | ||
| href="https://valtio-xnj9.vercel.app/zh" |
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.
I guess an alternative would be to make sure that the english link links back to the valtio.dev domain. RIght now, clicking on the new language will just redirect to the new domain and won't redirect back on change again. I think maybe the better solution here would be to make these absolute links to a new site instead of state change.
| > | ||
| 中文文档 | ||
| </a> | ||
| <Link href="/"> |
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.
Let's change this to <Link href='https://valtio.dev'> This way it will link back to the main site and stay up to date.
| {isOpen && ( | ||
| <div className="absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 rounded-md shadow-lg py-1 z-50 border border-gray-200 dark:border-gray-700"> | ||
| <a | ||
| href="https://valtio-xnj9.vercel.app/zh" |
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.
Let's change the href to be "https://zh/valtio.dev" and I'll create a zh subdomain on valtio.dev to point to this domain.
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.
@eveningwater I've already created the CNAME record to point here (just need to wait for propegation), but you'll want to change the root of your app to server chinese instead of english.
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.
** overthemike**
Can you help me check if my latest modification meets the requirements?thanks!
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.
@eveningwater Almost. Line 158 still needs updating to http://zh.valtio.dev I think.
On your end, you can replace all of the regular .mdx files with the .zh.mdx files and then make sure the default language there will be selected to be chinese.
Let's check back in a little while to make sure the subdomain is redirecting properly to your app while you're changing your default language on your end.
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.
@eveningwater Almost. Line 158 still needs updating to
http://zh.valtio.devI think.On your end, you can replace all of the regular .mdx files with the .zh.mdx files and then make sure the default language there will be selected to be chinese.
Let's check back in a little while to make sure the subdomain is redirecting properly to your app while you're changing your default language on your end.
Does my repo not need to display English documents? Can I just keep the Chinese documents?
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.
@eveningwater That is correct. No need to store the English docs as we store them here. Your github repos as well as your website call be all chinese docs and you can just link back for english.
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.
@eveningwater That is correct. No need to store the English docs as we store them here. Your github repos as well as your website call be all chinese docs and you can just link back for english.
Got it, thanks, I'll adjust it.
…and adding English docs link
|
@overthemike I redeployed it, the link is: https://valtio-nine.vercel.app/ |
ok. I updated the DNS record. |
|
@eveningwater Could you also add the flag svgs next to the languages? Here are the svgs for them both: China: USA: |
feat: remove the comment Co-authored-by: Daishi Kato <[email protected]>
|
I don't have much preference on it. If it's intentional, it's fine. |
|
To be honest, I'm not sure if "Language selector" is appropriate in our case. But, I'll leave it to @overthemike. |
You can check out the results by following this link.:https://valtio-git-fork-eveningwater-feature-branch-pmndrs.vercel.app/
|
I think language switching might be better on mobile devices, and documents in other languages may be added in the future.Please allow me to think about whether I need to adjust it. |
|
As far as the "Language" label, I think the most common thing to do is to do is to have the current language 2 letter code selected with the flag next to it. See Amazon for an example. I have some ideas on some changes for it. @eveningwater I'll clone down your fork and suggest some changes. |
ok,thanks. |
added some update suggestions
|
@eveningwater Please check CI errors. |
ok. |
Vercel Deployment has failed,I can't view the details to get the error,Shouldn't I check this? |
I can't see it either. If it's not temporarily, there might be something wrong. You might want to test building it on your end. |
- 格式化 Header.tsx 文件以符合 Prettier 规范 - 更新 .prettierignore 文件,忽略 .next、node_modules 和 build 目录 - 确保 pnpm run test:format 命令能够成功通过
b34982a to
51cf417
Compare
Sorry, it wasn't your fault. |
|
Is this ready for @overthemike for another review? |


Related Bug Reports or Discussions
add the drop-down mennu in the Header component.
Summary
Check List
pnpm run fixfor formatting and linting code and docs