i18n improvements
This commit is contained in:
parent
5e268540a1
commit
4d744d92c4
3 changed files with 151 additions and 13 deletions
|
@ -3,17 +3,69 @@
|
|||
<h1>© 2021 Kaverti</h1>
|
||||
<div class="locale-changer">
|
||||
Lang:
|
||||
<select v-model="$i18n.locale">
|
||||
<option v-for="(lang, i) in langs" :key="`Lang${i}`" :value="lang">{{ lang }}</option>
|
||||
</select>
|
||||
<b-button @click="en">en</b-button>
|
||||
<b-button @click="wind">wind</b-button>
|
||||
<b-button @click="debug">debug</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import AjaxErrorHandler from '../../assets/js/errorHandler'
|
||||
export default {
|
||||
name: 'locale-changer',
|
||||
data () {
|
||||
return { langs: ['en', 'debug', 'wind'] }
|
||||
return { langs: ['en', 'debug', 'wind'], currentLang: this.$i18n.locale}
|
||||
},
|
||||
methods: {
|
||||
en () {
|
||||
this.$i18n.locale = "en"
|
||||
this.setLang()
|
||||
},
|
||||
debug () {
|
||||
this.$i18n.locale = "debug"
|
||||
this.setLang()
|
||||
},
|
||||
wind () {
|
||||
this.$i18n.locale = "wind"
|
||||
this.setLang()
|
||||
},
|
||||
setLang () {
|
||||
localStorage.setItem("lang", this.$i18n.locale);
|
||||
this.axios
|
||||
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'users/preferences', {
|
||||
lang: this.$i18n.locale
|
||||
})
|
||||
.then(() => {
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'userinfo')
|
||||
.then(res => {
|
||||
this.$store.commit('setUsername', res.data.username)
|
||||
this.$store.commit('setEmail', res.data.email)
|
||||
this.$store.commit('setEmailVerified', res.data.emailVerified)
|
||||
this.$store.commit('setAdmin', res.data.admin)
|
||||
this.$store.commit('setDevMode', res.data.developerMode)
|
||||
this.$store.commit('setTheme', res.data.theme)
|
||||
this.$store.commit('setLang', res.data.lang)
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if(localStorage.getItem("lang")) {
|
||||
this.$i18n.locale = localStorage.getItem("lang")
|
||||
} else if (this.$store.state.user.lang) {
|
||||
this.$i18n.locale = this.$store.state.user.lang
|
||||
} else {
|
||||
this.$i18n.locale = "en"
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
currentLang() {
|
||||
this.setLang()
|
||||
console.log('change')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -15,7 +15,7 @@
|
|||
<footer class="modal-card-foot">
|
||||
<b-button
|
||||
:label="$t('gotIt')"
|
||||
@click="$emit('close')" />
|
||||
@click="ajaxErrorModal = false" />
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<button
|
||||
type="button"
|
||||
class="delete"
|
||||
@click="$emit('close')"/>
|
||||
@click="loginModal = false"/>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<b-field :label="$t('login.loginUsername')">
|
||||
|
@ -59,7 +59,7 @@
|
|||
type="is-primary" />
|
||||
<b-button
|
||||
:label="$t('close')"
|
||||
@click="$emit('close')" />
|
||||
@click="loginModal = false" />
|
||||
<b-button
|
||||
@click="registerModal = true; loginModal = false"
|
||||
:label="$t('login.register')"
|
||||
|
@ -76,7 +76,7 @@
|
|||
<button
|
||||
type="button"
|
||||
class="delete"
|
||||
@click="$emit('close')"/>
|
||||
@click="registerModal = false"/>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<b-field :label="$t('register.username')">
|
||||
|
@ -126,7 +126,7 @@
|
|||
type="is-primary" />
|
||||
<b-button
|
||||
:label="$t('close')"
|
||||
@click="$emit('close')" />
|
||||
@click="registerModal = false" />
|
||||
<b-button
|
||||
@click="registerModal = false; loginModal = true"
|
||||
:label="$t('register.login')"
|
||||
|
@ -299,7 +299,7 @@ export default {
|
|||
this.$store.commit('setID', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
}).catch(() => {
|
||||
this.$buefy.snackbar.open({message:`Error occurred while fetching user information.`, type: 'is-warning'})
|
||||
this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'})
|
||||
})
|
||||
}).catch(e => {
|
||||
this.login.loading = false
|
||||
|
@ -314,7 +314,7 @@ export default {
|
|||
this.$store.commit('setID', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
}).catch(() => {
|
||||
this.$buefy.snackbar.open({message:`Error occurred while fetching user information.`, type: 'is-warning'})
|
||||
this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'})
|
||||
})
|
||||
|
||||
AjaxErrorHandler(this.$store)(e, (error, errors) => {
|
||||
|
@ -353,7 +353,7 @@ export default {
|
|||
this.loading = false
|
||||
}).catch(() => {
|
||||
localStorage.setItem('userCache', JSON.stringify(this.$store.state.user));
|
||||
this.$buefy.snackbar.open({message:`Error occurred while fetching user information.`, type: 'is-warning'})
|
||||
this.$buefy.snackbar.open({message:this.$t('errors.authFail'), type: 'is-warning'})
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
|
|
|
@ -17,6 +17,91 @@
|
|||
"login": "Already have a Kaverti account?",
|
||||
"agree": "Do you agree to the "
|
||||
},
|
||||
"teams": {
|
||||
"createTeam": "Create Team",
|
||||
"joinTeam": "Join Team",
|
||||
"join": "Join",
|
||||
"invite": "Invite",
|
||||
"viewPermissions": "View role permissions",
|
||||
"devBanner": "Teams are currently in development, expect missing features.",
|
||||
"view": "View",
|
||||
"viewTeam": "View Team",
|
||||
"memberRoles": "Members and Roles",
|
||||
"members": "Members",
|
||||
"roles": "Roles",
|
||||
"items": "Created Items",
|
||||
"foundedAt": "Team was founded at",
|
||||
"teamWall": "Team Wall",
|
||||
"teamWallText": "'s Team Wall",
|
||||
"verified": "Verified Team",
|
||||
"admin": {
|
||||
"text": "Team Administration",
|
||||
"nav": {
|
||||
"general": "General",
|
||||
"roles": "Roles",
|
||||
"members": "Members",
|
||||
"privacy": "Privacy",
|
||||
"invites": "Invites",
|
||||
"forum": "Forum",
|
||||
"verification": "Verification"
|
||||
},
|
||||
"general": {
|
||||
"title": "General",
|
||||
"name": "Name",
|
||||
"description": "Description",
|
||||
"saveTeam": "Save Team",
|
||||
"modifyPicture": "Modify Team avatar"
|
||||
},
|
||||
"roles": {
|
||||
"title": "Roles",
|
||||
"addRole": "Add Role",
|
||||
"saveOrder": "Save role order",
|
||||
"modifying": "Modifying",
|
||||
"name": "Chosen role name",
|
||||
"permissions": "Permissions",
|
||||
"creating": "Creating a role"
|
||||
},
|
||||
"members": {
|
||||
"title": "Members",
|
||||
"modifyRoles": "Modify user roles",
|
||||
"removeAllRoles": "Remove all roles from user"
|
||||
},
|
||||
"privacy": {
|
||||
"title": "Team Privacy",
|
||||
"teamWall": "Opt out of team walls",
|
||||
"disallowForum": "Disallow anyone from viewing/creating on your Team Forum"
|
||||
},
|
||||
"invites": {
|
||||
"title": "Invites",
|
||||
"code": "Code",
|
||||
"uses": "Uses",
|
||||
"maxUses": "Max Uses",
|
||||
"createdBy": "Created by",
|
||||
"date": "Date",
|
||||
"delete": "Delete selected",
|
||||
"generate": "Generate invite"
|
||||
},
|
||||
"invite": {
|
||||
"title": "Invite people to",
|
||||
"amountUses": "Amount of uses (0 is Unlimited)",
|
||||
"role": "Please select a role for the user to be auto assigned (optional)",
|
||||
"refresh": "Refresh",
|
||||
"inviteURL": "Invite URL",
|
||||
"domain": "https://kaverti.com/invite/"
|
||||
}
|
||||
},
|
||||
"permissionTypes": {
|
||||
"inviteUsers": "Invite users",
|
||||
"administrator": "Administrator",
|
||||
"modifyRoles": "Modify roles/permissions/users",
|
||||
"modifyTeamSettings": "Modify team settings",
|
||||
"teamForum": "Modify team forum configuration",
|
||||
"forumModerator": "Forum moderation permissions",
|
||||
"forumAdmin": "Forum administrator",
|
||||
"submitMarketplace": "Submit Marketplace items",
|
||||
"priorityValue": "Set priority value"
|
||||
}
|
||||
},
|
||||
"navbar": {
|
||||
"home": "Home",
|
||||
"forums": "Forums",
|
||||
|
@ -60,12 +145,13 @@
|
|||
"auth": "Test authentication"
|
||||
},
|
||||
"errors": {
|
||||
"authFail": "Request failed, you are not authenticated.",
|
||||
"authFail": "Request failed, you are not authenticated. (Is API blocked?)",
|
||||
"devBuild": "Warning: You are using a development build of Kaverti, expect instabilities.",
|
||||
"disableDebug": "Debug mode disabled, you will no longer have access to development features until you refresh.",
|
||||
"authSuccess": "Request successful, your token is valid, and the Kaverti server instance is running correctly."
|
||||
},
|
||||
"close": "Close",
|
||||
"tos": "Terms of Service",
|
||||
"gotIt": "Got it!",
|
||||
"errorModalTitle": "Something went wrong..."
|
||||
}
|
Loading…
Reference in a new issue