diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/StatusFilter.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/StatusFilter.java index c0d8baa316..5b86390163 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/StatusFilter.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/StatusFilter.java @@ -55,5 +55,7 @@ public enum StatusFilter { /** TextUnits with status ({@link TMTextUnitVariant.Status#OVERRIDDEN}). */ OVERRIDDEN, /** TextUnits with status (@link TMTextUnitVariant.Status#MT_TRANSLATED}). */ - MT_TRANSLATED + MT_TRANSLATED, + /** TextUnits with status (@link TMTextUnitVariant.Status#MT_REVIEW_NEEDED}). */ + MT_REVIEW_NEEDED, } diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/TextUnitSearcher.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/TextUnitSearcher.java index 18882d854e..85999c4dff 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/TextUnitSearcher.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/search/TextUnitSearcher.java @@ -420,6 +420,11 @@ NativeCriteria getCriteriaForSearch(TextUnitSearcherParameters searchParameters) conjunction.add( new NativeEqExpFix("tuv.status", TMTextUnitVariant.Status.MT_TRANSLATED.toString())); break; + case MT_REVIEW_NEEDED: + conjunction.add( + new NativeEqExpFix( + "tuv.status", TMTextUnitVariant.Status.MT_REVIEW_NEEDED.toString())); + break; case TRANSLATED: conjunction.add(NativeExps.isNotNull("tuv.id")); break; diff --git a/webapp/src/main/resources/properties/en.properties b/webapp/src/main/resources/properties/en.properties index 224a9c8796..e809162bb8 100644 --- a/webapp/src/main/resources/properties/en.properties +++ b/webapp/src/main/resources/properties/en.properties @@ -225,6 +225,12 @@ search.statusDropdown.yes=Yes # Search filter option label to indicate that the filter is inactive search.statusDropdown.no=No +# Search filter option label to search for text units that are machine translated +search.statusDropdown.machineTranslated=Machine Translated + +# Search filter option label to search for text units that are machine translated and sent for review +search.statusDropdown.mtReviewNeeded=MT Review Needed + # label displayed alternately if the "loading" image used during pagination is not available search.pagination.isLoading=Loading... @@ -325,6 +331,12 @@ workbench.shareSearchParamsModal.errors.copyToClipboard=Can't copy the URL to th # Label for the Review button on the modal in the workbench textUnit.reviewModal.rejected=Rejected +# Label for the MT review button on the modal in the workbench +textUnit.reviewModal.mtReview=MT Review Needed + +# Label for the Machine Translated button on the modal in the workbench +textUnit.reviewModal.mt=Machine Translated + # Button label used for primary action "removeReview" on modal dialog textUnit.reviewModal.accepted=Accepted diff --git a/webapp/src/main/resources/public/js/components/widgets/StatusGlyph.js b/webapp/src/main/resources/public/js/components/widgets/StatusGlyph.js index 8c129f4e40..6ae02f14d6 100644 --- a/webapp/src/main/resources/public/js/components/widgets/StatusGlyph.js +++ b/webapp/src/main/resources/public/js/components/widgets/StatusGlyph.js @@ -14,6 +14,8 @@ class StatusGlyph extends React.Component { TextUnitSDK.STATUS.APPROVED, TextUnitSDK.STATUS.REVIEW_NEEDED, TextUnitSDK.STATUS.TRANSLATION_NEEDED, + TextUnitSDK.STATUS.MACHINE_TRANSLATED, + TextUnitSDK.STATUS.MT_REVIEW_NEEDED, TextUnitSDK.STATUS.REJECTED]).isRequired, "onClick": PropTypes.func.isRequired, "noButton" : PropTypes.bool, @@ -33,6 +35,12 @@ class StatusGlyph extends React.Component { case TextUnitSDK.STATUS.TRANSLATION_NEEDED: glyph = {type: 'edit', title: this.props.intl.formatMessage({id: "textUnit.reviewModal.translationNeeded"})}; break; + case TextUnitSDK.STATUS.MACHINE_TRANSLATED: + glyph = {type: 'asterisk', title: this.props.intl.formatMessage({id: "textUnit.reviewModal.mt"})}; + break; + case TextUnitSDK.STATUS.MT_REVIEW_NEEDED: + glyph = {type: 'hourglass', title: this.props.intl.formatMessage({id: "textUnit.reviewModal.mtReview"})}; + break; case TextUnitSDK.STATUS.REJECTED: glyph = {type: 'alert', title: this.props.intl.formatMessage({id: "textUnit.reviewModal.rejected"})}; break; diff --git a/webapp/src/main/resources/public/js/components/workbench/StatusDropdown.js b/webapp/src/main/resources/public/js/components/workbench/StatusDropdown.js index 5481e3085a..023c5f6364 100644 --- a/webapp/src/main/resources/public/js/components/workbench/StatusDropdown.js +++ b/webapp/src/main/resources/public/js/components/workbench/StatusDropdown.js @@ -166,6 +166,10 @@ let StatusDropdown = createReactClass({ return this.props.intl.formatMessage({ id: "search.statusDropdown.untranslated" }); case SearchParamsStore.STATUS.FOR_TRANSLATION: return this.props.intl.formatMessage({ id: "search.statusDropdown.forTranslation" }); + case SearchParamsStore.STATUS.MACHINE_TRANSLATED: + return this.props.intl.formatMessage({ id: "search.statusDropdown.machineTranslated" }); + case SearchParamsStore.STATUS.MT_REVIEW_NEEDED: + return this.props.intl.formatMessage({ id: "search.statusDropdown.mtReviewNeeded" }); case SearchParamsStore.STATUS.REVIEW_NEEDED: return this.props.intl.formatMessage({ id: "search.statusDropdown.needsReview" }); case SearchParamsStore.STATUS.REJECTED: @@ -263,6 +267,8 @@ let StatusDropdown = createReactClass({ {this.renderStatusMenuItem(SearchParamsStore.STATUS.TRANSLATED)} {this.renderStatusMenuItem(SearchParamsStore.STATUS.UNTRANSLATED)} {this.renderStatusMenuItem(SearchParamsStore.STATUS.FOR_TRANSLATION)} + {this.renderStatusMenuItem(SearchParamsStore.STATUS.MACHINE_TRANSLATED)} + {this.renderStatusMenuItem(SearchParamsStore.STATUS.MT_REVIEW_NEEDED)} {this.renderStatusMenuItem(SearchParamsStore.STATUS.REVIEW_NEEDED)} {this.renderStatusMenuItem(SearchParamsStore.STATUS.REJECTED)} {this.renderStatusMenuItem(SearchParamsStore.STATUS.OVERRIDDEN)} diff --git a/webapp/src/main/resources/public/js/components/workbench/TextUnit.js b/webapp/src/main/resources/public/js/components/workbench/TextUnit.js index 228dd4bd25..faf4e85df3 100644 --- a/webapp/src/main/resources/public/js/components/workbench/TextUnit.js +++ b/webapp/src/main/resources/public/js/components/workbench/TextUnit.js @@ -438,7 +438,15 @@ let TextUnit = createReactClass({ let glyphType = "ok"; let glyphTitle = this.props.intl.formatMessage({id: "textUnit.reviewModal.accepted"}); - if (!this.props.textUnit.isIncludedInLocalizedFile()) { + if (this.props.textUnit.getStatus() === TextUnitSDK.STATUS.MACHINE_TRANSLATED) { + glyphType = "asterisk"; + glyphTitle = this.props.intl.formatMessage({id: "textUnit.reviewModal.mt"}); + } + else if (this.props.textUnit.getStatus() === TextUnitSDK.STATUS.MT_REVIEW_NEEDED) { + glyphType = "hourglass"; + glyphTitle = this.props.intl.formatMessage({id: "textUnit.reviewModal.mtReview"}); + } + else if (!this.props.textUnit.isIncludedInLocalizedFile()) { glyphType = "alert"; glyphTitle = this.props.intl.formatMessage({id: "textUnit.reviewModal.rejected"}); diff --git a/webapp/src/main/resources/public/js/components/workbench/TextUnitsReviewModal.js b/webapp/src/main/resources/public/js/components/workbench/TextUnitsReviewModal.js index a83fd067ed..2eb8be7640 100644 --- a/webapp/src/main/resources/public/js/components/workbench/TextUnitsReviewModal.js +++ b/webapp/src/main/resources/public/js/components/workbench/TextUnitsReviewModal.js @@ -19,6 +19,8 @@ class TextUnitsreviewModal extends React.Component { super(props, context); this.REVIEW = "review"; this.REJECT = "reject"; + this.MACHINE_TRANSLATED = "machine translated"; + this.MT_REVIEW = "mt review needed"; this.ACCEPT = "accept"; this.TRANSLATE = "translate" this.OVERRIDDEN = "overridden"; @@ -29,6 +31,10 @@ class TextUnitsreviewModal extends React.Component { }; } + isMTState = () => { + return this.state.currentReviewState === this.MACHINE_TRANSLATED || this.state.currentReviewState === this.MT_REVIEW; + } + /** * Sets the state of the component to the button that was clicked upon. * @param {string} reviewState @@ -67,20 +73,50 @@ class TextUnitsreviewModal extends React.Component { getRejectButton = () => { return ( ); }; + /** + * @returns {JSX} The JSX for the MT review button with class active set according to the current component state + */ + getMTReviewNeededButton = () => { + return ( + + ); + }; + + /** + * @returns {JSX} The JSX for the Machine Translated button with class active set according to the current component state + */ + getMTButton = () => { + return ( + + ); + }; + /** * @returns {JSX} The JSX for the review button with class active set according to the current component state */ getReviewButton = () => { return ( @@ -93,7 +129,8 @@ class TextUnitsreviewModal extends React.Component { getAcceptButton = () => { return ( @@ -103,7 +140,8 @@ class TextUnitsreviewModal extends React.Component { getOverriddenButton = () => { return ( ); @@ -115,7 +153,8 @@ class TextUnitsreviewModal extends React.Component { getTranslateButton = () => { return ( @@ -170,7 +209,13 @@ class TextUnitsreviewModal extends React.Component { let currentReviewState = ""; if (typeof textUnit !== "undefined") { currentReviewState = this.ACCEPT; - if (!textUnit.isIncludedInLocalizedFile()) { + if (textUnit.getStatus() === TextUnit.STATUS.MACHINE_TRANSLATED) { + currentReviewState = this.MACHINE_TRANSLATED; + } + else if (textUnit.getStatus() === TextUnit.STATUS.MT_REVIEW_NEEDED) { + currentReviewState = this.MT_REVIEW; + } + else if (!textUnit.isIncludedInLocalizedFile()) { currentReviewState = this.REJECT; } else if (textUnit.getStatus() === TextUnit.STATUS.REVIEW_NEEDED) { currentReviewState = this.REVIEW; @@ -226,6 +271,8 @@ class TextUnitsreviewModal extends React.Component { {this.getRejectButton()} {this.getTranslateButton()} + {this.getMTButton()} + {this.getMTReviewNeededButton()} {this.getReviewButton()} {this.getAcceptButton()} {this.getOverriddenButton()} @@ -234,7 +281,7 @@ class TextUnitsreviewModal extends React.Component {