Skip to content
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

Merged
merged 2 commits into from
Oct 25, 2024
Merged

Conversation

HiDeoo
Copy link
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)

Copy link

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
Copy link

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
Collaborator

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.

@@ -2,10 +2,18 @@
import { Icon } from '@astrojs/starlight/components';
import { Icons } from '../../../packages/starlight/components/Icons';

interface Props {
labels?: {
Copy link
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.

@@ -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!' }} />
Copy link
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.

const icons = Object.keys(Icons) as (keyof typeof Icons)[];
---

<div class="icons-grid">
<div class="icons-grid" data-label-copied={copied}>
Copy link
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
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
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 🙌

@delucis delucis merged commit b56ccc6 into withastro:main Oct 25, 2024
16 checks passed
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