File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,22 @@ class PoeditorTask extends Task
3232 protected $ token ;
3333
3434 /**
35- * ID of the project
35+ * Identifier of the project
3636 *
3737 * @var string
3838 */
3939 protected $ project ;
4040
41+ /**
42+ * @var string
43+ */
44+ protected $ id ;
45+
46+ /**
47+ * @var string
48+ */
49+ protected $ module ;
50+
4151 /**
4252 * Language code
4353 *
@@ -154,6 +164,11 @@ public function getProject()
154164 */
155165 public function setProject ($ project )
156166 {
167+ $ parts = explode ('- ' , $ project );
168+ if (count ($ parts ) > 1 ) {
169+ $ this ->module = ucfirst ($ parts [0 ]);
170+ $ this ->id = $ parts [1 ];
171+ }
157172 $ this ->project = $ project ;
158173 return $ this ;
159174 }
@@ -275,7 +290,7 @@ public function main()
275290
276291 protected function retrieveFileName ()
277292 {
278- return $ this ->getExportPath () . DIRECTORY_SEPARATOR . $ this ->languages [$ this ->getLanguage ()] . '. ' . $ this ->getType ();
293+ return $ this ->getExportPath () . DIRECTORY_SEPARATOR . ucfirst ( $ this -> project ) . DIRECTORY_SEPARATOR . ' language ' . DIRECTORY_SEPARATOR . $ this ->languages [$ this ->getLanguage ()] . '. ' . $ this ->getType ();
279294 }
280295
281296 /**
@@ -286,7 +301,7 @@ protected function getPostParams()
286301 return [
287302 'api_token ' => $ this ->getToken (),
288303 'action ' => 'export ' ,
289- 'id ' => $ this ->getProject () ,
304+ 'id ' => $ this ->id ,
290305 'type ' => $ this ->getType () ?: self ::DEFAULT_TYPE ,
291306 'language ' => $ this ->getLanguage (),
292307 ];
You can’t perform that action at this time.
0 commit comments