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
isLangRightToLeft function not using language config setting #10259
Conversation
✅ ethereum-org-website-dev deploy preview ready
|
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.
@corwintines Pretty sure our build error is related to using the hrefLang
instead of the code
property... in the case of Filipino we'd be looking for fil
but this doesn't exist and would result in the array being empty, and [0] wouldn't work.
src/utils/translations.ts
Outdated
return lang === "ar" || lang === "fa" | ||
const langConfig = i18nConfigs.filter( | ||
(language) => language.hrefLang === lang | ||
) |
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.
We may also want to guard (or throw an error) against the case where our filtered array is empty (no matches)
Maybe:
if (!langConfig.length) throw new Error("Language code not found")
or
if (!langConfig.length) return "rtl"
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.
I think ill do the first one with throwing an error. Think this would make it easier to debug as this would be an issue. Thanks for the suggestion
Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
Description
isLangRightToLeft
function to use a languages config for lang direction instead of being hardcoded values for langauges.Related Issue
Fixes #10258