Localization refactoring:

* the front-end now use global constants, based on the translation key
* build-client.js use the ESBuild "define" directive to replace these
  globals at compile time, by the english value
* build:client must now be called after build:languages
* moving the loadLoc and loc backend functions in a separate lib
This commit is contained in:
John Livingston
2023-06-12 19:26:28 +02:00
parent 7285c8b0a8
commit f73ccbbf7e
12 changed files with 199 additions and 93 deletions

View File

@ -6,6 +6,7 @@ import { initRouters } from './lib/routers/index'
import { initFederation } from './lib/federation/init'
import { prepareProsody, ensureProsodyRunning, ensureProsodyNotRunning } from './lib/prosody/ctl'
import { unloadDebugMode } from './lib/debug'
import { loadLoc } from './lib/loc'
import decache from 'decache'
// FIXME: Peertube unregister don't have any parameter.
@ -20,6 +21,9 @@ async function register (options: RegisterServerOptions): Promise<any> {
throw new Error('Your peertube version is not correct. This plugin is not compatible with Peertube < 3.2.0.')
}
// First: load languages files, so we can localize strings.
await loadLoc()
await migrateSettings(options)
await initSettings(options)