PluginProbe
ManageWP Worker / 3.9.23
ManageWP Worker v3.9.23
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / lib / google-api-client / contrib / Google_TranslateService.php

Google_TranslateService.php in ManageWP Worker 3.9.23, at lib/google-api-client/contrib/Google_TranslateService.php

245 lines 8.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 * use this file except in compliance with the License. You may obtain a copy of
5 * the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 * License for the specific language governing permissions and limitations under
13 * the License.
14 */
15
16
17 /**
18 * The "languages" collection of methods.
19 * Typical usage is:
20 * <code>
21 * $translateService = new Google_TranslateService(...);
22 * $languages = $translateService->languages;
23 * </code>
24 */
25 class Google_LanguagesServiceResource extends Google_ServiceResource {
26
27
28 /**
29 * List the source/target languages supported by the API (languages.list)
30 *
31 * @param array $optParams Optional parameters.
32 *
33 * @opt_param string target the language and collation in which the localized results should be returned
34 * @return Google_LanguagesListResponse
35 */
36 public function listLanguages($optParams = array()) {
37 $params = array();
38 $params = array_merge($params, $optParams);
39 $data = $this->__call('list', array($params));
40 if ($this->useObjects()) {
41 return new Google_LanguagesListResponse($data);
42 } else {
43 return $data;
44 }
45 }
46 }
47
48 /**
49 * The "detections" collection of methods.
50 * Typical usage is:
51 * <code>
52 * $translateService = new Google_TranslateService(...);
53 * $detections = $translateService->detections;
54 * </code>
55 */
56 class Google_DetectionsServiceResource extends Google_ServiceResource {
57
58
59 /**
60 * Detect the language of text. (detections.list)
61 *
62 * @param string $q The text to detect
63 * @param array $optParams Optional parameters.
64 * @return Google_DetectionsListResponse
65 */
66 public function listDetections($q, $optParams = array()) {
67 $params = array('q' => $q);
68 $params = array_merge($params, $optParams);
69 $data = $this->__call('list', array($params));
70 if ($this->useObjects()) {
71 return new Google_DetectionsListResponse($data);
72 } else {
73 return $data;
74 }
75 }
76 }
77
78 /**
79 * The "translations" collection of methods.
80 * Typical usage is:
81 * <code>
82 * $translateService = new Google_TranslateService(...);
83 * $translations = $translateService->translations;
84 * </code>
85 */
86 class Google_TranslationsServiceResource extends Google_ServiceResource {
87
88
89 /**
90 * Returns text translations from one language to another. (translations.list)
91 *
92 * @param string $q The text to translate
93 * @param string $target The target language into which the text should be translated
94 * @param array $optParams Optional parameters.
95 *
96 * @opt_param string source The source language of the text
97 * @opt_param string format The format of the text
98 * @opt_param string cid The customization id for translate
99 * @return Google_TranslationsListResponse
100 */
101 public function listTranslations($q, $target, $optParams = array()) {
102 $params = array('q' => $q, 'target' => $target);
103 $params = array_merge($params, $optParams);
104 $data = $this->__call('list', array($params));
105 if ($this->useObjects()) {
106 return new Google_TranslationsListResponse($data);
107 } else {
108 return $data;
109 }
110 }
111 }
112
113 /**
114 * Service definition for Google_Translate (v2).
115 *
116 * <p>
117 * Lets you translate text from one language to another
118 * </p>
119 *
120 * <p>
121 * For more information about this service, see the
122 * <a href="http://code.google.com/apis/language/translate/v2/using_rest.html" target="_blank">API Documentation</a>
123 * </p>
124 *
125 * @author Google, Inc.
126 */
127 class Google_TranslateService extends Google_Service {
128 public $languages;
129 public $detections;
130 public $translations;
131 /**
132 * Constructs the internal representation of the Translate service.
133 *
134 * @param Google_Client $client
135 */
136 public function __construct(Google_Client $client) {
137 $this->servicePath = 'language/translate/';
138 $this->version = 'v2';
139 $this->serviceName = 'translate';
140
141 $client->addService($this->serviceName, $this->version);
142 $this->languages = new Google_LanguagesServiceResource($this, $this->serviceName, 'languages', json_decode('{"methods": {"list": {"httpMethod": "GET", "response": {"$ref": "LanguagesListResponse"}, "id": "language.languages.list", "parameters": {"target": {"type": "string", "location": "query"}}, "path": "v2/languages"}}}', true));
143 $this->detections = new Google_DetectionsServiceResource($this, $this->serviceName, 'detections', json_decode('{"methods": {"list": {"httpMethod": "GET", "response": {"$ref": "DetectionsListResponse"}, "id": "language.detections.list", "parameters": {"q": {"repeated": true, "required": true, "type": "string", "location": "query"}}, "path": "v2/detect"}}}', true));
144 $this->translations = new Google_TranslationsServiceResource($this, $this->serviceName, 'translations', json_decode('{"methods": {"list": {"httpMethod": "GET", "response": {"$ref": "TranslationsListResponse"}, "id": "language.translations.list", "parameters": {"q": {"repeated": true, "required": true, "type": "string", "location": "query"}, "source": {"type": "string", "location": "query"}, "format": {"enum": ["html", "text"], "type": "string", "location": "query"}, "target": {"required": true, "type": "string", "location": "query"}, "cid": {"repeated": true, "type": "string", "location": "query"}}, "path": "v2"}}}', true));
145
146 }
147 }
148
149 class Google_DetectionsListResponse extends Google_Model {
150 protected $__detectionsType = 'Google_DetectionsResourceItems';
151 protected $__detectionsDataType = 'array';
152 public $detections;
153 public function setDetections(/* array(Google_DetectionsResourceItems) */ $detections) {
154 $this->assertIsArray($detections, 'Google_DetectionsResourceItems', __METHOD__);
155 $this->detections = $detections;
156 }
157 public function getDetections() {
158 return $this->detections;
159 }
160 }
161
162 class Google_DetectionsResourceItems extends Google_Model {
163 public $isReliable;
164 public $confidence;
165 public $language;
166 public function setIsReliable($isReliable) {
167 $this->isReliable = $isReliable;
168 }
169 public function getIsReliable() {
170 return $this->isReliable;
171 }
172 public function setConfidence($confidence) {
173 $this->confidence = $confidence;
174 }
175 public function getConfidence() {
176 return $this->confidence;
177 }
178 public function setLanguage($language) {
179 $this->language = $language;
180 }
181 public function getLanguage() {
182 return $this->language;
183 }
184 }
185
186 class Google_LanguagesListResponse extends Google_Model {
187 protected $__languagesType = 'Google_LanguagesResource';
188 protected $__languagesDataType = 'array';
189 public $languages;
190 public function setLanguages(/* array(Google_LanguagesResource) */ $languages) {
191 $this->assertIsArray($languages, 'Google_LanguagesResource', __METHOD__);
192 $this->languages = $languages;
193 }
194 public function getLanguages() {
195 return $this->languages;
196 }
197 }
198
199 class Google_LanguagesResource extends Google_Model {
200 public $name;
201 public $language;
202 public function setName($name) {
203 $this->name = $name;
204 }
205 public function getName() {
206 return $this->name;
207 }
208 public function setLanguage($language) {
209 $this->language = $language;
210 }
211 public function getLanguage() {
212 return $this->language;
213 }
214 }
215
216 class Google_TranslationsListResponse extends Google_Model {
217 protected $__translationsType = 'Google_TranslationsResource';
218 protected $__translationsDataType = 'array';
219 public $translations;
220 public function setTranslations(/* array(Google_TranslationsResource) */ $translations) {
221 $this->assertIsArray($translations, 'Google_TranslationsResource', __METHOD__);
222 $this->translations = $translations;
223 }
224 public function getTranslations() {
225 return $this->translations;
226 }
227 }
228
229 class Google_TranslationsResource extends Google_Model {
230 public $detectedSourceLanguage;
231 public $translatedText;
232 public function setDetectedSourceLanguage($detectedSourceLanguage) {
233 $this->detectedSourceLanguage = $detectedSourceLanguage;
234 }
235 public function getDetectedSourceLanguage() {
236 return $this->detectedSourceLanguage;
237 }
238 public function setTranslatedText($translatedText) {
239 $this->translatedText = $translatedText;
240 }
241 public function getTranslatedText() {
242 return $this->translatedText;
243 }
244 }
245