-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(i18n): nav dropdown language selector #91
Conversation
// TODO i18n text | ||
text: 'Languages', |
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 text also needs i18n
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.
DONE
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.
Thank you so much for the feature! Looking really good!
I have 2 requests.
Currently, VuePress locale config sits inside themeConfig
. Would it be possible to move the new configs under there instead of locales
?
{
themeConfig: {
locales: {
'/': {
label: 'English',
selectText: 'Languages',
editLinkText: 'Edit this page on GitHub',
},
...
}
}
Ref: https://vuepress.vuejs.org/guide/i18n.html#default-theme-i18n-config
- Can we move i18n dropdown before GitHub repo link at Nav?
@@ -7,6 +7,7 @@ | |||
</template> | |||
</template> | |||
<NavBarLink v-if="repoInfo" :item="repoInfo" /> | |||
<NavDropdownLink v-if="localeCandidates" :item="localeCandidates" /> |
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.
Lets move this one above the GitHub repo nav 🙏
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.
Moved!
@kiaking About first request, I didn't notice vitepress( and vuepress) has two kinds of locales in config...! Now, this selector will use |
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 a lot! Just one more thing. I found a bug that this PR will not work on configs that does not contain any locales info. Please see the inline comment I made 🙏
@kiaking I have to think of any every case of config, or have to write test code. 😅 |
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.
Great! Thanks a lot. Tested at my side and it is working well 🙌
At #50, @antfu implemented i18n support, and said.
I created that!
Working config is like this
(To set config about site title, description, and lang, you have to use global locale config. Check #50)