Resolve "Add contexts to translatable strings to Album page"

This commit is contained in:
jovuit 2019-02-08 09:57:52 +01:00 committed by Eliot Berriot
parent 0af3310654
commit 19ba7ed988
2 changed files with 15 additions and 13 deletions

View File

@ -434,6 +434,7 @@ This hierarchical structure is made of several parts:
- ``Menu``
- ``Modal``
- ``Sidebar``
- ``Popup``
- ``*`` for strings that are not tied to a specific location
- The feature part, which is required, and refers to the feature associated with the translated string:

View File

@ -14,33 +14,33 @@
</div>
<div class="ui buttons">
<router-link class="ui button" :to="{name: 'library.artists.detail', params: {id: album.artist.id }}">
<translate>Artist page</translate>
<translate :translate-context="'Content/*/Button.Label/Name'">Artist page</translate>
</router-link>
</div>
</h2>
<div class="ui hidden divider"></div>
<play-button class="orange" :tracks="album.tracks">
<translate>Play all</translate>
<translate :translate-context="'Content/*/Button.Label/Verb, Short'">Play all</translate>
</play-button>
<a :href="wikipediaUrl" target="_blank" class="ui button">
<i class="wikipedia w icon"></i>
<translate>Search on Wikipedia</translate>
<translate :translate-context="'Content/*/Button.Label/Verb'">Search on Wikipedia</translate>
</a>
<a v-if="musicbrainzUrl" :href="musicbrainzUrl" target="_blank" class="ui button">
<i class="external icon"></i>
<translate>View on MusicBrainz</translate>
<translate :translate-context="'Content/*/Button.Label/Verb'">View on MusicBrainz</translate>
</a>
<template v-if="publicLibraries.length > 0">
<button
@click="showEmbedModal = !showEmbedModal"
class="ui button">
<i class="code icon"></i>
<translate>Embed</translate>
<translate :translate-context="'Content/*/Button.Label/Verb'">Embed</translate>
</button>
<modal :show.sync="showEmbedModal">
<div class="header">
<translate>Embed this album on your website</translate>
<translate :translate-context="'Popup/Album/Title/Verb'">Embed this album on your website</translate>
</div>
<div class="content">
<div class="description">
@ -50,7 +50,7 @@
</div>
<div class="actions">
<div class="ui deny button">
<translate>Cancel</translate>
<translate :translate-context="'Popup/*/Button.Label/Verb'">Cancel</translate>
</div>
</div>
</modal>
@ -63,9 +63,10 @@
tag="h2"
class="left floated"
:translate-params="{number: disc_number + 1}"
:translate-context="'Content/Album/'"
>Volume %{ number }</translate>
<play-button class="right floated orange" :tracks="tracks">
<translate>Play all</translate>
<translate :translate-context="'Content/*/Button.Label/Verb, Short'">Play all</translate>
</play-button>
<track-table :artist="album.artist" :display-position="true" :tracks="tracks"></track-table>
</section>
@ -73,17 +74,17 @@
<template v-else>
<section class="ui vertical stripe segment">
<h2>
<translate>Tracks</translate>
<translate :translate-context="'Content/*/Title/Name'">Tracks</translate>
</h2>
<track-table v-if="album" :artist="album.artist" :display-position="true" :tracks="album.tracks"></track-table>
</section>
</template>
<section class="ui vertical stripe segment">
<h2>
<translate>User libraries</translate>
<translate :translate-context="'Content/*/Title/Name'">User libraries</translate>
</h2>
<library-widget @loaded="libraries = $event" :url="'albums/' + id + '/libraries/'">
<translate slot="subtitle">This album is present in the following libraries:</translate>
<translate slot="subtitle" :translate-context="'Content/Album/Paragraph'">This album is present in the following libraries:</translate>
</library-widget>
</section>
</template>
@ -150,7 +151,7 @@ export default {
computed: {
labels() {
return {
title: this.$gettext("Album")
title: this.$pgettext('Head/Album/Title/Name', 'Album')
}
},
publicLibraries () {
@ -180,7 +181,7 @@ export default {
)
},
subtitle () {
let msg = this.$ngettext('Album containing %{ count } track, by %{ artist }', 'Album containing %{ count } tracks, by %{ artist }', this.album.tracks.length)
let msg = this.$npgettext('Content/Album/Header.Title', 'Album containing %{ count } track, by %{ artist }', 'Album containing %{ count } tracks, by %{ artist }', this.album.tracks.length)
return this.$gettextInterpolate(msg, {count: this.album.tracks.length, artist: this.album.artist.name})
}
},