diff --git a/app/static/app/js/components/AssetDownloadButtons.jsx b/app/static/app/js/components/AssetDownloadButtons.jsx index 37f0d734..f06893fa 100644 --- a/app/static/app/js/components/AssetDownloadButtons.jsx +++ b/app/static/app/js/components/AssetDownloadButtons.jsx @@ -2,6 +2,7 @@ import React from 'react'; import '../css/AssetDownloadButtons.scss'; import AssetDownloads from '../classes/AssetDownloads'; import PropTypes from 'prop-types'; +import { _ } from '../classes/gettext'; class AssetDownloadButtons extends React.Component { static defaultProps = { @@ -29,7 +30,7 @@ class AssetDownloadButtons extends React.Component { return (
{this.props.showLabel ?
); @@ -515,35 +514,35 @@ class EditTaskForm extends React.Component { value={this.state.selectedPreset.id} onChange={this.handleSelectPreset}> {this.state.presets.map(preset => - + )} {!this.state.presetActionPerforming ?
-
@@ -554,7 +553,7 @@ class EditTaskForm extends React.Component { taskOptions = (
- +
- + +
); } } diff --git a/app/static/app/js/components/ImagePopup.jsx b/app/static/app/js/components/ImagePopup.jsx index f1f1fbe8..50ad0664 100644 --- a/app/static/app/js/components/ImagePopup.jsx +++ b/app/static/app/js/components/ImagePopup.jsx @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import AssetDownloads from '../classes/AssetDownloads'; import '../css/ImagePopup.scss'; +import { _ } from '../classes/gettext'; class ImagePopup extends React.Component { static propTypes = { @@ -43,7 +44,7 @@ class ImagePopup extends React.Component { } imageOnError = () => { - this.setState({error: "Image is missing", loading: false}); + this.setState({error: _("Image is missing"), loading: false}); } imageOnLoad = () => { @@ -82,7 +83,7 @@ class ImagePopup extends React.Component {
,
- Download Image + {_("Download Image")}
]}
diff --git a/app/static/app/js/components/ImportTaskPanel.jsx b/app/static/app/js/components/ImportTaskPanel.jsx index a3d69300..72dc4ec6 100644 --- a/app/static/app/js/components/ImportTaskPanel.jsx +++ b/app/static/app/js/components/ImportTaskPanel.jsx @@ -5,6 +5,8 @@ import Dropzone from '../vendor/dropzone'; import csrf from '../django/csrf'; import ErrorMessage from './ErrorMessage'; import UploadProgressBar from './UploadProgressBar'; +import { _, interpolate } from '../classes/gettext'; +import Trans from './Trans'; class ImportTaskPanel extends React.Component { static defaultProps = { @@ -58,7 +60,7 @@ class ImportTaskPanel extends React.Component { }); this.dz.on("error", (file) => { - if (this.state.uploading) this.setState({error: "Cannot upload file. Check your internet connection and try again."}); + if (this.state.uploading) this.setState({error: _("Cannot upload file. Check your internet connection and try again.")}); }) .on("sending", () => { this.setState({typeUrl: false, uploading: true, totalCount: 1}); @@ -86,10 +88,10 @@ class ImportTaskPanel extends React.Component { if (!response.id) throw new Error(`Expected id field, but none given (${response})`); this.props.onImported(); }catch(e){ - this.setState({error: `Invalid response from server: ${e.message}`}); + this.setState({error: interpolate(_('Invalid response from server: %(error)s'), { error: e.message})}); } }else if (this.state.uploading){ - this.setState({uploading: false, error: "An error occured while uploading the file. Please try again."}); + this.setState({uploading: false, error: _("An error occured while uploading the file. Please try again.")}); } }); } @@ -133,11 +135,11 @@ class ImportTaskPanel extends React.Component { if (json.id){ this.props.onImported(); }else{ - this.setState({error: json.error || `Cannot import from URL, server responded: ${JSON.stringify(json)}`}); + this.setState({error: json.error || interpolate(_("Invalid JSON response: %(error)s"), {error: JSON.stringify(json)})}); } }) .fail(() => { - this.setState({importingFromUrl: false, error: "Cannot import from URL. Check your internet connection."}); + this.setState({importingFromUrl: false, error: _("Cannot import from URL. Check your internet connection.")}); }); } @@ -153,16 +155,16 @@ class ImportTaskPanel extends React.Component {
- -

Import Existing Assets

-

You can import .zip files that have been exported from existing tasks via Download Assets All Assets.

+ +

{_("Import Existing Assets")}

+

'}}>{_("You can import .zip files that have been exported from existing tasks via Download Assets %(arrow)s All Assets.")}

{this.state.typeUrl ? @@ -179,7 +181,7 @@ class ImportTaskPanel extends React.Component { + className="btn-import btn btn-primary"> {_("Import")}
: ""} @@ -189,7 +191,7 @@ class ImportTaskPanel extends React.Component { className="btn btn-danger btn-sm" onClick={this.cancelUpload}> - Cancel Upload + {_("Cancel Upload")}
: ""} diff --git a/app/static/app/js/components/LayersControlLayer.jsx b/app/static/app/js/components/LayersControlLayer.jsx index 45e912af..029c93ef 100644 --- a/app/static/app/js/components/LayersControlLayer.jsx +++ b/app/static/app/js/components/LayersControlLayer.jsx @@ -7,6 +7,7 @@ import Utils from '../classes/Utils'; import Workers from '../classes/Workers'; import ErrorMessage from './ErrorMessage'; import $ from 'jquery'; +import { _, interpolate } from '../classes/gettext'; export default class LayersControlLayer extends React.Component { static defaultProps = { @@ -245,7 +246,7 @@ export default class LayersControlLayer extends React.Component { }else if (result.error){ this.setState({exportLoading: false, error: result.error}); }else{ - this.setState({exportLoading: false, error: "Invalid response: " + result}); + this.setState({exportLoading: false, error: interpolate(_("Invalid JSON response: %(error)s"), {error: JSON.stringify(result)})}); } }).fail(error => { this.setState({exportLoading: false, error: JSON.stringify(error)}); @@ -283,7 +284,7 @@ export default class LayersControlLayer extends React.Component { {formula !== "" && algorithms ?
- +
{histogramLoading ? : @@ -295,7 +296,7 @@ export default class LayersControlLayer extends React.Component { {bands !== "" && algo ?
- +
{histogramLoading ? : @@ -307,7 +308,7 @@ export default class LayersControlLayer extends React.Component { {colorMap && color_maps.length ?
- +
{histogramLoading ? : @@ -319,18 +320,18 @@ export default class LayersControlLayer extends React.Component { {hillshade !== "" ?
- +
: ""}
- +
+ {this.state.upload.error}
: ""} diff --git a/app/static/app/js/components/TaskListItem.jsx b/app/static/app/js/components/TaskListItem.jsx index 292ffd0b..5cb75820 100644 --- a/app/static/app/js/components/TaskListItem.jsx +++ b/app/static/app/js/components/TaskListItem.jsx @@ -222,7 +222,7 @@ class TaskListItem extends React.Component { optionsToList(options){ if (!Array.isArray(options)) return ""; - else if (options.length === 0) return _("Default"); + else if (options.length === 0) return "Default"; else { return options.map(opt => `${opt.name}: ${opt.value}`).join(", "); } @@ -531,9 +531,7 @@ class TaskListItem extends React.Component { {showExitedWithCodeOneHints ?
- "Process exited with code 1" means that part of the processing failed. Sometimes it's a problem with the dataset, sometimes it can be solved by tweaking the Task Options and sometimes it might be a bug! - If you need help, upload your images somewhere like DroneDB or Google Drive and open a topic on our community forum, making - sure to include a copy of your task's output. Our awesome contributors will try to help you! + DroneDB`, link2: `Google Drive`, open_a_topic: `${_("open a topic")}`, }}>{_("\"Process exited with code 1\" means that part of the processing failed. Sometimes it's a problem with the dataset, sometimes it can be solved by tweaking the Task Options and sometimes it might be a bug! If you need help, upload your images somewhere like %(link1)s or %(link2)s and %(open_a_topic)s on our community forum, making sure to include a copy of your task's output. Our awesome contributors will try to help you!")}
: ""} @@ -579,12 +577,12 @@ class TaskListItem extends React.Component { if (task.last_error){ statusLabel = getStatusLabel(task.last_error, 'error'); }else if (!task.processing_node && !imported){ - statusLabel = getStatusLabel("Set a processing node"); + statusLabel = getStatusLabel(_("Set a processing node")); statusIcon = "fa fa-hourglass-3"; showEditLink = true; }else if (task.partial && !task.pending_action){ statusIcon = "fa fa-hourglass-3"; - statusLabel = getStatusLabel("Waiting for image upload..."); + statusLabel = getStatusLabel(_("Waiting for image upload...")); }else{ let progress = 100; let type = 'done'; diff --git a/app/static/app/js/components/Trans.jsx b/app/static/app/js/components/Trans.jsx index 76d9ed73..1bab1605 100644 --- a/app/static/app/js/components/Trans.jsx +++ b/app/static/app/js/components/Trans.jsx @@ -15,7 +15,8 @@ class Trans extends React.Component { if (!this.props.children) return (); let content = ""; - + console.log(this.props.children); + console.log(interpolate(this.props.children, this.props.params)); if (typeof this.props.children === "string"){ content = (); }else{ @@ -31,7 +32,7 @@ class Trans extends React.Component { i++; }); } - + console.log(content); return content; } } diff --git a/app/templates/app/dashboard.html b/app/templates/app/dashboard.html index 32cf4cb0..011fc360 100644 --- a/app/templates/app/dashboard.html +++ b/app/templates/app/dashboard.html @@ -33,8 +33,8 @@
  • {% trans 'You need at least 5 images' %}
  • {% trans 'Images must overlap by 65% or more' %}
  • -
  • {% trans 'For great 3D, images must overlap by 83%' %}
  • -
  • {% trans 'A GCP file is optional, but can increase georeferencing accuracy' %}
  • +
  • {% trans 'For great 3D, images must overlap by 83%' %}
  • +
  • {% blocktrans with link_start='' link_end='' %}A {{link_start}}GCP File{{link_end}} is optional, but can increase georeferencing accuracy{% endblocktrans %}

{% endif %}