Skip to content

Commit

Permalink
Merge pull request #251 from patcon/feature/translate-comment-explorer
Browse files Browse the repository at this point in the history
Allow opinion group comment explorer to show auto-translations
  • Loading branch information
metasoarous committed Aug 10, 2021
2 parents e9c8cac + b343442 commit c94df3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit c94df3e

Please sign in to comment.