class-wpml-tp-job-states.php
1.1 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
<?php
class WPML_TP_Job_States {
const RECEIVED = 'received';
const WAITING_TRANSLATIONS = 'waiting_translation';
const TRANSLATION_READY = 'translation_ready';
const DELIVERED = 'delivered';
const CANCELLED = 'cancelled';
const ANY = 'any';
/**
* @return array
*/
public static function get_possible_states() {
return array(
self::RECEIVED,
self::WAITING_TRANSLATIONS,
self::TRANSLATION_READY,
self::DELIVERED,
self::CANCELLED,
self::ANY,
);
}
/**
* @return string
*/
public static function get_default_state() {
return self::WAITING_TRANSLATIONS;
}
/**
* @return array
*/
public static function get_finished_states() {
return array(
self::TRANSLATION_READY,
self::DELIVERED,
self::CANCELLED,
);
}
public static function map_tp_state_to_local( $tp_state ) {
switch ( $tp_state ) {
case self::TRANSLATION_READY:
case self::DELIVERED:
return ICL_TM_TRANSLATION_READY_TO_DOWNLOAD;
case self::CANCELLED:
return ICL_TM_NOT_TRANSLATED;
default:
return ICL_TM_IN_PROGRESS;
}
}
}