class-wpml-tm-troubleshooting-reset-pro-trans-config-ui.php
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
class WPML_TM_Troubleshooting_Reset_Pro_Trans_Config_UI {
const TROUBLESHOOTING_RESET_PRO_TRANS_TEMPLATE = 'reset-pro-trans-config.twig';
/**
* Template service.
*
* @var IWPML_Template_Service
*/
private $template_service;
/**
* WPML_TM_Troubleshooting_Reset_Pro_Trans_Config_UI constructor.
*
* @param IWPML_Template_Service $template_service WPML_Twig_Template twig service.
*/
public function __construct( IWPML_Template_Service $template_service ) {
$this->template_service = $template_service;
}
/**
* Returns of template service render result.
*
* @return string
*/
public function show() {
return $this->template_service->show( $this->get_model(), self::TROUBLESHOOTING_RESET_PRO_TRANS_TEMPLATE );
}
/**
* Returns model array for Troubleshooting Reset Pro Trans.
*
* @return array
*/
private function get_model() {
$translation_service_name = TranslationProxy::get_current_service_name();
if ( ! $translation_service_name ) {
$translation_service_name = 'PRO';
$alert_2 = __( 'Only select this option if you have no pending jobs or you are sure of what you are doing.', 'wpml-translation-management' );
} else {
if ( ! TranslationProxy::has_preferred_translation_service() ) {
/* translators: Reset professional translation state ("%1$s" is the service name) */
$alert_2 = sprintf( __( 'If you have sent content to %1$s, you should cancel the projects in %1$s system. Any work that completes after you do this reset cannot be received by your site.', 'wpml-translation-management' ), $translation_service_name );
} else {
$alert_2 = __( 'Any work that completes after you do this reset cannot be received by your site.', 'wpml-translation-management' );
}
}
$model = array(
'strings' => array(
'title' => __( 'Reset professional translation state', 'wpml-translation-management' ),
'alert1' => __( 'Use this feature when you want to reset your translation process. All your existing translations will remain unchanged. Any translation work that is currently in progress will be stopped.', 'wpml-translation-management' ),
'alert2' => $alert_2,
/* translators: Reset professional translation state ("%1$s" is the service name) */
'checkBoxLabel' => sprintf( __( 'I am about to stop any ongoing work done by %1$s.', 'wpml-translation-management' ), $translation_service_name ),
'button' => __( 'Reset professional translation state', 'wpml-translation-management' ),
),
'placeHolder' => 'icl_reset_pro',
);
return $model;
}
}