-
Notifications
You must be signed in to change notification settings - Fork 896
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
add qwant support #654
add qwant support #654
Conversation
language check based on ISO-639-1. ref https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes |
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.
logic looks 👍
@@ -18,12 +20,23 @@ interface Props { | |||
} | |||
|
|||
export default class NewPrivateTab extends React.PureComponent<Props, {}> { | |||
get isQwant () { | |||
return navigator.language === 'de' || navigator.language === 'fr' |
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.
Nit: This can be a static const defined at the module level, since it does not rely on any props or anything to do with the component
@@ -35,7 +48,7 @@ export default class NewPrivateTab extends React.PureComponent<Props, {}> { | |||
render () { | |||
const { isTor } = this.props | |||
return ( | |||
<Page isPrivate={!isTor}> | |||
<Page isPrivate={!isTor && !this.isQwant}> |
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.
It's not private if it's de
or fr
language?
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 is just to change the background color. I should have written isDefaultPrivate
but need to level up my naming game :P
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.
@cezaraugusto that's ok, when things calm down we should look to improve some naming all around the webui's
@cezaraugusto Is there a brave-browser issue with a milestone this can go against? |
I think brave/brave-browser#1607 is the issue in question. |
Just building for testing before merging since we're on RC |
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.
Did not work for me. I still saw DDG in FR context. Note that for me, when I changed language, my navigator.language was 'fr-FR'. I suspect we need to parse this a bit smarter, or use some other property.
Follow up to make qwant pref detection more robust brave/brave-browser#1632 |
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.
Fixed language detection via startsWith
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.
Definitely would have been nice to do this properly in C++... but I think the scope of that change is too large. We'll have to talk with @mkarolin (details captured in brave/brave-browser#1632)
Tested this PR as-is though and it does work as expected. I tested on macOS using French 😄
Fix brave/brave-browser#1607
(adds qwant to new tab page for private mode in certain locales)