Skip to content

Commit

Permalink
Tab-alpha's Aria tag translations (#1741)
Browse files Browse the repository at this point in the history
Add translations for the Aria tags in the tab-alpha page template.

Thanks for the review @osma
  • Loading branch information
miguelvaara authored Jan 29, 2025
1 parent 45717fd commit 210559f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
8 changes: 6 additions & 2 deletions resource/js/tab-alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ function startAlphaApp () {
computed: {
loadingMessage () {
return $t('Loading more items')
},
toConceptPageAriaMessage () {
return $t('Go to the concept page')
}
},
provide () {
Expand Down Expand Up @@ -145,6 +148,7 @@ function startAlphaApp () {
:loading-more-concepts="loadingMoreConcepts"
:loading-message="loadingMessage"
:list-style="listStyle"
:to-concept-page-aria-message="toConceptPageAriaMessage"
@load-concepts="loadConcepts($event)"
@select-concept="selectedConcept = $event"
ref="tabAlpha"
Expand Down Expand Up @@ -180,7 +184,7 @@ function startAlphaApp () {
})

tabAlphaApp.component('tab-alpha', {
props: ['indexLetters', 'indexConcepts', 'selectedConcept', 'loadingLetters', 'loadingConcepts', 'loadingMoreConcepts', 'loadingMessage', 'listStyle'],
props: ['indexLetters', 'indexConcepts', 'selectedConcept', 'loadingLetters', 'loadingConcepts', 'loadingMoreConcepts', 'loadingMessage', 'listStyle', 'toConceptPageAriaMessage'],
emits: ['loadConcepts', 'selectConcept'],
inject: ['partialPageLoad', 'getConceptURL', 'showNotation'],
methods: {
Expand Down Expand Up @@ -222,7 +226,7 @@ function startAlphaApp () {
</template>
<a :class="{ 'selected': selectedConcept === concept.uri }"
:href="getConceptURL(concept.uri)" @click="loadConcept($event, concept.uri)"
aria-label="Go to the concept page"
:aria-label="toConceptPageAriaMessage"
>
{{ concept.prefLabel }}{{ showNotation && concept.qualifier ? ' (' + concept.qualifier + ')' : '' }}
</a>
Expand Down
6 changes: 5 additions & 1 deletion resource/translations/messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,9 @@
"Information": "Information",
"Breadcrumbs": "Breadcrumbs",
"Copy to clipboard": "Copy to clipboard",
"Error": "Error"
"Error": "Error",
"Go to the concept page": "Go to the concept page",
"Download this concept": "Download this concept",
"Concept %term% in vocabulary %vocab%": "Concept %term% in vocabulary %vocab%",
"More information about this term": "More information about this term"
}
1 change: 1 addition & 0 deletions resource/translations/messages.fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"Error: Term \"%term%\" not found in vocabulary!": "Virhe: Termi\u00e4 \"%term%\" ei l\u00f6ydy sanastosta!",
"Feedback": "Palaute",
"Feedback has been sent!": "Palaute on l\u00e4hetetty!",
"Go to the concept page": "Mene käsitesivulle",
"Group index": "Ryhm\u00e4hakemisto",
"Group-nav": "Ryhm\u00e4t",
"Help": "Ohje",
Expand Down
1 change: 1 addition & 0 deletions resource/translations/messages.sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"Error: Term \"%term%\" not found in vocabulary!": "Fel: Termen \"%term\" finns inte i vokabul\u00e4ren!",
"Feedback": "Respons",
"Feedback has been sent!": "Respons har skickats!",
"Go to the concept page": "Gå till begreppsidan",
"Group index": "Gruppindex",
"Group-nav": "Gruppindex",
"Help": "Hj\u00e4lp",
Expand Down
9 changes: 9 additions & 0 deletions tests/cypress/template/sidebar-alpha.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,13 @@ describe('Alphabetical index', () => {
// check that the second mapping property has the right number of entries
cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').should('have.length', 3)
})
// Check the correctness of Aria-labels (Sami language will be implemented later)"
it('Aria tags are correct for each language', () => {
cy.visit('/yso/en/')
cy.get('#tab-alphabetical .list-group-item > a').should('have.attr', 'aria-label', 'Go to the concept page')
cy.visit('/yso/sv/')
cy.get('#tab-alphabetical .list-group-item > a').should('have.attr', 'aria-label', 'Gå till begreppsidan')
cy.visit('/yso/fi/')
cy.get('#tab-alphabetical .list-group-item > a').should('have.attr', 'aria-label', 'Mene käsitesivulle')
})
})

0 comments on commit 210559f

Please sign in to comment.