aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-26 14:44:50 +0200
committerChocobozzz <me@florianbigard.com>2019-07-26 15:18:30 +0200
commitd75db01f14138ea660c4c519e37ab05228b39d13 (patch)
tree85a3da315ea6e1501fec5b70790482504dd64793 /shared
parentee286591a5b740702bad66c55cc900740f749e9a (diff)
downloadPeerTube-d75db01f14138ea660c4c519e37ab05228b39d13.tar.gz
PeerTube-d75db01f14138ea660c4c519e37ab05228b39d13.tar.zst
PeerTube-d75db01f14138ea660c4c519e37ab05228b39d13.zip
Add plugin translation system
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/server/plugins.ts16
-rw-r--r--shared/models/plugins/plugin-package-json.model.ts6
-rw-r--r--shared/models/plugins/plugin-translation.model.ts5
3 files changed, 27 insertions, 0 deletions
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts
index 65d37d69f..5c0d1e511 100644
--- a/shared/extra-utils/server/plugins.ts
+++ b/shared/extra-utils/server/plugins.ts
@@ -134,6 +134,21 @@ function getPublicSettings (parameters: {
134 }) 134 })
135} 135}
136 136
137function getPluginTranslations (parameters: {
138 url: string,
139 locale: string,
140 expectedStatus?: number
141}) {
142 const { url, locale, expectedStatus = 200 } = parameters
143 const path = '/plugins/translations/' + locale + '.json'
144
145 return makeGetRequest({
146 url,
147 path,
148 statusCodeExpected: expectedStatus
149 })
150}
151
137function installPlugin (parameters: { 152function installPlugin (parameters: {
138 url: string, 153 url: string,
139 accessToken: string, 154 accessToken: string,
@@ -224,6 +239,7 @@ export {
224 listPlugins, 239 listPlugins,
225 listAvailablePlugins, 240 listAvailablePlugins,
226 installPlugin, 241 installPlugin,
242 getPluginTranslations,
227 getPluginsCSS, 243 getPluginsCSS,
228 updatePlugin, 244 updatePlugin,
229 getPlugin, 245 getPlugin,
diff --git a/shared/models/plugins/plugin-package-json.model.ts b/shared/models/plugins/plugin-package-json.model.ts
index 87a48e97f..3f3077671 100644
--- a/shared/models/plugins/plugin-package-json.model.ts
+++ b/shared/models/plugins/plugin-package-json.model.ts
@@ -1,5 +1,9 @@
1import { PluginClientScope } from './plugin-client-scope.type' 1import { PluginClientScope } from './plugin-client-scope.type'
2 2
3export type PluginTranslationPaths = {
4 [ locale: string ]: string
5}
6
3export type ClientScript = { 7export type ClientScript = {
4 script: string, 8 script: string,
5 scopes: PluginClientScope[] 9 scopes: PluginClientScope[]
@@ -20,4 +24,6 @@ export type PluginPackageJson = {
20 css: string[] 24 css: string[]
21 25
22 clientScripts: ClientScript[] 26 clientScripts: ClientScript[]
27
28 translations: PluginTranslationPaths
23} 29}
diff --git a/shared/models/plugins/plugin-translation.model.ts b/shared/models/plugins/plugin-translation.model.ts
new file mode 100644
index 000000000..a2dd8e560
--- /dev/null
+++ b/shared/models/plugins/plugin-translation.model.ts
@@ -0,0 +1,5 @@
1export type PluginTranslation = {
2 [ npmName: string ]: {
3 [ key: string ]: string
4 }
5}