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

Support translating default aside titles #517

Merged
merged 39 commits into from
Nov 17, 2023

Conversation

liruifengv
Copy link
Sponsor Member

@liruifengv liruifengv commented Aug 15, 2023

What kind of changes does this PR include?

  • Changes to Starlight code

Description

  • Make aside label canbe translate.

I added translations according to the astro docs, some are missing translations, en is used by default and needs to be updated

missing translations:

  • cs: Czech
  • da: Danish
  • fa: Farsi
  • gl: Galician
  • he: Hebrew
  • id: Bahasa Indonesia
  • nb: Norwegian Bokmål
  • nl: Dutch
  • ru: Russian
  • sv: Swedish
  • tr: Turkish
  • uk: Ukrainian
  • vi: Vietnamese

@changeset-bot
Copy link

changeset-bot bot commented Aug 15, 2023

🦋 Changeset detected

Latest commit: 27141e2

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 Minor

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

@github-actions github-actions bot added i18n Anything to do with internationalization & translation efforts 📚 docs Documentation website changes 🌟 core Changes to Starlight’s main package labels Aug 15, 2023
@netlify
Copy link

netlify bot commented Aug 15, 2023

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 69e7925
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/6545db17013d02000804fb8e
😎 Deploy Preview https://deploy-preview-517--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: 92 (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.

@liruifengv
Copy link
Sponsor Member Author

Sorry, I deleted the branch by mistake and caused #476 to be closed.

@delucis I have some questions, I don't know how to get the current language.

@liruifengv liruifengv marked this pull request as ready for review August 22, 2023 09:22
@liruifengv liruifengv changed the title [WIP] Make aside label canbe translate. Make aside's title can be translated. Aug 22, 2023
@liruifengv
Copy link
Sponsor Member Author

@delucis Hi Chris, Can we keep pushing this PR?

@delucis
Copy link
Member

delucis commented Sep 12, 2023

Hey @liruifengv — so sorry I haven’t had time to look at this yet. Promise I’ll get to this ASAP. Thank you again for pushing this — super helpful 💜

@delucis
Copy link
Member

delucis commented Nov 2, 2023

Hey @liruifengv! Sorry to take so long to get back on this one, but I think we’re finally ready to try to do this. In #1003 I made it possible for plugins like the asides one to more easily access the same translations system as other Starlight code.

I’ve updated this branch and you should now find useTranslations in packages/starlight/index.ts. You can pass this to the asides plugin and then in each locale do:

const t = useTranslations(locale);
const label = t('aside.note'); // or tip, danger etc.

Are you still interested on working on this? Let me know if not and I’ll take a look at cleaning up your work. Thanks again for your patience on this.

By the way, all the checks are failing because the aside translations are missing in languages added since you started this PR. Let me know if you need help tracking down the missing translations.

@liruifengv
Copy link
Sponsor Member Author

Hey @liruifengv! Sorry to take so long to get back on this one, but I think we’re finally ready to try to do this. In #1003 I made it possible for plugins like the asides one to more easily access the same translations system as other Starlight code.

I’ve updated this branch and you should now find useTranslations in packages/starlight/index.ts. You can pass this to the asides plugin and then in each locale do:

const t = useTranslations(locale);
const label = t('aside.note'); // or tip, danger etc.

Are you still interested on working on this? Let me know if not and I’ll take a look at cleaning up your work. Thanks again for your patience on this.

By the way, all the checks are failing because the aside translations are missing in languages added since you started this PR. Let me know if you need help tracking down the missing translations.

I'll take a look.

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.

Thanks again for the work and patience on this PR @liruifengv! I just made a last couple of changes and added some unit tests to make sure it’s working. LGTM!!! 🚀

Super excited to merge this finally. Thank you for championing it 🙌

@liruifengv
Copy link
Sponsor Member Author

liruifengv commented Nov 17, 2023

Thank you!

  1. Please note that some of the language was used the original English.
  2. I changed getting-started in this PR. this will cause the translation status to be reset. Maybe it shouldn't be included in this PR

@delucis
Copy link
Member

delucis commented Nov 17, 2023

  1. Please note that some of the language was used the original English.

I think this is ok as ALL languages currently get the English version by default anyway. My plan is to ask for help from the community to update these as soon as we merge.

  1. I changed getting-started in this PR. this will cause the translation status to be reset. Maybe it shouldn't be included in this PR

Ah, good catch! Thank you for flagging this. Yes, might be a good idea to remove that change and make it when updating the rest of the page.

@github-actions github-actions bot removed i18n Anything to do with internationalization & translation efforts 📚 docs Documentation website changes labels Nov 17, 2023
@liruifengv
Copy link
Sponsor Member Author

  1. Please note that some of the language was used the original English.

I think this is ok as ALL languages currently get the English version by default anyway. My plan is to ask for help from the community to update these as soon as we merge.

  1. I changed getting-started in this PR. this will cause the translation status to be reset. Maybe it shouldn't be included in this PR

Ah, good catch! Thank you for flagging this. Yes, might be a good idea to remove that change and make it when updating the rest of the page.

Done.

@delucis delucis changed the title Make aside's title can be translated. Support translating default aside titles Nov 17, 2023
@delucis delucis merged commit 5b549cb into withastro:main Nov 17, 2023
6 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Nov 17, 2023
@liruifengv liruifengv deleted the asides-i18n branch March 19, 2024 05:53
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants