utility = $utility; $this->dismissNotices = $dismissNotices; } public function getAll() { $isCurrentUserOnlyTranslator = $this->utility->isTheOnlyAvailableTranslator(); return [ 'jobs_sent_to_local_translator' => $this->jobsSentToLocalTranslator(), 'jobs_emails_local_did_not_sent' => $this->emailNotSentError(), 'jobs_committed' => $isCurrentUserOnlyTranslator ? $this->jobsSentToCurrentUserWhoIsTheOnlyTranslator() : $this->jobsSentDefaultMessage(), 'jobs_committing' => __( 'Working...', 'wpml-translation-management' ), 'error_occurred' => __( 'An error occurred:', 'wpml-translation-management' ), 'error_not_allowed' => __( 'You are not allowed to run this action.', 'wpml-translation-management' ), 'batch' => __( 'Batch', 'wpml-translation-management' ), 'error_no_translators' => __( 'No selected translators!', 'wpml-translation-management' ), 'rollbacks' => __( 'Rollback jobs...', 'wpml-translation-management' ), 'rolled' => __( 'Batch rolled back', 'wpml-translation-management' ), 'errors' => __( 'Errors:', 'wpml-translation-management' ), 'sending_batch' => $isCurrentUserOnlyTranslator ? __( 'Preparing your content for translation', 'wpml-translation-management' ) : __( 'Sending your jobs to translation', 'wpml-translation-management' ), 'sending_batch_to_ts' => __( 'Sending your jobs to professional translation', 'wpml-translation-management' ), ]; } /** * @return string */ public function duplicatePostTranslationWarning() { $message = esc_html_x( 'You are about to translate duplicated posts.', '1/2 Confirm to disconnect duplicates', 'wpml-translation-management' ); $message .= "\n"; $message .= esc_html_x( 'These items will be automatically disconnected from originals, so translation is not lost when you update the originals.', '2/2 Confirm to disconnect duplicates', 'wpml-translation-management' ); return $message; } /** * @return string */ public function jobsSentToLocalTranslator() { $translation_dashboard_url = admin_url( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php' ); $translation_dashboard_text = esc_html__( 'Translation Dashboard', 'wpml-translation-management' ); $translation_dashboard_link = '' . $translation_dashboard_text . ''; $translation_notifications_url = admin_url( 'admin.php?page=' . WPML_TM_FOLDER . \WPML_Translation_Management::PAGE_SLUG_SETTINGS . '&sm=notifications' ); $translation_notifications_text = esc_html__( 'WPML->Settings->Translation notifications', 'wpml-translation-management' ); $translation_notifications_link = '' . $translation_notifications_text . ''; $template = '
%1$s
%s
%s %s
', __( 'Ready!', 'wpml-translation-management' ), /* translators: This text is followed by 'Translation Queue'. eg To translate those jobs, go to the Translation Queue */ __( 'To translate those jobs, go to ', 'wpml-translation-management' ), admin_url( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/translations-queue.php' ), __( 'WPML->Translation Queue', 'wpml-translation-management' ) ) . $this->automaticTranslationTip(); } /** * @return string */ private function automaticTranslationTip() { if ( $this->dismissNotices->isDismissed( self::ATE_AUTOMATIC_TRANSLATION_SUGGESTION ) || ! \WPML_TM_ATE_Status::is_enabled_and_activated() ) { return ''; } $template = "%s
%s %s
' . esc_html__( 'Ready!', 'wpml-translation-management' ) . '
'; $message .= ''; $message .= sprintf( esc_html__( 'You can check the status of these jobs in %s.', 'wpml-translation-management' ), $this->getJobsLink() ); $message .= '
'; return $message; } /** * @return string */ private function getJobsLink() { $url = admin_url( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=jobs' ); $text = esc_html__( 'WPML->Translation Jobs', 'wpml-translation-management' ); $link = '' . $text . ''; return $link; } private function getToolsLink() { $url = admin_url( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=ate-ams' ); $text = esc_html__( 'WPML->Translation Management->Translation Tools', 'wpml-translation-management' ); $link = '' . $text . ''; return $link; } /** * @return string */ public function emailNotSentError() { return '