diff --git a/server/controllers/auth.go b/server/controllers/auth.go
index c53af83..a80b1b8 100644
--- a/server/controllers/auth.go
+++ b/server/controllers/auth.go
@@ -115,7 +115,7 @@ func userLogin(c *gin.Context) {
Email: user.Email,
Token: token,
RefreshToken: refreshToken,
- Role: user.RoleDetail().Long,
+ Role: user.RoleDetail().Key,
}
c.JSON(http.StatusOK, response)
}
@@ -149,7 +149,7 @@ func refresh(c *gin.Context) {
Email: user.Email,
Token: token,
RefreshToken: refreshToken,
- Role: user.RoleDetail().Long,
+ Role: user.RoleDetail().Key,
}
c.JSON(http.StatusOK, response)
} else {
diff --git a/server/db/enums.go b/server/db/enums.go
index 723e721..6956762 100644
--- a/server/db/enums.go
+++ b/server/db/enums.go
@@ -52,75 +52,58 @@ const (
)
type EnumDetail struct {
- Short string `json:"short"`
- Long string `json:"long"`
+ Key string `json:"key"`
}
var FuelUnitDetails map[FuelUnit]EnumDetail = map[FuelUnit]EnumDetail{
LITRE: {
- Short: "Lt",
- Long: "litre",
+ Key: "litre",
},
GALLON: {
- Short: "Gal",
- Long: "gallon",
+ Key: "gallon",
}, KILOGRAM: {
- Short: "Kg",
- Long: "kilogram",
+ Key: "kilogram",
}, KILOWATT_HOUR: {
- Short: "KwH",
- Long: "kilowatthour",
+ Key: "kilowatthour",
}, US_GALLON: {
- Short: "US Gal",
- Long: "usgallon",
+ Key: "usgallon",
},
MINUTE: {
- Short: "Mins",
- Long: "minutes",
+ Key: "minutes",
},
}
var FuelTypeDetails map[FuelType]EnumDetail = map[FuelType]EnumDetail{
PETROL: {
- Short: "Petrol",
- Long: "Petrol",
+ Key: "petrol",
},
DIESEL: {
- Short: "Diesel",
- Long: "Diesel",
+ Key: "diesel",
}, CNG: {
- Short: "CNG",
- Long: "CNG",
+ Key: "cng",
}, LPG: {
- Short: "LPG",
- Long: "LPG",
+ Key: "lpg",
}, ELECTRIC: {
- Short: "Electric",
- Long: "Electric",
+ Key: "electric",
}, ETHANOL: {
- Short: "Ethanol",
- Long: "Ethanol",
+ Key: "ethanol",
},
}
var DistanceUnitDetails map[DistanceUnit]EnumDetail = map[DistanceUnit]EnumDetail{
KILOMETERS: {
- Short: "Km",
- Long: "Kilometers",
+ Key: "kilometers",
},
MILES: {
- Short: "Mi",
- Long: "Miles",
+ Key: "miles",
},
}
var RoleDetails map[Role]EnumDetail = map[Role]EnumDetail{
ADMIN: {
- Short: "Admin",
- Long: "ADMIN",
+ Key: "ADMIN",
},
USER: {
- Short: "User",
- Long: "USER",
+ Key: "USER",
},
}
diff --git a/ui/src/components/mileageChart.vue b/ui/src/components/mileageChart.vue
index 33d0a6c..f6fea40 100644
--- a/ui/src/components/mileageChart.vue
+++ b/ui/src/components/mileageChart.vue
@@ -30,7 +30,7 @@ export default {
var labels = this.chartData.map((x) => x.date.substr(0, 10))
var dataset = {
steppedLine: true,
- label: `${this.$t('odometer')} (${this.user.distanceUnitDetail.short}/${this.vehicle.fuelUnitDetail.short})`,
+ label: `${this.$t('odometer')} (${this.$t('unit.short.' + this.user.distanceUnitDetail.key)}/${this.$t('unit.short.' + this.vehicle.fuelUnitDetail.key)})`,
fill: true,
data: this.chartData.map((x) => x.mileage),
}
diff --git a/ui/src/i18n.js b/ui/src/i18n.js
index 45b5b7a..267eeee 100644
--- a/ui/src/i18n.js
+++ b/ui/src/i18n.js
@@ -16,62 +16,10 @@ function loadLocaleMessages () {
return messages
}
-const dateTimeFormats = {
- 'en-US': {
- short: {
- year: 'numeric',
- month: 'short',
- day: 'numeric'
- },
- long: {
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- weekday: 'long',
- hour: 'numeric',
- minute: 'numeric'
- }
- },
- 'de-DE': {
- short: {
- year: 'numeric',
- month: 'short',
- day: 'numeric'
- },
- long: {
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- weekday: 'long',
- hour: 'numeric',
- minute: 'numeric',
- hour12: false
- }
- }
- }
-
-const numberFormats = {
- 'en-US': {
- currency: {
- style: 'currency',
- currency: 'USD'
- }
- },
- 'de-DE': {
- currency: {
- style: 'currency',
- currency: 'EUR',
- currencyDisplay: 'symbol'
- }
- }
- }
-
const i18n = new VueI18n({
locale: navigator.language.split('-')[0] || 'en',
fallbackLocale: 'en',
- messages: loadLocaleMessages(),
- numberFormats,
- dateTimeFormats
+ messages: loadLocaleMessages()
});
export default i18n;
\ No newline at end of file
diff --git a/ui/src/locales/de.json b/ui/src/locales/de.json
index e5fa963..a99dab2 100644
--- a/ui/src/locales/de.json
+++ b/ui/src/locales/de.json
@@ -78,12 +78,12 @@
"quantity": "Menge",
"gasstation": "Tankstelle",
"fuel": {
- "Petrol": "Benzin",
- "Diesel": "Diesel",
- "CNG": "CNG",
- "LPG": "LPG",
- "Electric": "Strom",
- "Ethanol": "Ethanol"
+ "petrol": "Benzin",
+ "diesel": "Diesel",
+ "cng": "CNG",
+ "lpg": "LPG",
+ "electric": "Strom",
+ "ethanol": "Ethanol"
},
"unit": {
"long": {
@@ -92,7 +92,9 @@
"kilowatthour": "Kilowattstunde",
"kilogram": "Kilogramm",
"usgallon": "US-Gallone",
- "minutes": "Minuten"
+ "minutes": "Minuten",
+ "kilometers": "Kilometer",
+ "miles": "Meilen"
},
"short": {
"litre": "L",
@@ -100,7 +102,9 @@
"kilowatthour": "KwH",
"kilogram": "Kg",
"usgallon": "US-Gal",
- "minutes": "Min"
+ "minutes": "Min",
+ "kilometers": "Km",
+ "miles": "Mi"
}
},
"avgfillupqty": "Ø Tankmenge",
@@ -184,6 +188,10 @@
"success": "Du hast dich erfolgreich registriert. Du wirst in kürze zur Anmeldung weitergeleitet und kannst Anfangen Hammond zu verwenden."
}
},
+ "roles": {
+ "ADMIN": "Adminstrator",
+ "USER": "Benutzer"
+ },
"profile": "Profil",
"processedon": "Bearbeitet am",
"enable": "Entsperren",
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index 5736ef2..6e3940a 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -81,12 +81,12 @@
"quantity": "Quantity",
"gasstation": "Gas Station",
"fuel": {
- "Petrol": "Petrol",
- "Diesel": "Diesel",
- "CNG": "CNG",
- "LPG": "LPG",
- "Electric": "Electric",
- "Ethanol": "Ethanol"
+ "petrol": "Petrol",
+ "diesel": "Diesel",
+ "cng": "CNG",
+ "lpg": "LPG",
+ "electric": "Electric",
+ "ethanol": "Ethanol"
},
"unit": {
"long": {
@@ -95,7 +95,9 @@
"kilowatthour": "Kilowatt Hour",
"kilogram": "Kilogram",
"usgallon": "US Gallon",
- "minutes": "Minutes"
+ "minutes": "Minutes",
+ "kilometers": "Kilometers",
+ "miles": "Miles"
},
"short": {
"litre": "Lt",
@@ -103,7 +105,9 @@
"kilowatthour": "KwH",
"kilogram": "Kg",
"usgallon": "US Gal",
- "minutes": "Mins"
+ "minutes": "Mins",
+ "kilometers": "Km",
+ "miles": "Mi"
}
},
"avgfillupqty": "Avg Fillup Qty",
@@ -191,6 +195,10 @@
"success": "You have been registered successfully. You will be redirected to the login screen shortly where you can login and start using the system."
}
},
+ "roles": {
+ "ADMIN": "ADMIN",
+ "USER": "USER"
+ },
"profile": "Profile",
"processedon": "Processed on",
"enable": "Enable",
diff --git a/ui/src/router/views/createExpense.vue b/ui/src/router/views/createExpense.vue
index 7c7d7a0..90c9730 100644
--- a/ui/src/router/views/createExpense.vue
+++ b/ui/src/router/views/createExpense.vue
@@ -198,7 +198,7 @@ export default {
-
+
-
+
{{ vehicle.nickname }} - {{ vehicle.registration }}
- {{ [vehicle.make, vehicle.model, this.$t('fuel.' + vehicle.fuelTypeDetail.short)].join(' | ') }}
+ {{ [vehicle.make, vehicle.model, this.$t('fuel.' + vehicle.fuelTypeDetail.key)].join(' | ') }}
| {{ $t("sharedwith") }} :
@@ -363,12 +363,12 @@ export default {
{{ props.row.fuelSubType }}