message.class.php
4.7 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/**
* Goodao Translate Automate
* http://www.Goodao.cn/
*
* LICENSE
*
* @package /license/ WP Translate
* @copyright Copyright (c) Goodao.cn
* @license http://www.Goodao.cn
* @version 1.1
* @date 2017-04-14
*/
class PrisnaWPTranslateAutomateMessage {
private static $_list = array(
/*
* Main Entries
*/
'plugin_title' => 'Goodao Translate Automate',
'general_tab' => 'General',
'settings_link' => 'Settings',
'plugin_api_key_validate' => 'Invalid API key',
'automate_to_title' => 'Languages',
'automate_to_description' => 'Selects languages to translate the specified resources below.',
'automate_source_value_sitemap_title' => 'Sitemap URL',
'automate_source_value_sitemap_description' => 'Specifies the location of the sitemap. If the website doesn\'t currently have a sitemap, there are a number of plugins to create one:<br/><br /><a href="https://wordpress.org/plugins/search.php?q=sitemap" target="_blank">https://wordpress.org/plugins/search.php?q=sitemap</a>',
'automate_source_value_url_title' => 'URL list',
'automate_source_value_url_description' => 'Defines a list of the URLs to be automatically translated. One URL per line. URLs can be either absolute or relative path.',
'automate_source_value_category_title' => 'Category',
'automate_source_value_category_description' => 'Specifies a category to select the resources to translate.',
'automate_retranslate_url_title' => 'Already translated URL behavior',
'automate_retranslate_url_description' => 'Sets what kind of operation will be performed if a URL has been translated before. If <em>re-translate</em> is selected, then only non translated strings will translated.',
'automate_retranslate_url_retranslate' => 'Re-translate',
'automate_retranslate_url_skip' => 'Skip',
'automate_summary' => 'Summary',
'automate_source_title' => 'Resources',
'automate_source_description' => 'Sets what kind of source will be used identify the list of URLs to translate.',
'automate_source_sitemap' => 'Sitemap',
'automate_source_url' => 'URL list',
'automate_source_category' => 'Category',
'automate_timeout_title' => 'Timeout',
'automate_timeout_description' => 'Sets the maximum time a translation can take. After such time, the current resource will be skipped and the process will continue with the next one.',
'automate_next' => 'Next',
'automate_back' => 'Back',
'automate_run' => 'Run',
'automate_stop' => 'Stop',
'automate_stopping' => 'Stopping',
'automate_continue' => 'Continue',
'automate_queued' => 'Queued',
'automate_processing' => 'Processing',
'automate_translating' => 'Translating',
'automate_saving' => 'Saving',
'automate_done' => 'Done',
'automate_timed_out' => 'Timed out',
'automate_loading' => 'Loading',
'automate_saving_translations_from' => 'Saving translations from',
'automate_language' => 'Language',
'automate_resource' => 'Resource',
'automate_url_behavior' => 'URL behavior',
'automate_timeout' => 'Timeout',
'automate_unit_ms' => 'seconds',
'automate_skipped_url' => 'Skipped. This resource has been translated before.',
'automate_hostname_match_error' => 'Skipped. Host name doesn\'t match: [0] != [1]',
'key_not_found' => '<span style="color: red;">Message for "[0]" not found!</span>'
);
public static function getDirect($_key, $_domain=null) {
if (is_null($_domain))
$_domain = PrisnaWPTranslateAutomateConfig::getAdminLanguageDomain();
return __($_key, $_domain);
}
public static function genPo() {
foreach (self::$_list as $key => $message)
if ($message != '') {
$translated = str_replace('\'', '\\\'', self::get($key, array(), null, true));
echo "echo _('$translated');\n";
}
}
public static function get($_key, $_new_values_array=array(), $_domain=null, $_mo=false) {
if (is_null($_domain))
$_domain = PrisnaWPTranslateAutomateConfig::getAdminLanguageDomain();
if (!is_array($_new_values_array))
$_new_values_array = array($_new_values_array);
if (array_key_exists($_key, self::$_list))
$result = is_array(self::$_list[$_key]) ? self::$_list[$_key][0] : self::$_list[$_key];
else
$result = PrisnaWPTranslateCommon::mergeText(self::$_list['key_not_found'], $_key);
$result = __($result, $_domain);
if (count($_new_values_array) > 0)
$result = PrisnaWPTranslateCommon::mergeText($result, $_new_values_array);
// add images
if (array_key_exists($_key, self::$_list) && is_array(self::$_list[$_key])) {
$params = self::$_list[$_key];
$params = array_splice($params, 1);
$result = PrisnaWPTranslateCommon::mergeImages($result, $params, PRISNA_WP_TRANSLATE_IMAGES . '/admin/');
}
return $result;
}
}
?>