Added translation strings context

This commit is contained in:
Jo Vuit 2019-02-11 14:31:43 +01:00
parent a72f10737b
commit 02b2d3d749
1 changed files with 20 additions and 20 deletions

View File

@ -1,43 +1,43 @@
<template> <template>
<form class="ui form" @submit.prevent="submit"> <form class="ui form" @submit.prevent="submit">
<p v-if="!library"><translate>Libraries help you organize and share your music collections. You can upload your own music collection to Funkwhale and share it with your friends and family.</translate></p> <p v-if="!library"><translate :translate-context="'Content/Library/Paragraph'">Libraries help you organize and share your music collections. You can upload your own music collection to Funkwhale and share it with your friends and family.</translate></p>
<div v-if="errors.length > 0" class="ui negative message"> <div v-if="errors.length > 0" class="ui negative message">
<div class="header"><translate>Error</translate></div> <div class="header"><translate :translate-context="'Content/Library/Error message.Title'">Error</translate></div>
<ul class="list"> <ul class="list">
<li v-for="error in errors">{{ error }}</li> <li v-for="error in errors">{{ error }}</li>
</ul> </ul>
</div> </div>
<div class="required field"> <div class="required field">
<label><translate>Name</translate></label> <label><translate :translate-context="'Content/Library/Input.Label'">Name</translate></label>
<input name="name" v-model="currentName" :placeholder="labels.namePlaceholder" required maxlength="100"> <input name="name" v-model="currentName" :placeholder="labels.namePlaceholder" required maxlength="100">
</div> </div>
<div class="field"> <div class="field">
<label><translate>Description</translate></label> <label><translate :translate-context="'Content/Library/Input.Label'">Description</translate></label>
<textarea v-model="currentDescription" :placeholder="labels.descriptionPlaceholder" maxlength="2000"></textarea> <textarea v-model="currentDescription" :placeholder="labels.descriptionPlaceholder" maxlength="2000"></textarea>
</div> </div>
<div class="field"> <div class="field">
<label><translate>Visibility</translate></label> <label><translate :translate-context="'Content/Library/Dropdown.Label'">Visibility</translate></label>
<p><translate>You are able to share your library with other people, regardless of its visibility.</translate></p> <p><translate :translate-context="'Content/Library/Paragraph'">You are able to share your library with other people, regardless of its visibility.</translate></p>
<select class="ui dropdown" v-model="currentVisibilityLevel"> <select class="ui dropdown" v-model="currentVisibilityLevel">
<option :value="c" v-for="c in ['me', 'instance', 'everyone']">{{ labels.visibility[c] }}</option> <option :value="c" v-for="c in ['me', 'instance', 'everyone']">{{ labels.visibility[c] }}</option>
</select> </select>
</div> </div>
<button class="ui submit button" type="submit"> <button class="ui submit button" type="submit">
<translate v-if="library">Update library</translate> <translate :translate-context="'Content/Library/Button.Label/Verb'" v-if="library">Update library</translate>
<translate v-else>Create library</translate> <translate :translate-context="'Content/Library/Button.Label/Verb'" v-else>Create library</translate>
</button> </button>
<dangerous-button v-if="library" class="right floated basic button" color='red' @confirm="remove()"> <dangerous-button v-if="library" class="right floated basic button" color='red' @confirm="remove()">
<translate>Delete</translate> <translate :translate-context="'Content/Library/Button.Label/Verb'">Delete</translate>
<p slot="modal-header"> <p slot="modal-header">
<translate>Delete this library?</translate> <translate :translate-context="'Popup/Library/Title'">Delete this library?</translate>
</p> </p>
<p slot="modal-content"> <p slot="modal-content">
<translate> <translate :translate-context="'Popup/Library/Paragraph'">
The library and all its tracks will be deleted. This can not be undone. The library and all its tracks will be deleted. This can not be undone.
</translate> </translate>
</p> </p>
<p slot="modal-confirm"> <p slot="modal-confirm">
<translate>Delete library</translate> <translate :translate-context="'Popup/Library/Button.Label/Verb'">Delete library</translate>
</p> </p>
</dangerous-button> </dangerous-button>
</form> </form>
@ -67,11 +67,11 @@ export default {
}, },
computed: { computed: {
labels () { labels () {
let namePlaceholder = this.$gettext('My awesome library') let namePlaceholder = this.$pgettext('Content/Library/Input.Placeholder', 'My awesome library')
let descriptionPlaceholder = this.$gettext('This library contains my personal music, I hope you like it.') let descriptionPlaceholder = this.$pgettext('Content/Library/Input.Placeholder', 'This library contains my personal music, I hope you like it.')
let me = this.$gettext('Nobody except me') let me = this.$pgettext('Content/Library/Dropdown', 'Nobody except me')
let instance = this.$gettext('Everyone on this instance') let instance = this.$pgettext('Content/Library/Dropdown', 'Everyone on this instance')
let everyone = this.$gettext('Everyone, across all instances') let everyone = this.$pgettext('Content/Library/Dropdown', 'Everyone, across all instances')
return { return {
namePlaceholder, namePlaceholder,
descriptionPlaceholder, descriptionPlaceholder,
@ -103,10 +103,10 @@ export default {
let msg let msg
if (self.library) { if (self.library) {
self.$emit('updated', response.data) self.$emit('updated', response.data)
msg = this.$gettext('Library updated') msg = this.$pgettext('Content/Library/Message', 'Library updated')
} else { } else {
self.$emit('created', response.data) self.$emit('created', response.data)
msg = this.$gettext('Library created') msg = this.$pgettext('Content/Library/Message', 'Library created')
} }
self.$store.commit('ui/addMessage', { self.$store.commit('ui/addMessage', {
content: msg, content: msg,
@ -126,7 +126,7 @@ export default {
let self = this let self = this
axios.delete(`libraries/${this.library.uuid}/`).then((response) => { axios.delete(`libraries/${this.library.uuid}/`).then((response) => {
self.isLoading = false self.isLoading = false
let msg = this.$gettext('Library deleted') let msg = this.$pgettext('Content/Library/Message', 'Library deleted')
self.$emit('deleted', {}) self.$emit('deleted', {})
self.$store.commit('ui/addMessage', { self.$store.commit('ui/addMessage', {
content: msg, content: msg,