File tree 3 files changed +29
-0
lines changed
3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ abstract class H5PEditorEndpoints {
34
34
* Endpoint for uploading files used by the editor.
35
35
*/
36
36
const FILES = 'files ' ;
37
+
38
+ /**
39
+ * Endpoint for retrieveing translation files
40
+ */
41
+ const TRANSLATIONS = 'translations ' ;
37
42
}
38
43
39
44
@@ -123,6 +128,11 @@ public function action($endpoint) {
123
128
if (!$ this ->isValidEditorToken ($ token )) return ;
124
129
$ this ->fileUpload ($ contentId );
125
130
break ;
131
+
132
+ case H5PEditorEndpoints::TRANSLATIONS :
133
+ $ language = func_get_arg (1 );
134
+ H5PCore::ajaxSuccess ($ this ->editor ->getTranslations ($ _POST ['libraries ' ], $ language ));
135
+ break ;
126
136
}
127
137
}
128
138
Original file line number Diff line number Diff line change @@ -41,4 +41,12 @@ public function getAuthorsRecentlyUsedLibraries();
41
41
*/
42
42
public function validateEditorToken ($ token );
43
43
44
+ /**
45
+ * Get translations for a language for a list of libraries
46
+ *
47
+ * @param array $libraries An array of libraries, in the form "<machineName> <majorVersion>.<minorVersion>
48
+ * @param string $language_code
49
+ * @return array
50
+ */
51
+ public function getTranslations ($ libraries , $ language_code );
44
52
}
Original file line number Diff line number Diff line change @@ -129,6 +129,17 @@ public function getLibraries() {
129
129
return $ libraries ;
130
130
}
131
131
132
+ /**
133
+ * Get translations for a language for a list of libraries
134
+ *
135
+ * @param array $libraries An array of libraries, in the form "<machineName> <majorVersion>.<minorVersion>
136
+ * @param string $language_code
137
+ * @return array
138
+ */
139
+ public function getTranslations ($ libraries , $ language_code ) {
140
+ return $ this ->ajaxInterface ->getTranslations ($ libraries , $ language_code );
141
+ }
142
+
132
143
/**
133
144
* Move uploaded files, remove old files and update library usage.
134
145
*
You can’t perform that action at this time.
0 commit comments