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

feat(v2): Extract/translate hardcoded labels from classic theme #4168

Merged
merged 2 commits into from
Feb 3, 2021

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Feb 3, 2021

Motivation

We want some theme hardcoded labels to be translated:

  • "edit this page"
  • pagination (next/previous, new post/old post...)
  • code block copy/copied
  • read more
  • ...

This is not yet an exhaustive list, some labels remain to be translated but are more complicated to handle:

  • labels with interleaved variables like "{time} min read time" or "last updated by {author} on {date}"...
  • date formatting
  • tags (we'll translate these when we have tags on docs and we have factorized a bit the theme code => less future i18n breaking changes)
  • ... probably others
  • we probably want to translate all hardcoded aria labels as well

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

tests + preview + i18n dogfooding

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Feb 3, 2021
@slorber slorber requested a review from lex111 as a code owner February 3, 2021 18:52
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 3, 2021
@netlify
Copy link

netlify bot commented Feb 3, 2021

[V1] Deploy preview success

Built with commit defd176

https://deploy-preview-4168--docusaurus-1.netlify.app

@github-actions
Copy link

github-actions bot commented Feb 3, 2021

Size Change: +15 B (0%)

Total Size: 156 kB

ℹ️ View Unchanged
Filename Size Change
website/build/assets/css/styles.********.css 17.7 kB 0 B
website/build/assets/js/main.********.js 109 kB +14 B (0%)
website/build/blog/2017/12/14/introducing-docusaurus/index.html 21.7 kB +1 B (0%)
website/build/docs/introduction/index.html 180 B 0 B
website/build/index.html 6.95 kB 0 B

compressed-size-action

@netlify
Copy link

netlify bot commented Feb 3, 2021

Deploy preview for docusaurus-2 ready!

Built with commit defd176

https://deploy-preview-4168--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Feb 3, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 65
🟢 Accessibility 99
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-4168--docusaurus-2.netlify.app/classic/

@slorber slorber merged commit ab79515 into master Feb 3, 2021
@lex111
Copy link
Contributor

lex111 commented Feb 3, 2021

Can we provide something like a language pack with messages already translated out-of-box (French/Russian for now)?

@slorber
Copy link
Collaborator Author

slorber commented Feb 4, 2021

@lex111 I'd like to but don't really have an idea on how to do that yet 😅 if you have an idea let me know.

Maybe the themes could have some kind of default translation packs or something? would probably require a new lifecycle api

@lex111
Copy link
Contributor

lex111 commented Feb 4, 2021

I was thinking just in the classic theme directory to add an i18n folder with code.json files for each supported locale, or is that a bad option? And if the user hasn't provided their translation of the message - we use the default localization from classic theme. We need to add "support for the code.json file" to themes, I suppose.

@lex111 lex111 added this to the v2.0.0-alpha.71 milestone Mar 1, 2021
This was referenced Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants