Localise categories

This commit is contained in:
Matt Rider 2019-08-14 13:57:39 +02:00
parent f711a9c288
commit ee93efd6d9
9 changed files with 67 additions and 16 deletions

View File

@ -180,13 +180,13 @@ import Factory from './factories'
f.create('Category', {
id: 'cat1',
name: 'Just For Fun',
slug: 'justforfun',
slug: 'just-for-fun',
icon: 'smile',
}),
f.create('Category', {
id: 'cat2',
name: 'Happyness & Values',
slug: 'happyness-values',
name: 'Happiness & Values',
slug: 'happiness-values',
icon: 'heart-o',
}),
f.create('Category', {
@ -204,13 +204,13 @@ import Factory from './factories'
f.create('Category', {
id: 'cat5',
name: 'Animal Protection',
slug: 'animalprotection',
slug: 'animal-protection',
icon: 'paw',
}),
f.create('Category', {
id: 'cat6',
name: 'Humanrights Justice',
slug: 'humanrights-justice',
name: 'Human Rights & Justice',
slug: 'human-rights-justice',
icon: 'balance-scale',
}),
f.create('Category', {
@ -246,19 +246,19 @@ import Factory from './factories'
f.create('Category', {
id: 'cat12',
name: 'IT, Internet & Data Privacy',
slug: 'it-internet-dataprivacy',
slug: 'it-internet-data-privacy',
icon: 'mouse-pointer',
}),
f.create('Category', {
id: 'cat13',
name: 'Art, Curlure & Sport',
name: 'Art, Culture & Sport',
slug: 'art-culture-sport',
icon: 'paint-brush',
}),
f.create('Category', {
id: 'cat14',
name: 'Freedom of Speech',
slug: 'freedomofspeech',
slug: 'freedom-of-speech',
icon: 'bullhorn',
}),
f.create('Category', {
@ -270,7 +270,7 @@ import Factory from './factories'
f.create('Category', {
id: 'cat16',
name: 'Global Peace & Nonviolence',
slug: 'globalpeace-nonviolence',
slug: 'global-peace-nonviolence',
icon: 'angellist',
}),
])

View File

@ -43,11 +43,13 @@ c.updatedAt = category.updatedAt.`$date`
MATCH (c:Category)
WHERE (c.icon = "categories-justforfun")
SET c.icon = 'smile'
SET c.slug = 'just-for-fun'
;
MATCH (c:Category)
WHERE (c.icon = "categories-luck")
SET c.icon = 'heart-o'
SET c.slug = 'happiness-values'
;
MATCH (c:Category)
@ -63,11 +65,14 @@ SET c.icon = 'tree'
MATCH (c:Category)
WHERE (c.icon = "categories-animal-justice")
SET c.icon = 'paw'
SET c.slug = 'animal-protection'
;
MATCH (c:Category)
WHERE (c.icon = "categories-human-rights")
SET c.icon = 'balance-scale'
SET c.slug = 'human-rights-justice'
;
MATCH (c:Category)
@ -98,6 +103,7 @@ SET c.icon = 'flash'
MATCH (c:Category)
WHERE (c.icon = "categories-internet")
SET c.icon = 'mouse-pointer'
SET c.slug = 'it-internet-data-privacy'
;
MATCH (c:Category)
@ -108,6 +114,7 @@ SET c.icon = 'paint-brush'
MATCH (c:Category)
WHERE (c.icon = "categories-freedom-of-speech")
SET c.icon = 'bullhorn'
SET c.slug = 'freedom-of-speech'
;
MATCH (c:Category)
@ -118,4 +125,5 @@ SET c.icon = 'shopping-cart'
MATCH (c:Category)
WHERE (c.icon = "categories-peace")
SET c.icon = 'angellist'
SET c.slug = 'global-peace-nonviolence'
;

View File

@ -117,7 +117,7 @@ MERGE (e:EmailAddress {
verifiedAt: toString(datetime())
})
MERGE (e)-[:BELONGS_TO]->(u)
MERGE (u)<-[:PRIMARY_EMAIL]-(e)
MERGE (u)-[:PRIMARY_EMAIL]->(e)
WITH u, user, user.badgeIds AS badgeIds
UNWIND badgeIds AS badgeId
MATCH (b:Badge {id: badgeId})

View File

@ -10,7 +10,7 @@
:disabled="isDisabled(category.id)"
>
<ds-icon :name="category.icon" />
{{ category.name }}
{{ $t(`contribution.category.name.${category.slug}`) }}
</ds-button>
</ds-flex-item>
</div>
@ -88,6 +88,7 @@ export default {
return CategoryQuery()
},
result(result) {
console.log('result', result)
this.categories = result.data.Category
},
},

View File

@ -5,7 +5,7 @@
<ds-heading tag="h4">{{ $t('filter-posts.categories.header') }}</ds-heading>
<ds-space margin-bottom="large" />
</ds-flex>
<ds-flex>
<ds-flex :gutter="{ lg: 'small' }">
<ds-flex-item
:width="{ base: '100%', sm: '100%', md: '100%', lg: '5%' }"
class="categories-menu-item"
@ -47,7 +47,9 @@
</ds-flex-item>
<ds-flex>
<ds-flex-item class="categories-menu-item">
<label class="category-labels">{{ category.name }}</label>
<label class="category-labels">
{{ $t(`contribution.category.name.${category.slug}`) }}
</label>
</ds-flex-item>
<ds-space margin-bottom="xx-large" />
</ds-flex>

View File

@ -4,7 +4,7 @@ export default () => {
return gql(`{
Category {
id
name
slug
icon
}
}`)

View File

@ -436,6 +436,26 @@
"cry": "Zum Weinen",
"angry": "Verärgert",
"emoted": "angegeben"
},
"category": {
"name": {
"freedom-of-speech": "Redefreiheit",
"consumption-sustainability": "Verbrauch & Nachhaltigkeit",
"global-peace-nonviolence": "Globaler Frieden & Gewaltlosigkeit",
"just-for-fun": "Nur zum Spaß",
"happiness-values": "Glück & Werte",
"health-wellbeing": "Gesundheit & Wohlbefinden",
"environment-nature": "Umwelt & Natur",
"animal-protection": "Schutz der Tiere",
"human-rights-justice": "Menschenrechte & Gerechtigkeit",
"education-sciences": "Bildung & Wissenschaft",
"cooperation-development": "Zusammenarbeit & Entwicklung",
"democracy-politics": "Demokratie & Politik",
"economy-finances": "Wirtschaft & Finanzen",
"energy-technology": "Energie & Technologie",
"it-internet-data-privacy": "IT, Internet & Datenschutz",
"art-culture-sport": "Kunst, Kultur & Sport"
}
}
},
"changelog": {

View File

@ -436,6 +436,26 @@
"cry": "Cry",
"angry": "Angry",
"emoted": "emoted"
},
"category": {
"name": {
"freedom-of-speech": "Freedom of Speech",
"consumption-sustainability": "Consumption & Sustainability",
"global-peace-nonviolence": "Global Peace & Nonviolence",
"just-for-fun": "Just for Fun",
"happiness-values": "Happiness & Values",
"health-wellbeing": "Health & Wellbeing",
"environment-nature": "Environment & Nature",
"animal-protection": "Animal Protection",
"human-rights-justice": "Human Rights & Justice",
"education-sciences": "Education & Sciences",
"cooperation-development": "Cooperation & Development",
"democracy-politics": "Democracy & Politics",
"economy-finances": "Economy & Finances",
"energy-technology": "Energy & Technology",
"it-internet-data-privacy": "IT, Internet & Data Privacy",
"art-culture-sport": "Art, Culture, & Sport"
}
}
},
"changelog": {