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

Allow opinion group comment explorer to show auto-translations #251

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client-participation/js/stores/polis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,7 @@ module.exports = function(params) {
}

function getFancyComments(options) {
options = $.extend(options, { translate: true, lang: navigator.language });
return $.when(getComments(options), votesForTidBidPromise).then(function(args /* , dont need second arg */ ) {

var comments = args[0];
Expand Down
11 changes: 11 additions & 0 deletions client-participation/vis2/components/exploreTid.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ class ExploreTid extends React.Component {
}
render() {
if (!this.props.selectedComment) {return null}
let translatedText = null;
if (this.props.selectedComment.translatedText) {
let lang = navigator.language;
if (lang.indexOf('-') > 0) {
lang = lang.split('-')[0];
// Do not need undefined check, will just not appear
translatedText = this.props.selectedComment.translatedText[lang];
}
}
return (
<div style={{
borderRadius: 4,
Expand Down Expand Up @@ -241,6 +250,8 @@ class ExploreTid extends React.Component {
fontFamily: "Georgia, serif",
}}>
{this.props.selectedComment ? this.props.selectedComment.txt : null}
{translatedText ? <hr/> : null}
{translatedText ? translatedText : null}
</p>
<DataSentence
math={this.props.math}
Expand Down