mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Moved i18n to correct location in boot process
- Note: added a forced error to show that this was previously happening at the wrong time - i18n is required by ghost-server to log server start messages, and so gets initialised as part of the ghost-server load - moving this into the right place means we can see how long it takes in the debug logs - previously the debug log lines for i18n showed 0/1ms, which is not correct as this contains a sync file load operation! - we should consider if we want to have i18n be a requirement for ghost server, or if we want static messages
This commit is contained in:
parent
9ce407966f
commit
fb974f6650
2 changed files with 7 additions and 8 deletions
13
core/boot.js
13
core/boot.js
|
@ -55,13 +55,6 @@ async function initDatabase({config, logging}) {
|
|||
*/
|
||||
async function initCore({ghostServer}) {
|
||||
debug('Begin: initCore');
|
||||
|
||||
// Initialize Ghost core internationalization - this is basically used to colocate all of our error message strings
|
||||
debug('Begin: i18n');
|
||||
const i18n = require('./shared/i18n');
|
||||
i18n.init();
|
||||
debug('End: i18n');
|
||||
|
||||
// Models are the heart of Ghost - this is a syncronous operation
|
||||
debug('Begin: models');
|
||||
const models = require('./server/models');
|
||||
|
@ -264,6 +257,12 @@ async function bootGhost() {
|
|||
require('./shared/sentry');
|
||||
debug('End: Load sentry');
|
||||
|
||||
// I18n is basically used to colocate all of our error message strings & required to log server start messages
|
||||
debug('Begin: i18n');
|
||||
const i18n = require('./shared/i18n');
|
||||
i18n.init();
|
||||
debug('End: i18n');
|
||||
|
||||
debug('Begin: Load urlUtils');
|
||||
const urlUtils = require('./shared/url-utils');
|
||||
debug('End: Load urlUtils');
|
||||
|
|
|
@ -143,7 +143,7 @@ class I18n {
|
|||
|
||||
// If not in memory, load translations for core
|
||||
if (isNil(this._strings)) {
|
||||
this.init();
|
||||
throw new errors.IncorrectUsageError({message: 'i18n was used before it was initialised'});
|
||||
}
|
||||
|
||||
candidateString = this._getCandidateString(msgPath);
|
||||
|
|
Loading…
Add table
Reference in a new issue