Removed translation in exported CSV headers
MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1562,27 +1562,26 @@ export default class ChargingStationService {
private static convertToCSV(req: Request, chargingStations: ChargingStation[], writeHeader = true): string {
let csv = '';
-
const i18nManager = I18nManager.getInstanceForLocale(req.user.locale);
// Header
if (writeHeader) {
- csv = i18nManager.translate('general.name') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.createdOn') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.numberOfConnectors') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.siteArea') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.latitude') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.longitude') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.chargePointSN') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.model') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.chargeBoxSN') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.vendor') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.firmwareVersion') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.ocppVersion') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.ocppProtocol') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.lastSeen') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.lastReboot') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.maxPower') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('chargers.powerLimitUnit') + '\r\n';
+ csv = 'name' + Constants.CSV_SEPARATOR;
+ csv += 'createdOn' + Constants.CSV_SEPARATOR;
+ csv += 'numberOfConnectors' + Constants.CSV_SEPARATOR;
+ csv += 'siteArea' + Constants.CSV_SEPARATOR;
+ csv += 'latitude' + Constants.CSV_SEPARATOR;
+ csv += 'longitude' + Constants.CSV_SEPARATOR;
+ csv += 'chargePointSerialNumber' + Constants.CSV_SEPARATOR;
+ csv += 'model' + Constants.CSV_SEPARATOR;
+ csv += 'chargeBoxSerialNumber' + Constants.CSV_SEPARATOR;
+ csv += 'vendor' + Constants.CSV_SEPARATOR;
+ csv += 'firmwareVersion' + Constants.CSV_SEPARATOR;
+ csv += 'ocppVersion' + Constants.CSV_SEPARATOR;
+ csv += 'ocppProtocol' + Constants.CSV_SEPARATOR;
+ csv += 'lastSeen' + Constants.CSV_SEPARATOR;
+ csv += 'lastReboot' + Constants.CSV_SEPARATOR;
+ csv += 'maxPower' + Constants.CSV_SEPARATOR;
+ csv += 'powerLimitUnit' + '\r\n';
}
// Content
for (const chargingStation of chargingStations) {

MODIFY
src/server/rest/v1/service/LoggingService.ts
src/server/rest/v1/service/LoggingService.ts
@@ -56,20 +56,19 @@ export default class LoggingService {
private static convertToCSV(req: Request, loggings: Log[], writeHeader = true): string {
let csv = '';
- const i18nManager = I18nManager.getInstanceForLocale(req.user.locale);
// Header
if (writeHeader) {
- csv = i18nManager.translate('general.date') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.time') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.level') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.type') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.action') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.message') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.method') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.module') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.source') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.host') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('loggings.process') + '\r\n';
+ csv = 'date' + Constants.CSV_SEPARATOR;
+ csv += 'time' + Constants.CSV_SEPARATOR;
+ csv += 'level' + Constants.CSV_SEPARATOR;
+ csv += 'type' + Constants.CSV_SEPARATOR;
+ csv += 'action' + Constants.CSV_SEPARATOR;
+ csv += 'message' + Constants.CSV_SEPARATOR;
+ csv += 'method' + Constants.CSV_SEPARATOR;
+ csv += 'module' + Constants.CSV_SEPARATOR;
+ csv += 'source' + Constants.CSV_SEPARATOR;
+ csv += 'host' + Constants.CSV_SEPARATOR;
+ csv += 'process' + '\r\n';
}
// Content
for (const log of loggings) {

MODIFY
src/server/rest/v1/service/StatisticService.ts
src/server/rest/v1/service/StatisticService.ts
@@ -474,38 +474,37 @@ export default class StatisticService {
static convertToCSV(loggedUser: UserToken, transactionStatsMDB: any[], dataCategory: string, dataType: string, year: number | string, dataScope?: string): string {
let user: User;
let unknownUser = Utils.buildUserFullName(user, false, false);
- const i18nManager = I18nManager.getInstanceForLocale(loggedUser.locale);
if (!unknownUser) {
unknownUser = 'Unknown';
}
let csv: string;
if (dataCategory === 'C') {
- csv = i18nManager.translate('chargers.chargingStation') + Constants.CSV_SEPARATOR;
+ csv = 'chargingStation' + Constants.CSV_SEPARATOR;
} else {
- csv = i18nManager.translate('users.user') + Constants.CSV_SEPARATOR;
+ csv = 'user' + Constants.CSV_SEPARATOR;
}
if (year && year !== '0') {
- csv += i18nManager.translate('general.year') + Constants.CSV_SEPARATOR;
+ csv += 'year' + Constants.CSV_SEPARATOR;
if (dataScope && dataScope === 'month') {
- csv += i18nManager.translate('general.month') + Constants.CSV_SEPARATOR;
+ csv += 'month' + Constants.CSV_SEPARATOR;
}
}
switch (dataType) {
case 'Consumption':
- csv += i18nManager.translate('statistics.consumption') + '\r\n';
+ csv += 'consumption' + '\r\n';
break;
case 'Usage':
- csv += i18nManager.translate('statistics.usage') + '\r\n';
+ csv += 'usage' + '\r\n';
break;
case 'Inactivity':
- csv += i18nManager.translate('statistics.inactivity') + '\r\n';
+ csv += 'inactivity' + '\r\n';
break;
case 'Transactions':
- csv += i18nManager.translate('statistics.numberOfSessions') + '\r\n';
+ csv += 'numberOfSessions' + '\r\n';
break;
case 'Pricing':
- csv += i18nManager.translate('general.price') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.priceUnit') + '\r\n';
+ csv += 'price' + Constants.CSV_SEPARATOR;
+ csv += 'priceUnit' + '\r\n';
break;
default:
return csv;

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -1331,25 +1331,26 @@ export default class UserService {
private static convertToCSV(req: Request, users: User[], writeHeader = true): string {
let csv = '';
- const i18nManager = I18nManager.getInstanceForLocale(req.user.locale);
// Header
if (writeHeader) {
- csv = i18nManager.translate('users.id') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.name') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('users.firstName') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('users.role') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('users.status') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('users.email') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('users.eulaAcceptedOn') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.createdOn') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.changedOn') + Constants.CSV_SEPARATOR;
- csv += i18nManager.translate('general.changedBy') + '\r\n';
+ csv = 'id' + Constants.CSV_SEPARATOR;
+ csv += 'name' + Constants.CSV_SEPARATOR;
+ csv += 'firstName' + Constants.CSV_SEPARATOR;
+ csv += 'locale' + Constants.CSV_SEPARATOR;
+ csv += 'role' + Constants.CSV_SEPARATOR;
+ csv += 'status' + Constants.CSV_SEPARATOR;
+ csv += 'email' + Constants.CSV_SEPARATOR;
+ csv += 'eulaAcceptedOn' + Constants.CSV_SEPARATOR;
+ csv += 'createdOn' + Constants.CSV_SEPARATOR;
+ csv += 'changedOn' + Constants.CSV_SEPARATOR;
+ csv += 'changedBy' + '\r\n';
}
// Content
for (const user of users) {
csv += Cypher.hash(user.id) + Constants.CSV_SEPARATOR;
csv += user.name + Constants.CSV_SEPARATOR;
csv += user.firstName + Constants.CSV_SEPARATOR;
+ csv += user.locale + Constants.CSV_SEPARATOR;
csv += user.role + Constants.CSV_SEPARATOR;
csv += user.status + Constants.CSV_SEPARATOR;
csv += user.email + Constants.CSV_SEPARATOR;

Removed translation in exported CSV headers