Skip to content

docs: i18n improvements#2505

Merged
delucis merged 2 commits intowithastro:mainfrom
HiDeoo:hd-docs-i18n-improvements
Oct 25, 2024
Merged

docs: i18n improvements#2505
delucis merged 2 commits intowithastro:mainfrom
HiDeoo:hd-docs-i18n-improvements

Conversation

@HiDeoo
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo commented Oct 23, 2024

Description

This PR implements tiny i18n related improvements for the documentation:

  • Removes the slugToLocaleData() internal dependency in the languages list component in favor of using Astro.currentLocale.
  • Adds a translatable "copied" label to the icons list as discussed in i18n(fr): add reference/icons #2343 (review)

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Oct 23, 2024

⚠️ No Changeset found

Latest commit: 5d3cc7a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added i18n Anything to do with internationalization & translation efforts 📚 docs Documentation website changes labels Oct 23, 2024
@netlify
Copy link
Copy Markdown

netlify bot commented Oct 23, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 5d3cc7a
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/6719077ebd8ed300085b5ed9
😎 Deploy Preview https://deploy-preview-2505--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (🔴 down 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
fr reference/icons.mdx Localization changed, will be marked as complete.
en reference/icons.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

import { Icons } from '../../../packages/starlight/components/Icons';

interface Props {
labels?: {
Copy link
Copy Markdown
Member Author

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.

import IconsList from '~/components/icons-list.astro';

<IconsList />
<IconsList labels={{ copied: 'Copied!' }} />
Copy link
Copy Markdown
Member Author

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.

---

<div class="icons-grid">
<div class="icons-grid" data-label-copied={copied}>
Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member

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!

Copy link
Copy Markdown
Member

@delucis delucis left a 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 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 docs Documentation website changes i18n Anything to do with internationalization & translation efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants