Skip to content

Commit ccb57ad

Browse files
chore(pr): address pr comments
1 parent a882de5 commit ccb57ad

File tree

6 files changed

+4
-21
lines changed

6 files changed

+4
-21
lines changed

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ services:
1616
DATA_DIR: '/data/tmp'
1717
NODE_ENV: 'production'
1818
REDIS_HOST: 'redis'
19-
LOCALE: 'cn'
2019
ports:
2120
- '3000:3000'
2221
depends_on:

docs/install-server.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ some config items have to be changed:
4747

4848
- `local`.`storageDir` change to your directory, make sure have read/write permissions.
4949
- `local`.`downloadUrl` replace `127.0.0.1` to your machine ip.
50-
- `local`.`locale` either `cn` or `en`.
5150
- `common`.`dataDir` change to your directory,make sure have read/write permissions.
5251
- `jwt`.`tokenSecret` get the random string from `https://www.grc.com/passwords.htm`, and replace the value `INSERT_RANDOM_TOKEN_KEY`.
5352
- `db` config: `username`,`password`,`host`,`port` change to your own

src/app.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import helmet from 'helmet';
77
import { logger } from 'kv-logger';
88
import { AppError, NotFound } from './core/app-error';
99
import { config } from './core/config';
10-
import { i18n } from "./core/i81n"
10+
import { i18n } from "./core/i18n"
1111
import { Req, Res, withLogger } from './core/middleware';
1212
import { accessKeysRouter } from './routes/accessKeys';
1313
import { accountRouter } from './routes/account';
@@ -32,19 +32,8 @@ app.set('views', path.join(__dirname, '../views'));
3232
app.set('view engine', 'pug');
3333

3434
// translations
35-
3635
app.use(i18n.init)
3736

38-
app.use(function(req, res, next) {
39-
// express helper for natively supported engines
40-
// @ts-ignore
41-
res.locals.__ = res.__ = function() {
42-
return i18n.__.apply(req, arguments);
43-
};
44-
45-
next();
46-
});
47-
4837
app.use(bodyParser.json());
4938
app.use(bodyParser.urlencoded({ extended: false }));
5039
app.use(cookieParser());

src/core/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export const config = {
8585
'http://127.0.0.1:3000/download',
8686
// public static download spacename.
8787
public: '/download',
88-
locale: process.env.LOCALE || 'cn'
8988
},
9089
jwt: {
9190
// Recommended: 63 random alpha-numeric characters
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { I18n } from 'i18n'
22
import path from "path"
3-
import { config } from "./config"
43

54
export const i18n = new I18n({
6-
locales: ['cn', 'en'],
5+
locales: ['en', 'cn'],
76
directory: path.join(__dirname, '../../locales'),
8-
defaultLocale: 'cn'
7+
defaultLocale: 'en'
98
})
10-
11-
i18n.setLocale(config.local.locale)

src/routes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import express from 'express';
22
import { AppError } from '../core/app-error';
3-
import { i18n } from "../core/i81n"
3+
import { i18n } from "../core/i18n"
44
import { checkToken, Req } from '../core/middleware';
55
import { clientManager } from '../core/services/client-manager';
66

0 commit comments

Comments
 (0)