-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ensure FAQ questions are always internationalized #1475
Conversation
const { previewOptions } = faq; | ||
if (previewOptions) { | ||
FaqsWithPreviewContent.push({ ...faq, previewOptions }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super weird that this appears to be the most TypeScript-friendly way to create this array. You'd think we could just say if (faq.previewOptions) FaqsWithPreviewContent.push(faq)
but that doesn't work. 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, odd!
results.sort( | ||
(faq1, faq2) => | ||
faq1.previewOptions.priorityInPreview - | ||
faq2.previewOptions.priorityInPreview | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this is so much simpler to read!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This looks good to me, and it's great that you were able to address some of the readability concerns along the way.
Awesome, thanks Sam! |
While browsing the site with garbled translations active, I noticed that FAQ questions in the preview section weren't garbled:
It looks like this was happening because
li18n._()
was being called in top-level module code infaqs-content.tsx
, so I wrapped it all in a function.While I was at it, I also potentially simplified the sorting of the FAQs with preview content, I'm not sure though. I think code-wise it might be more code, but I think it's also potentially more readable. Feedback welcome @sraby!