From 760591b9b0045f6872eb71abfc974398e5afebcd Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Fri, 24 Apr 2020 16:42:03 +0200 Subject: [PATCH 1/2] Fixed wrong locales search path after app.js move Signed-off-by: Erik Michelson --- lib/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app.js b/lib/app.js index 26ddd4d93..47265db5c 100644 --- a/lib/app.js +++ b/lib/app.js @@ -116,7 +116,7 @@ i18n.configure({ locales: ['en', 'zh-CN', 'zh-TW', 'fr', 'de', 'ja', 'es', 'ca', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo', 'da', 'ko', 'id', 'sr', 'vi', 'ar', 'cs', 'sk'], cookie: 'locale', indent: ' ', // this is the style poeditor.com exports it, this creates less churn - directory: path.join(__dirname, '/locales'), + directory: path.join(__dirname, '../locales'), updateFiles: config.updateI18nFiles }) From 7838f9b03a78ed18dced128a8496cdd12f482cf4 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Fri, 24 Apr 2020 19:09:18 +0200 Subject: [PATCH 2/2] Added config property for locales There's a new config property 'localesPath' - pointing to './locales' by default. The path resolution is similar to the docsPath, uploadsPath etc. Signed-off-by: Erik Michelson --- docs/configuration-config-file.md | 1 + lib/app.js | 2 +- lib/config/default.js | 1 + lib/config/index.js | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/configuration-config-file.md b/docs/configuration-config-file.md index 0003680d2..17b608a3f 100644 --- a/docs/configuration-config-file.md +++ b/docs/configuration-config-file.md @@ -52,6 +52,7 @@ these are rarely used for various reasons. | `docsPath` | `./public/docs` | docs directory path1 | | `viewPath` | `./public/views` | template directory path1 | | `uploadsPath` | `./public/uploads` | uploads directory1 - needs to be persistent when you use imageUploadType `filesystem` | +| `localesPath` | `./locales` | directory for translations1 | ## CodiMD Location diff --git a/lib/app.js b/lib/app.js index 47265db5c..cb3fa4923 100644 --- a/lib/app.js +++ b/lib/app.js @@ -116,7 +116,7 @@ i18n.configure({ locales: ['en', 'zh-CN', 'zh-TW', 'fr', 'de', 'ja', 'es', 'ca', 'el', 'pt', 'it', 'tr', 'ru', 'nl', 'hr', 'pl', 'uk', 'hi', 'sv', 'eo', 'da', 'ko', 'id', 'sr', 'vi', 'ar', 'cs', 'sk'], cookie: 'locale', indent: ' ', // this is the style poeditor.com exports it, this creates less churn - directory: path.join(__dirname, '../locales'), + directory: path.resolve(__dirname, config.localesPath), updateFiles: config.updateI18nFiles }) diff --git a/lib/config/default.js b/lib/config/default.js index 9f0cddba9..14bac8a73 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -48,6 +48,7 @@ module.exports = { defaultNotePath: './public/default.md', docsPath: './public/docs', uploadsPath: './public/uploads', + localesPath: './locales', // session sessionName: 'connect.sid', sessionSecret: 'secret', diff --git a/lib/config/index.js b/lib/config/index.js index cee9cd73f..21c5b2f0f 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -201,6 +201,7 @@ config.publicPath = path.resolve(appRootPath, config.publicPath) config.defaultNotePath = path.resolve(appRootPath, config.defaultNotePath) config.docsPath = path.resolve(appRootPath, config.docsPath) config.uploadsPath = path.resolve(appRootPath, config.uploadsPath) +config.localesPath = path.resolve(appRootPath, config.localesPath) // make config readonly config = deepFreeze(config)