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>
|
<h1>© 2021 Kaverti</h1>
|
||||||
<div class="locale-changer">
|
<div class="locale-changer">
|
||||||
Lang:
|
Lang:
|
||||||
<select v-model="$i18n.locale">
|
<b-button @click="en">en</b-button>
|
||||||
<option v-for="(lang, i) in langs" :key="`Lang${i}`" :value="lang">{{ lang }}</option>
|
<b-button @click="wind">wind</b-button>
|
||||||
</select>
|
<b-button @click="debug">debug</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import AjaxErrorHandler from '../../assets/js/errorHandler'
|
||||||
export default {
|
export default {
|
||||||
name: 'locale-changer',
|
name: 'locale-changer',
|
||||||
data () {
|
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>
|
</script>
|
|
@ -15,7 +15,7 @@
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<b-button
|
<b-button
|
||||||
:label="$t('gotIt')"
|
:label="$t('gotIt')"
|
||||||
@click="$emit('close')" />
|
@click="ajaxErrorModal = false" />
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="delete"
|
class="delete"
|
||||||
@click="$emit('close')"/>
|
@click="loginModal = false"/>
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-field :label="$t('login.loginUsername')">
|
<b-field :label="$t('login.loginUsername')">
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
type="is-primary" />
|
type="is-primary" />
|
||||||
<b-button
|
<b-button
|
||||||
:label="$t('close')"
|
:label="$t('close')"
|
||||||
@click="$emit('close')" />
|
@click="loginModal = false" />
|
||||||
<b-button
|
<b-button
|
||||||
@click="registerModal = true; loginModal = false"
|
@click="registerModal = true; loginModal = false"
|
||||||
:label="$t('login.register')"
|
:label="$t('login.register')"
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="delete"
|
class="delete"
|
||||||
@click="$emit('close')"/>
|
@click="registerModal = false"/>
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
<b-field :label="$t('register.username')">
|
<b-field :label="$t('register.username')">
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
type="is-primary" />
|
type="is-primary" />
|
||||||
<b-button
|
<b-button
|
||||||
:label="$t('close')"
|
:label="$t('close')"
|
||||||
@click="$emit('close')" />
|
@click="registerModal = false" />
|
||||||
<b-button
|
<b-button
|
||||||
@click="registerModal = false; loginModal = true"
|
@click="registerModal = false; loginModal = true"
|
||||||
:label="$t('register.login')"
|
:label="$t('register.login')"
|
||||||
|
@ -299,7 +299,7 @@ export default {
|
||||||
this.$store.commit('setID', res.data.id)
|
this.$store.commit('setID', res.data.id)
|
||||||
this.$store.commit('setBot', res.data.bot)
|
this.$store.commit('setBot', res.data.bot)
|
||||||
}).catch(() => {
|
}).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 => {
|
}).catch(e => {
|
||||||
this.login.loading = false
|
this.login.loading = false
|
||||||
|
@ -314,7 +314,7 @@ export default {
|
||||||
this.$store.commit('setID', res.data.id)
|
this.$store.commit('setID', res.data.id)
|
||||||
this.$store.commit('setBot', res.data.bot)
|
this.$store.commit('setBot', res.data.bot)
|
||||||
}).catch(() => {
|
}).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) => {
|
AjaxErrorHandler(this.$store)(e, (error, errors) => {
|
||||||
|
@ -353,7 +353,7 @@ export default {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
localStorage.setItem('userCache', JSON.stringify(this.$store.state.user));
|
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
|
this.loading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,91 @@
|
||||||
"login": "Already have a Kaverti account?",
|
"login": "Already have a Kaverti account?",
|
||||||
"agree": "Do you agree to the "
|
"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": {
|
"navbar": {
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"forums": "Forums",
|
"forums": "Forums",
|
||||||
|
@ -60,12 +145,13 @@
|
||||||
"auth": "Test authentication"
|
"auth": "Test authentication"
|
||||||
},
|
},
|
||||||
"errors": {
|
"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.",
|
"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.",
|
"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."
|
"authSuccess": "Request successful, your token is valid, and the Kaverti server instance is running correctly."
|
||||||
},
|
},
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"tos": "Terms of Service",
|
"tos": "Terms of Service",
|
||||||
|
"gotIt": "Got it!",
|
||||||
"errorModalTitle": "Something went wrong..."
|
"errorModalTitle": "Something went wrong..."
|
||||||
}
|
}
|
Loading…
Reference in a new issue