Removed i18n dependency from ensure settings module

refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- i18n is an old pattern we are getting rid of. By removing it here we get rid of an extra dependancy on frontend's "proxy" module
This commit is contained in:
Naz 2021-09-23 14:52:35 +02:00 committed by naz
parent 4a47e8d0a8
commit 9822dbc1a2
2 changed files with 7 additions and 4 deletions

View File

@ -2,10 +2,14 @@ const fs = require('fs-extra');
const Promise = require('bluebird');
const path = require('path');
const debug = require('@tryghost/debug')('frontend:services:settings:ensure-settings');
const {i18n} = require('../proxy');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const config = require('../../../shared/config');
const messages = {
ensureSettings: 'Error trying to access settings files in {path}.'
};
/**
* Makes sure file is in the `/content/settings` directory. If not, copy the default over.
* @param {String} fileName - name of the setting file
@ -31,7 +35,7 @@ module.exports = function ensureSettingsFile(fileName) {
}).catch((error) => {
// CASE: we might have a permission error, as we can't access the directory
throw new errors.GhostError({
message: i18n.t('errors.services.settings.ensureSettings', {path: contentPath}),
message: tpl(messages.ensureSettings, {path: contentPath}),
err: error,
context: error.path
});

View File

@ -545,8 +545,7 @@
"help": "Check your {file} file for typos and fix the named issues.",
"validate": "The following definition \"{at}\" is invalid: {reason}"
},
"loader": "Error trying to load YAML setting for {setting} from '{path}'.",
"ensureSettings": "Error trying to access settings files in {path}."
"loader": "Error trying to load YAML setting for {setting} from '{path}'."
},
"mega": {
"requestFailed": {