template_service = $template_service; } /** * @param array $jobs * * @return string */ public function get_notice_body( $jobs ) { $model = $this->get_notice_model( $jobs ); return $this->template_service->show( $model, self::TEMPLATE_FILE ); } /** * @param array $jobs * * @return array */ private function get_notice_model( $jobs ) { $translators_tab = 'admin.php?page=wpml-translation-management/menu/main.php&sm=translators'; $jobs_formatted = $this->get_formatted_jobs( $jobs ); $model = array( 'strings' => array( 'title' => esc_html__( 'Translations may delay because translators did not receive notifications', 'wpml-translation-management' ), 'body' => esc_html__( 'You have sent documents to translation. WPML can send notification emails to assigned translators, but translators for some languages have selected not to receive this notification.', 'wpml-translation-management' ), 'jobs' => $jobs_formatted, 'bottom' => sprintf( esc_html__( 'You should contact your %1$s and ask them to enable the notification emails which will allow them to see when there is new work waiting for them. To enable notifications, translators need to log-in to this site, go to their user profile page and change the related option in the WPML language settings section.', 'wpml-translation-management' ), '' . esc_html__( 'translators' ) . ' ' ), ), ); return $model; } /** * @param array $jobs * * @return array */ private function get_formatted_jobs( $jobs ) { $jobs_formatted = array(); foreach ( $jobs as $job ) { $jobs_formatted[] = sprintf( __( 'Job %1$s: %2$s - %3$s', 'wpml-translation-management' ), $job['job_id'], $job['lang_from'], $job['lang_to'] ); } return $jobs_formatted; } }