-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
docs: i18n improvements #2505
docs: i18n improvements #2505
Conversation
|
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
@@ -2,10 +2,18 @@ | |||
import { Icon } from '@astrojs/starlight/components'; | |||
import { Icons } from '../../../packages/starlight/components/Icons'; | |||
|
|||
interface Props { | |||
labels?: { |
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 uses the same data structure used in the theme editor for labels which would be nice in case we ever need more labels in the future altho I guess an argument could be made to use a flat string property instead of an object in this case.
@@ -16,4 +16,4 @@ A list of all available icons is shown below with their associated names. Click | |||
|
|||
import IconsList from '~/components/icons-list.astro'; | |||
|
|||
<IconsList /> | |||
<IconsList labels={{ copied: 'Copied!' }} /> |
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.
Duplicated with the component default label but marks translations as outdated.
const icons = Object.keys(Icons) as (keyof typeof Icons)[]; | ||
--- | ||
|
||
<div class="icons-grid"> | ||
<div class="icons-grid" data-label-copied={copied}> |
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.
The "copied" label is added only once to the DOM and not for every icons.
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.
Perfect. We could even delegate the click handling here too I guess to avoid assigning a listener for every button? Doesn’t have to be in this PR 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.
Looks great! Tested a few pages including ones with fallback content and everything seems to be working as expected. Happy we can get this content translated properly too 🙌
Description
This PR implements tiny i18n related improvements for the documentation:
slugToLocaleData()
internal dependency in the languages list component in favor of usingAstro.currentLocale
.reference/icons
#2343 (review)