aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/plugin-manager.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-20 16:14:09 +0200
committerChocobozzz <me@florianbigard.com>2021-04-20 16:14:09 +0200
commit67baf6478a56e4fabb22da27ee91783add7ed369 (patch)
tree13049588468e41104ace09c79b98d02b6676c09f /server/lib/plugins/plugin-manager.ts
parent24a792404cac0dffff91853af33310fbb7a30297 (diff)
downloadPeerTube-67baf6478a56e4fabb22da27ee91783add7ed369.tar.gz
PeerTube-67baf6478a56e4fabb22da27ee91783add7ed369.tar.zst
PeerTube-67baf6478a56e4fabb22da27ee91783add7ed369.zip
Allow plugins to set short translation locale
Diffstat (limited to 'server/lib/plugins/plugin-manager.ts')
-rw-r--r--server/lib/plugins/plugin-manager.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index f3766ffa8..ae05af721 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -23,6 +23,7 @@ import { PluginLibrary, RegisterServerAuthExternalOptions, RegisterServerAuthPas
23import { ClientHtml } from '../client-html' 23import { ClientHtml } from '../client-html'
24import { RegisterHelpers } from './register-helpers' 24import { RegisterHelpers } from './register-helpers'
25import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' 25import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn'
26import { getCompleteLocale } from '@shared/core-utils'
26 27
27export interface RegisteredPlugin { 28export interface RegisteredPlugin {
28 npmName: string 29 npmName: string
@@ -444,10 +445,12 @@ export class PluginManager implements ServerHook {
444 const path = translationPaths[locale] 445 const path = translationPaths[locale]
445 const json = await readJSON(join(this.getPluginPath(plugin.name, plugin.type), path)) 446 const json = await readJSON(join(this.getPluginPath(plugin.name, plugin.type), path))
446 447
447 if (!this.translations[locale]) this.translations[locale] = {} 448 const completeLocale = getCompleteLocale(locale)
448 this.translations[locale][npmName] = json
449 449
450 logger.info('Added locale %s of plugin %s.', locale, npmName) 450 if (!this.translations[completeLocale]) this.translations[completeLocale] = {}
451 this.translations[completeLocale][npmName] = json
452
453 logger.info('Added locale %s of plugin %s.', completeLocale, npmName)
451 } 454 }
452 } 455 }
453 456