From 9822dbc1a2f4af2c2862fcb40eaf2ec4cdd1f0a1 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 23 Sep 2021 14:52:35 +0200 Subject: [PATCH] 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 --- core/frontend/services/settings/ensure-settings.js | 8 ++++++-- core/shared/i18n/translations/en.json | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/frontend/services/settings/ensure-settings.js b/core/frontend/services/settings/ensure-settings.js index cbe53ffce9..26286f290c 100644 --- a/core/frontend/services/settings/ensure-settings.js +++ b/core/frontend/services/settings/ensure-settings.js @@ -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 }); diff --git a/core/shared/i18n/translations/en.json b/core/shared/i18n/translations/en.json index 49032bd5d0..7f06fc72d5 100644 --- a/core/shared/i18n/translations/en.json +++ b/core/shared/i18n/translations/en.json @@ -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": {