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 296d06e..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: "Kilowatt Hour", + Key: "kilowatthour", }, US_GALLON: { - Short: "US Gal", - Long: "US Gallon", + 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/package.json b/ui/package.json index bf6c486..9911b0d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -41,10 +41,12 @@ "currency-formatter": "^1.5.7", "date-fns": "2.10.0", "lodash": "^4.17.21", + "node-gyp": "^9.3.1", "normalize.css": "8.0.1", "nprogress": "0.2.0", "vue": "2.6.11", "vue-chartjs": "^3.5.1", + "vue-i18n": "^8.28.2", "vue-meta": "2.3.3", "vue-router": "3.1.6", "vuex": "3.1.2" diff --git a/ui/src/components/createQuickEntry.vue b/ui/src/components/createQuickEntry.vue index fe8dc72..d535ebc 100644 --- a/ui/src/components/createQuickEntry.vue +++ b/ui/src/components/createQuickEntry.vue @@ -20,7 +20,7 @@ export default { } } else { if (this.file == null) { - return 'Upload Photo' + return this.$t('uploadphoto') } else { return '' } @@ -39,7 +39,7 @@ export default { .post(`/api/quickEntries`, formData) .then((data) => { this.$buefy.toast.open({ - message: 'Quick Entry Created Successfully', + message: this.$t('quickentrycreatedsuccessfully'), type: 'is-success', duration: 3000, }) @@ -68,9 +68,9 @@ export default {
Quick Entry
+{{ $tc('quickentry',1) }}
Take a pic of the invoice or the fuel pump display to make an entry later.
{{ $t('quickentrydesc') }}
diff --git a/ui/src/components/shareVehicle.vue b/ui/src/components/shareVehicle.vue
index d324b50..35ed5b1 100644
--- a/ui/src/components/shareVehicle.vue
+++ b/ui/src/components/shareVehicle.vue
@@ -55,7 +55,7 @@ export default {
return
}
this.$buefy.dialog.confirm({
- title: 'Transfer Vehicle',
+ title: this.$t('transfervehicle'),
message: 'Are you sure you want to do this? You will lose ownership and all editing rights if you confirm.',
cancelText: 'Cancel',
confirmText: 'Go Ahead',
@@ -90,7 +90,7 @@ export default {
Share {{ vehicle.nickname }}
+ {{ $t('share') }} {{ vehicle.nickname }}