diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-20 16:14:09 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-20 16:14:09 +0200 |
commit | 67baf6478a56e4fabb22da27ee91783add7ed369 (patch) | |
tree | 13049588468e41104ace09c79b98d02b6676c09f /server/lib | |
parent | 24a792404cac0dffff91853af33310fbb7a30297 (diff) | |
download | PeerTube-67baf6478a56e4fabb22da27ee91783add7ed369.tar.gz PeerTube-67baf6478a56e4fabb22da27ee91783add7ed369.tar.zst PeerTube-67baf6478a56e4fabb22da27ee91783add7ed369.zip |
Allow plugins to set short translation locale
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 9 |
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 | |||
23 | import { ClientHtml } from '../client-html' | 23 | import { ClientHtml } from '../client-html' |
24 | import { RegisterHelpers } from './register-helpers' | 24 | import { RegisterHelpers } from './register-helpers' |
25 | import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' | 25 | import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' |
26 | import { getCompleteLocale } from '@shared/core-utils' | ||
26 | 27 | ||
27 | export interface RegisteredPlugin { | 28 | export 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 | ||