-
Notifications
You must be signed in to change notification settings - Fork 300
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
yauheni/79513/no language redirection from derivapp #6824
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import React from 'react'; | ||
import { getStaticUrl, PlatformContext } from '@deriv/shared'; | ||
import { getStaticUrl, PlatformContext, setUrlLanguage } from '@deriv/shared'; | ||
import { getLanguage } from '@deriv/translations'; | ||
|
||
const StaticUrl = ({ href, is_document, children, ...props }) => { | ||
const { is_appstore } = React.useContext(PlatformContext); | ||
setUrlLanguage(getLanguage()); | ||
|
||
return ( | ||
<a href={getStaticUrl(href, { is_appstore }, is_document)} rel='noopener noreferrer' target='_blank' {...props}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <a href={getHref()} rel='noopener noreferrer' target='_blank' {...props}> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The anchor tag is what the StaticUrl component renders. So does it make a diff between your suggestion and @yauheni-kryzhyk-deriv's implementation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, there is no differences, just a little bit different approach. |
||
|
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 need to call this func synchronously, as getStaticUrl func uses language variable in the same scope
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.
this way we'll set a correct language right at the moment when link href is set 😊 please check if it works)
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.
Actually, this is one of my variants for implementation :) . But on the whole it is the same synchronous code, which is executed with rendering.
So there are no differences :)
But I like this as it looks like more clear. will implement 👍