From 67baf6478a56e4fabb22da27ee91783add7ed369 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Apr 2021 16:14:09 +0200 Subject: Allow plugins to set short translation locale --- server/lib/plugins/plugin-manager.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'server/lib/plugins/plugin-manager.ts') 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 import { ClientHtml } from '../client-html' import { RegisterHelpers } from './register-helpers' import { installNpmPlugin, installNpmPluginFromDisk, removeNpmPlugin } from './yarn' +import { getCompleteLocale } from '@shared/core-utils' export interface RegisteredPlugin { npmName: string @@ -444,10 +445,12 @@ export class PluginManager implements ServerHook { const path = translationPaths[locale] const json = await readJSON(join(this.getPluginPath(plugin.name, plugin.type), path)) - if (!this.translations[locale]) this.translations[locale] = {} - this.translations[locale][npmName] = json + const completeLocale = getCompleteLocale(locale) - logger.info('Added locale %s of plugin %s.', locale, npmName) + if (!this.translations[completeLocale]) this.translations[completeLocale] = {} + this.translations[completeLocale][npmName] = json + + logger.info('Added locale %s of plugin %s.', completeLocale, npmName) } } -- cgit v1.2.3