locale via config

This commit is contained in:
lesion
2019-06-10 01:25:05 +02:00
parent b01f4ef04d
commit 50de4e8ebb
16 changed files with 52 additions and 55 deletions

View File

@@ -25,7 +25,7 @@ html, body {
// } // }
.el-card { .el-card {
max-width: 650px; max-width: 670px;
margin: 30px auto; margin: 30px auto;
} }

View File

@@ -16,7 +16,7 @@
el-popover( el-popover(
placement="bottom" placement="bottom"
trigger="click") trigger="click")
Search Search(past-filter)
el-menu-item(slot='reference') el-menu-item(slot='reference')
v-icon(color='lightblue' name='search') v-icon(color='lightblue' name='search')

View File

@@ -1,12 +1,13 @@
<template lang="pug"> <template lang="pug">
div.ml-2.mt-1 div.ml-2.mt-1.text-center
el-switch.mb-1(v-if='$auth.loggedIn' //- el-switch.mb-1(v-if='$auth.loggedIn'
active-text='solo miei' //- active-text='solo miei'
inactive-text='tutti' //- inactive-text='tutti'
inactive-color='lightgreen' //- inactive-color='lightgreen'
v-model='onlyMine' //- v-model='onlyMine'
) //- )
el-switch.mt-1.mb-1.ml-2.d-block( el-switch.mt-1.mb-1.ml-2.d-block(
v-if='pastFilter'
inactive-text='futuri' inactive-text='futuri'
active-text='anche passati' active-text='anche passati'
inactive-color='lightgreen' inactive-color='lightgreen'
@@ -30,6 +31,9 @@ export default {
} }
}, },
name :'Search', name :'Search',
props: {
pastFilter: Boolean
},
methods: mapActions(['setSearchPlaces', 'setSearchTags', 'showPastEvents']), methods: mapActions(['setSearchPlaces', 'setSearchTags', 'showPastEvents']),
computed: { computed: {
...mapState(['tags', 'places', 'filters', 'show_past_events']), ...mapState(['tags', 'places', 'filters', 'show_past_events']),

View File

@@ -5,5 +5,7 @@
"register.request": "register.request", "register.request": "register.request",
"email.registration": "email.registration", "email.registration": "email.registration",
"email.register.subject": "email.register.subject", "email.register.subject": "email.register.subject",
"email.register": "email.register" "email.register": "email.register",
"confirm_email": "confirm_email",
"email.confirm": "email.confirm"
} }

View File

@@ -5,5 +5,7 @@
"register.request": "register.request", "register.request": "register.request",
"email.registration": "email.registration", "email.registration": "email.registration",
"email.register.subject": "email.register.subject", "email.register.subject": "email.register.subject",
"email.register": "email.register" "email.register": "email.register",
"confirm_email": "confirm_email",
"email.confirm": "email.confirm"
} }

View File

@@ -3,5 +3,5 @@
"press here": "press here", "press here": "press here",
"email.register.subject": "Richiesta registrazione ricevuta", "email.register.subject": "Richiesta registrazione ricevuta",
"email.register": "Abbiamo ricevuto la richiesta di registrazione. La confermeremo quanto prima.\n Ciao", "email.register": "Abbiamo ricevuto la richiesta di registrazione. La confermeremo quanto prima.\n Ciao",
"email.registration": "email.registration" "email.confirm": "Il tuo account su gancio è stato attivato e quindi puoi cominciare a pubblicare eventi"
} }

View File

@@ -5,5 +5,7 @@
"register.request": "register.request", "register.request": "register.request",
"email.registration": "email.registration", "email.registration": "email.registration",
"email.register.subject": "email.register.subject", "email.register.subject": "email.register.subject",
"email.register": "email.register" "email.register": "email.register",
"confirm_email": "confirm_email",
"email.confirm": "email.confirm"
} }

View File

@@ -38,7 +38,8 @@ module.exports = {
env: { env: {
baseurl: config.baseurl, baseurl: config.baseurl,
title: config.title, title: config.title,
description: config.description description: config.description,
locale: config.locale
}, },
/* /*
** Plugins to load before mounting the App ** Plugins to load before mounting the App

View File

@@ -1,7 +1,8 @@
<template lang="pug"> <template lang="pug">
el-card el-card
nuxt-link.float-right(to='/') nuxt-link.float-right(to='/')
v-icon(name='times' color='red') el-button
v-icon(name='times' color='red')
h5 {{edit?$t('common.edit_event'):$t('common.add_event')}} h5 {{edit?$t('common.edit_event'):$t('common.add_event')}}
el-form(v-loading='loading') el-form(v-loading='loading')

View File

@@ -1,10 +1,11 @@
<template lang="pug"> <template lang="pug">
el-card el-card
nuxt-link.float-right(to='/') nuxt-link.float-right(to='/')
v-icon(name='times' color='red') el-button
v-icon(name='times' color='red')
h5 {{$t('common.admin')}} h5 {{$t('common.admin')}}
el-tabs(tabPosition='left' v-model='tab') el-tabs(tabPosition='lef' v-model='tab')
//- USERS //- USERS
el-tab-pane.pt-1 el-tab-pane.pt-1
@@ -94,11 +95,11 @@
//- el-input(v-model="settings.description") //- el-input(v-model="settings.description")
//- el-button(slot='append' @click='associate' :disabled='!mastodon_instance.length') {{$t('common.associate')}} //- el-button(slot='append' @click='associate' :disabled='!mastodon_instance.length') {{$t('common.associate')}}
el-form(inline @submit.prevent.stop='associatemastodon_instance') el-form(inline @submit.native.prevent='associate_mastondon_instance' label-width='140px')
span {{$t('admin.mastodon_description')}} p {{$t('admin.mastodon_description')}}
el-input(v-model="settings.mastodon_instance") el-form-item {{$t('admin.mastodon_instance')}}
span(slot='prepend') {{$t('admin.mastodon_instance')}} el-input(v-model="mastodon_instance")
el-button(slot='append' @click='associate' :disabled='!mastodon_instance.length') {{$t('common.associate')}} el-button(slot='append' native-type='submit' type='success' :disabled='!mastodon_instance.length') {{$t('common.associate')}}
</template> </template>
<script> <script>
@@ -125,9 +126,8 @@ export default {
events: [], events: [],
loading: false, loading: false,
settings: { settings: {
mastodon_instance: '',
}, },
settings: {}, mastodon_instance: '',
tab: "0", tab: "0",
open: true open: true
} }
@@ -146,7 +146,7 @@ export default {
const events = await $axios.$get('/event/unconfirmed') const events = await $axios.$get('/event/unconfirmed')
const settings = await $axios.$get('/settings') const settings = await $axios.$get('/settings')
return { users, events, settings, mastodon_instance: settings && settings.mastodon_auth && settings.mastodon_auth.instance || ''} return { users, events, settings}
} catch ( e ) { } catch ( e ) {
console.error(e) console.error(e)
} }
@@ -185,28 +185,23 @@ export default {
this.tag = { color: tag.color, tag: tag.tag } this.tag = { color: tag.color, tag: tag.tag }
}, },
async savePlace () { async savePlace () {
// const place = await api.updatePlace(this.place) const place = await this.$axios.$put('/place', this.place)
}, },
async toggle(user) { async toggle(user) {
user.is_active = !user.is_active user.is_active = !user.is_active
this.$axios.$put('/user', user)
// const newuser = await api.updateUser(user) // const newuser = await api.updateUser(user)
}, },
async toggleAdmin(user) { async toggleAdmin(user) {
user.is_admin = !user.is_admin user.is_admin = !user.is_admin
this.$axios.$put('/user', user)
// const newuser = await api.updateUser(user) // const newuser = await api.updateUser(user)
}, },
async updateColor () {
// try {
// const newTag = await this.$axios.$put('/tag', this.tag)
// } catch (e) {
// console.log(e)
// }
},
preview (id) { preview (id) {
this.$router.push(`/event/${id}`) this.$router.push(`/event/${id}`)
}, },
async associate () { async associate_mastondon_instance () {
if (!this.mastodon_instance) return if (!this.mastodon_instance) return false
const url = await this.$axios.$post('/settings/getauthurl', {instance: this.mastodon_instance}) const url = await this.$axios.$post('/settings/getauthurl', {instance: this.mastodon_instance})
setTimeout( () => window.location.href=url, 100); setTimeout( () => window.location.href=url, 100);

View File

@@ -2,7 +2,8 @@
el-card el-card
nuxt-link.float-right(to='/') nuxt-link.float-right(to='/')
v-icon(name='times' color='red') el-button
v-icon(name='times' color='red')
h5 {{$t('common.export')}} h5 {{$t('common.export')}}

View File

@@ -1,7 +1,8 @@
<template lang="pug"> <template lang="pug">
el-card el-card
nuxt-link.float-right(to='/') nuxt-link.float-right(to='/')
v-icon(name='times' color='red') el-button
v-icon(name='times' color='red')
h5 {{$t('common.settings')}} h5 {{$t('common.settings')}}
//- el-form //- el-form
@@ -34,10 +35,6 @@ export default {
console.log(e) console.log(e)
} }
}, },
close (done) {
this.$router.back()
done()
}
} }
} }
</script> </script>

View File

@@ -1,7 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import moment from 'dayjs' import moment from 'dayjs'
import 'dayjs/locale/it' import 'dayjs/locale/it'
moment.locale('it') moment.locale(process.env.locale)
function short_hour(datetime) { function short_hour(datetime) {
if (datetime.minute() === 0) { if (datetime.minute() === 0) {

View File

@@ -8,18 +8,10 @@ export default ({ app, store }) => {
// Set i18n instance on app // Set i18n instance on app
// This way we can use it in middleware and pages asyncData/fetch // This way we can use it in middleware and pages asyncData/fetch
app.i18n = new VueI18n({ app.i18n = new VueI18n({
locale: store.state.locale, locale: process.env.locale,
fallbackLocale: 'it', fallbackLocale: process.env.locale,
messages: { messages: {
it it
} }
}) })
// app.i18n.path = (link) => {
// if (app.i18n.locale === app.i18n.fallbackLocale) {
// return `/${link}`
// }
// return `/${app.i18n.locale}/${link}`
// }
} }

View File

@@ -2,10 +2,10 @@ const fs = require('fs')
const path = require('path') const path = require('path')
const moment = require('moment') const moment = require('moment')
const { event: Event, comment: Comment } = require('../models') const { event: Event, comment: Comment } = require('../models')
const config = require('../../config').SHARED_CONF const config = require('../../config')
const Mastodon = require('mastodon-api') const Mastodon = require('mastodon-api')
const settingsController = require('./settings') const settingsController = require('./settings')
moment.locale('it') moment.locale(process.env.locale)
const botController = { const botController = {
bot: null, bot: null,

View File

@@ -1,4 +1,4 @@
p= t('confirm_email') p= t('email.confirm')
hr hr
small #{config.baseurl} small #{config.baseurl}