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

Prevent title from being translated #2762

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Jan 7, 2025

Description

This PR adds the translate attribute to the header site title to indicates that the element must not be translated.

Although not all browsers recognize this attribute, it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. As such it's important that web authors use this attribute to mark content that should not be translated.

For example, commenting the logo configuration option in the Astro config of the Starlight Docs and asking Google Translate to translate the English version of the website to French will result in the following:

SCR-20250107-ovfr

After this PR, the header site title will no longer be translated:

SCR-20250107-ovia

Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: a838afc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit a838afc
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/677d4ffd9340c90008d3a969
😎 Deploy Preview https://deploy-preview-2762--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: 100 (no change 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.

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Jan 7, 2025
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.

Interesting! I hadn’t encountered this attribute yet.

At first I wondered if this might be undesirable in some cases if you had a title that was not a brand name — if it was a descriptive phrase like “Pancake Recipes” or something, maybe someone would like to have that auto-translated to “Recettes de crêpes”. That said, I looked through our site showcase and thought a bit about Starlight users, and I think this would only very rarely cause issues most likely, so I think it could be a reasonable change.

@HiDeoo
Copy link
Member Author

HiDeoo commented Jan 7, 2025

I think this would only very rarely cause issues most likely, so I think it could be a reasonable change.

Yeah, had the same question since this was reported to me and concluded like you that in the Starlight context, this would very likely almost never have an undesirable effect. 👍

@delucis delucis added the 🌟 patch Change that triggers a patch release label Jan 7, 2025
@delucis delucis merged commit 7ab1576 into withastro:main Jan 7, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants