diff --git a/.gitignore b/.gitignore index b743c6d12..0de8272fc 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ dist # IDE .idea +.vscode # TEMORIRY static/uploads diff --git a/README.md b/README.md index c48e4da65..b82c75999 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,15 @@ All reusable Components (for example avatar) should be done inside the styleguid ``` bash $ yarn styleguide ``` + +## Internationalization (i18n) + +You can help translating the interface by joining us on [lokalise.co](https://lokalise.co/public/556252725c18dd752dd546.13222042/). + +Thanks lokalise.co that we can use your premium account! + +localise.co + +## Attributions + +
Locale Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY
diff --git a/components/Dropdown.vue b/components/Dropdown.vue new file mode 100644 index 000000000..f47c1cabb --- /dev/null +++ b/components/Dropdown.vue @@ -0,0 +1,67 @@ + + + diff --git a/components/LocaleSwitch.vue b/components/LocaleSwitch.vue new file mode 100644 index 000000000..88e7bdcb1 --- /dev/null +++ b/components/LocaleSwitch.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/components/mixins/seo.js b/components/mixins/seo.js new file mode 100644 index 000000000..d0c232baf --- /dev/null +++ b/components/mixins/seo.js @@ -0,0 +1,9 @@ +export default { + head() { + return { + htmlAttrs: { + lang: this.$i18n.locale() + } + } + } +} diff --git a/cypress/integration/Internationalization.feature b/cypress/integration/Internationalization.feature new file mode 100644 index 000000000..375fc03aa --- /dev/null +++ b/cypress/integration/Internationalization.feature @@ -0,0 +1,24 @@ +Feature: Internationalization + As a user who is not very fluent in English + I would like to see the user interface translated to my preferred language + In order to be able to understand the interface + + Background: + Given I am on the "login" page + + Scenario Outline: I select "" in the language menu and see "" + When I select "" in the language menu + Then the whole user interface appears in "" + Then I see a button with the label "" + + Examples: Login Button + | language | buttonLabel | + | English | Login | + | Deutsch | Einloggen | + | Français | Connexion | + | Nederlands | Inloggen | + + Scenario: Keep preferred language after refresh + Given I previously switched the language to "Deutsch" + And I refresh the page + Then the whole user interface appears in "Deutsch" diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index f6bb9f2b0..4d03766bc 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -1,8 +1,30 @@ import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps' +import find from 'lodash/find' +import { eq } from 'semver'; + +/* global cy */ const baseUrl = 'http://localhost:3000' const username = 'Peter Lustig' +const locales = require('../../../locales') + +const getLangByName = function(name) { + return find(locales, { name }) +} + +const openPage = function(page) { + if (page === 'landing') { + page = '' + } + cy.visit(`${baseUrl}/${page}`) +} + +const switchLanguage = function(name) { + cy.get('.login-locale-switch a').click() + cy.contains('.locale-menu-popover a', name).click() +} + const login = (email, password) => { cy.visit(`${baseUrl}/login`) cy.get('input[name=email]') @@ -38,10 +60,14 @@ Given('my user account has the role {string}', (role) => { // TODO: use db factories instead of seed data }) + When('I log out', logout) -When(`I visit the {string} page`, route => { - cy.visit(`${baseUrl}/${route}`) +When('I visit the {string} page', page => { + openPage(page) +}) +Given('I am on the {string} page', page => { + openPage(page) }) When('I fill in my email and password combination and click submit', () => { @@ -62,6 +88,7 @@ When('I log out through the menu in the top right corner', () => { Then('I can click on my profile picture in the top right corner', () => { cy.get('.avatar-menu').click() + cy.get('.avatar-menu-popover') }) Then('I can see my name {string} in the dropdown menu', () => { @@ -70,9 +97,7 @@ Then('I can see my name {string} in the dropdown menu', () => { Then('I see the login screen again', () => { cy.location('pathname').should('contain', '/login') - cy.contains( - 'Wenn Du ein Konto bei Human Connection hast, melde Dich bitte hier an.' - ) + cy.contains('If you already have a human-connection account, login here.') }) Then('I am still logged in', () => { @@ -80,16 +105,33 @@ Then('I am still logged in', () => { cy.get('.avatar-menu-popover').contains(username) }) -When('I navigate to the administration dashboard', () => { - cy.get('.avatar-menu').click() - cy.get('a').contains('Systemverwaltung').click() +When('I select {string} in the language menu', name => { + switchLanguage(name) +}) +Given('I previously switched the language to {string}', name => { + switchLanguage(name) +}) +Then('the whole user interface appears in {string}', name => { + const lang = getLangByName(name) + cy.get(`html[lang=${lang.code}]`) + cy.getCookie('locale').should('have.property', 'value', lang.code) +}) +Then('I see a button with the label {string}', label => { + cy.contains('button', label) }) -When(`I click on {string}`, (linkOrButton) => { +When('I navigate to the administration dashboard', () => { + cy.get('.avatar-menu').click() + cy.get('.avatar-menu-popover') + .contains('Admin') + .click() +}) + +When('I click on {string}', linkOrButton => { cy.contains(linkOrButton).click() }) -Then('I can see a list of categories ordered by post count:', (table) => { +Then('I can see a list of categories ordered by post count:', table => { // TODO: match the table in the feature with the html table cy.get('thead').find('tr th').should('have.length', 3) const last_column = cy.get('tbody').find('tr td:last-child').then((last_column) => { @@ -100,7 +142,7 @@ Then('I can see a list of categories ordered by post count:', (table) => { }) }) -Then('I can see a list of tags ordered by user and post count:', (table) => { +Then('I can see a list of tags ordered by user and post count:', table => { // TODO: match the table in the feature with the html table cy.get('thead').find('tr th').should('have.length', 4) const last_column = cy.get('tbody').find('tr td:last-child').then((last_column) => { diff --git a/layouts/blank.vue b/layouts/blank.vue index 827b1aaf7..23a783ac6 100644 --- a/layouts/blank.vue +++ b/layouts/blank.vue @@ -7,3 +7,11 @@ + + diff --git a/layouts/default.vue b/layouts/default.vue index fb922009e..6bf42691e 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -8,55 +8,63 @@ > - + + @@ -69,16 +77,16 @@ + + diff --git a/locales/de.json b/locales/de.json new file mode 100644 index 000000000..bb879f4ea --- /dev/null +++ b/locales/de.json @@ -0,0 +1,97 @@ +{ + "login": { + "copy": "Wenn Du ein Konto bei Human Connection hast, melde Dich bitte hier an.", + "login": "Einloggen", + "logout": "Ausloggen", + "email": "Deine E-Mail", + "password": "Dein Passwort", + "moreInfo": "Was ist Human Connection?", + "hello": "Hallo" + }, + "profile": { + "name": "Mein Profil", + "memberSince": "Mitglied seit", + "follow": "Folgen", + "followers": "Folgen", + "following": "Folgt" + }, + "settings": { + "name": "Einstellungen", + "data": { + "name": "Deine Daten" + }, + "security": { + "name": "Sicherheit" + }, + "invites": { + "name": "Einladungen" + }, + "download": { + "name": "Daten herunterladen" + }, + "delete": { + "name": "Konto löschen" + }, + "organizations": { + "name": "Meine Organisationen" + }, + "languages": { + "name": "Sprachen" + } + }, + "admin": { + "name": "Systemverwaltung", + "dashboard": { + "name": "Startzentrale", + "users": "Benutzer", + "posts": "Beiträge", + "comments": "Kommentare", + "notifications": "Benachrichtigungen", + "organizations": "Organisationen", + "projects": "Projekte", + "invites": "Einladungen", + "follows": "Folgen", + "shouts": "Shouts" + }, + "organizations": { + "name": "Organisationen" + }, + "users": { + "name": "Benutzer" + }, + "pages": { + "name": "Seiten" + }, + "notifications": { + "name": "Benachrichtigungen" + }, + "categories": { + "name": "Kategorien", + "categoryName": "Name", + "postCount": "Beiträge" + }, + "tags": { + "name": "Schlagworte", + "tagCountUnique": "Benutzer", + "tagCount": "Beiträge" + }, + "settings": { + "name": "Einstellungen" + } + }, + "post": { + "name": "Beitrag", + "moreInfo": { + "name": "Mehr Info" + }, + "takeAction": { + "name": "Aktiv werden" + } + }, + "quotes": { + "african": { + "quote": "Viele kleine Leute, an vielen kleinen Orten, die viele kleine Dinge tun, werden das Antlitz dieser Welt verändern.", + "author": "Afrikanisches Sprichwort" + } + } +} \ No newline at end of file diff --git a/locales/en.json b/locales/en.json new file mode 100644 index 000000000..a36bdda3c --- /dev/null +++ b/locales/en.json @@ -0,0 +1,97 @@ +{ + "login": { + "copy": "If you already have a human-connection account, login here.", + "login": "Login", + "logout": "Logout", + "email": "Your Email", + "password": "Your Password", + "moreInfo": "What is Human Connection?", + "hello": "Hello" + }, + "profile": { + "name": "My Profile", + "memberSince": "Member since", + "follow": "Follow", + "followers": "Followers", + "following": "Following" + }, + "settings": { + "name": "Settings", + "data": { + "name": "Your data" + }, + "security": { + "name": "Security" + }, + "invites": { + "name": "Invites" + }, + "download": { + "name": "Download Data" + }, + "delete": { + "name": "Delete Account" + }, + "organizations": { + "name": "My Organizations" + }, + "languages": { + "name": "Languages" + } + }, + "admin": { + "name": "Admin", + "dashboard": { + "name": "Dashboard", + "users": "Users", + "posts": "Posts", + "comments": "Comments", + "notifications": "Notifications", + "organizations": "Organizations", + "projects": "Projects", + "invites": "Invites", + "follows": "Follows", + "shouts": "Shouts" + }, + "organizations": { + "name": "Organizations" + }, + "users": { + "name": "Users" + }, + "pages": { + "name": "Pages" + }, + "notifications": { + "name": "Notifications" + }, + "categories": { + "name": "Categories", + "categoryName": "Name", + "postCount": "Posts" + }, + "tags": { + "name": "Tags", + "tagCountUnique": "Users", + "tagCount": "Posts" + }, + "settings": { + "name": "Settings" + } + }, + "post": { + "name": "Post", + "moreInfo": { + "name": "More info" + }, + "takeAction": { + "name": "Take action" + } + }, + "quotes": { + "african": { + "quote": "Many small people in many small places do many small things, that can alter the face of the world.", + "author": "African proverb" + } + } +} \ No newline at end of file diff --git a/locales/es.json b/locales/es.json new file mode 100644 index 000000000..e91c8b14b --- /dev/null +++ b/locales/es.json @@ -0,0 +1,79 @@ +{ + "login": { + "copy": "Si ya tiene una cuenta de Human Connection, inicie sesión aquí.", + "logout": "Cierre de sesión", + "email": "Tu correo electrónico", + "password": "Tu contraseña", + "moreInfo": "¿Qué es Human Connection?", + "hello": "Hola" + }, + "profile": { + "name": "Mi perfil", + "memberSince": "Miembro desde", + "followers": "Seguidores" + }, + "settings": { + "data": { + "name": "Sus datos" + }, + "security": { + "name": "Seguridad" + }, + "invites": { + "name": "Invita" + }, + "download": { + "name": "Descargar datos" + }, + "organizations": { + "name": "Mis organizaciones" + }, + "languages": { + "name": "Idiomas" + } + }, + "admin": { + "name": "Admin", + "dashboard": { + "users": "Usuarios", + "comments": "Comentarios", + "organizations": "Organizaciones", + "projects": "Proyectos", + "invites": "Invita", + "follows": "Sigue" + }, + "organizations": { + "name": "Organizaciones" + }, + "users": { + "name": "Usuarios" + }, + "pages": { + "name": "Páginas" + }, + "notifications": { + "name": "Notificaciones" + }, + "categories": { + "name": "Categorías", + "categoryName": "Nombre" + }, + "tags": { + "name": "Etiquetas", + "tagCountUnique": "Usuarios" + } + }, + "post": { + "moreInfo": { + "name": "Más info" + }, + "takeAction": { + "name": "Tomar acción" + } + }, + "quotes": { + "african": { + "author": "Proverbio africano" + } + } +} \ No newline at end of file diff --git a/locales/fr.json b/locales/fr.json new file mode 100644 index 000000000..fccd33d6b --- /dev/null +++ b/locales/fr.json @@ -0,0 +1,97 @@ +{ + "login": { + "copy": "Si vous avez déjà un compte human-connection, connectez-vous ici.", + "login": "Connexion", + "logout": "Déconnexion", + "email": "Votre Message électronique", + "password": "Votre mot de passe", + "moreInfo": "Qu'est-ce que Human Connection?", + "hello": "Bonjour" + }, + "profile": { + "name": "Mon profil", + "memberSince": "Membre depuis", + "follow": "Suivre", + "followers": "Suiveurs", + "following": "Suivant" + }, + "settings": { + "name": "Paramètres", + "data": { + "name": "Vos données" + }, + "security": { + "name": "Sécurité" + }, + "invites": { + "name": "Invite" + }, + "download": { + "name": "Télécharger les données" + }, + "delete": { + "name": "Supprimer un compte" + }, + "organizations": { + "name": "Mes organisations" + }, + "languages": { + "name": "Langues" + } + }, + "admin": { + "name": "Admin", + "dashboard": { + "name": "Tableau de bord", + "users": "Utilisateurs", + "posts": "Postes", + "comments": "Commentaires", + "notifications": "Notifications", + "organizations": "Organisations", + "projects": "Projets", + "invites": "Invite", + "follows": "Suit", + "shouts": "Cris" + }, + "organizations": { + "name": "Organisations" + }, + "users": { + "name": "Utilisateurs" + }, + "pages": { + "name": "Pages" + }, + "notifications": { + "name": "Notifications" + }, + "categories": { + "name": "Catégories", + "categoryName": "Nom", + "postCount": "Postes" + }, + "tags": { + "name": "Étiquettes", + "tagCountUnique": "Utilisateurs", + "tagCount": "Postes" + }, + "settings": { + "name": "Paramètres" + } + }, + "post": { + "name": "Post", + "moreInfo": { + "name": "Plus d'infos" + }, + "takeAction": { + "name": "Passez à l'action" + } + }, + "quotes": { + "african": { + "quote": "Beaucoup de petites personnes dans beaucoup de petits endroits font beaucoup de petites choses, qui peuvent changer la face du monde.", + "author": "Proverbe africain" + } + } +} \ No newline at end of file diff --git a/locales/index.js b/locales/index.js new file mode 100644 index 000000000..daafb6577 --- /dev/null +++ b/locales/index.js @@ -0,0 +1,50 @@ +module.exports = [ + { + name: 'English', + code: 'en', + iso: 'en-US', + enabled: true + }, + { + name: 'Deutsch', + code: 'de', + iso: 'de-DE', + enabled: true + }, + { + name: 'Nederlands', + code: 'nl', + iso: 'nl-NL', + enabled: true + }, + { + name: 'Français', + code: 'fr', + iso: 'fr-FR', + enabled: true + }, + { + name: 'Italiano', + code: 'it', + iso: 'it-IT', + enabled: true + }, + { + name: 'Español', + code: 'es', + iso: 'es-ES', + enabled: true + }, + { + name: 'Portuguese', + code: 'pt', + iso: 'pt-PT', + enabled: true + }, + { + name: 'Polski', + code: 'pl', + iso: 'pl-PL', + enabled: true + } +] diff --git a/locales/it.json b/locales/it.json new file mode 100644 index 000000000..6998e5149 --- /dev/null +++ b/locales/it.json @@ -0,0 +1,89 @@ +{ + "login": { + "copy": "Se hai già un account di Human Connection, accedi qui.", + "logout": "Logout", + "email": "La tua email", + "password": "La tua password", + "moreInfo": "Che cosa è Human Connection?", + "hello": "Ciao" + }, + "profile": { + "name": "Il mio profilo", + "follow": "Seguire", + "followers": "Seguaci" + }, + "settings": { + "name": "Impostazioni", + "data": { + "name": "I tuoi dati" + }, + "security": { + "name": "Sicurezza" + }, + "invites": { + "name": "Inviti" + }, + "download": { + "name": "Scaricare i dati" + }, + "delete": { + "name": "Elimina Account" + }, + "organizations": { + "name": "Mie organizzazioni" + }, + "languages": { + "name": "Lingue" + } + }, + "admin": { + "name": "Admin", + "dashboard": { + "name": "Cruscotto", + "users": "Utenti", + "comments": "Commenti", + "notifications": "Notifiche", + "organizations": "Organizzazioni", + "projects": "Progetti", + "invites": "Inviti", + "follows": "Segue" + }, + "organizations": { + "name": "Organizzazioni" + }, + "users": { + "name": "Utenti" + }, + "pages": { + "name": "Pagine" + }, + "notifications": { + "name": "Notifiche" + }, + "categories": { + "name": "Categorie", + "categoryName": "Nome" + }, + "tags": { + "name": "Tag", + "tagCountUnique": "Utenti", + "tagCount": "Messaggi" + }, + "settings": { + "name": "Impostazioni" + } + }, + "post": { + "moreInfo": { + "name": "Ulteriori informazioni" + }, + "takeAction": { + "name": "Agire" + } + }, + "quotes": { + "african": { + "author": "Proverbio africano" + } + } +} \ No newline at end of file diff --git a/locales/nl.json b/locales/nl.json new file mode 100644 index 000000000..9b3bc2452 --- /dev/null +++ b/locales/nl.json @@ -0,0 +1,90 @@ +{ + "login": { + "copy": "Als u al een mini-aansluiting account heeft, log dan hier in.", + "login": "Inloggen", + "logout": "Uitloggen", + "email": "Uw E-mail", + "password": "Uw Wachtwoord", + "moreInfo": "Wat is Human Connection?", + "hello": "Hallo" + }, + "profile": { + "name": "Mijn profiel", + "memberSince": "Lid sinds", + "follow": "Volgen", + "followers": "Volgelingen", + "following": "Volgt" + }, + "settings": { + "name": "Instellingen", + "data": { + "name": "Uw gegevens" + }, + "security": { + "name": "Veiligheid" + }, + "download": { + "name": "Gegevens downloaden" + }, + "delete": { + "name": "Account verwijderen" + }, + "organizations": { + "name": "Mijn Organisaties" + }, + "languages": { + "name": "Talen" + } + }, + "admin": { + "name": "Admin", + "dashboard": { + "name": "Dashboard", + "users": "Gebruikers", + "posts": "Berichten", + "comments": "Opmerkingen", + "notifications": "Meldingen", + "organizations": "Organisaties", + "projects": "Projecten", + "follows": "Volgt", + "shouts": "Shouts" + }, + "organizations": { + "name": "Organisaties" + }, + "users": { + "name": "Gebruikers" + }, + "notifications": { + "name": "Meldingen" + }, + "categories": { + "name": "Categorieën", + "categoryName": "Naam", + "postCount": "Berichten" + }, + "tags": { + "name": "Tags", + "tagCountUnique": "Gebruikers", + "tagCount": "Berichten" + }, + "settings": { + "name": "Instellingen" + } + }, + "post": { + "name": "Post", + "moreInfo": { + "name": "Meer info" + }, + "takeAction": { + "name": "Onderneem actie" + } + }, + "quotes": { + "african": { + "quote": "Veel kleine mensen op veel kleine plaatsen doen veel kleine dingen, die het gezicht van de wereld kunnen veranderen.", + "author": "Afrikaans spreekwoord" + } + } +} \ No newline at end of file diff --git a/locales/pl.json b/locales/pl.json new file mode 100644 index 000000000..2bdd4ca99 --- /dev/null +++ b/locales/pl.json @@ -0,0 +1,97 @@ +{ + "login": { + "copy": "Jeśli masz już konto Human Connection, zaloguj się tutaj.", + "login": "Login", + "logout": "Wyloguj się", + "email": "Twój adres e-mail", + "password": "Twoje hasło", + "moreInfo": "Co to jest Human Connection?", + "hello": "Cześć" + }, + "profile": { + "name": "Mój profil", + "memberSince": "Członek od", + "follow": "Obserwuj", + "followers": "Obserwujący", + "following": "Obserwowani" + }, + "settings": { + "name": "Ustawienia", + "data": { + "name": "Twoje dane" + }, + "security": { + "name": "Bezpieczeństwo" + }, + "invites": { + "name": "Zaproszenia" + }, + "download": { + "name": "Pobierz dane" + }, + "delete": { + "name": "Usuń konto" + }, + "organizations": { + "name": "Moje organizacje" + }, + "languages": { + "name": "Języki" + } + }, + "admin": { + "name": "Admin", + "dashboard": { + "name": "Tablica rozdzielcza", + "users": "Użytkownicy", + "posts": "Posty", + "comments": "Komentarze", + "notifications": "Powiadomienia", + "organizations": "Organizacje", + "projects": "Projekty", + "invites": "Zaproszenia", + "follows": "Obserwowań", + "shouts": "Wykrzyki" + }, + "organizations": { + "name": "Organizacje" + }, + "users": { + "name": "Użytkownicy" + }, + "pages": { + "name": "Strony" + }, + "notifications": { + "name": "Powiadomienia" + }, + "categories": { + "name": "Kategorie", + "categoryName": "Nazwa", + "postCount": "Posty" + }, + "tags": { + "name": "Tagi", + "tagCountUnique": "Użytkownicy", + "tagCount": "Posty" + }, + "settings": { + "name": "Ustawienia" + } + }, + "post": { + "name": "Post", + "moreInfo": { + "name": "Więcej informacji" + }, + "takeAction": { + "name": "Podejmij działanie" + } + }, + "quotes": { + "african": { + "quote": "Wielu małych ludzi w wielu małych miejscach robi wiele małych rzeczy, które mogą zmienić oblicze świata.", + "author": "Afrykańskie przysłowie" + } + } +} \ No newline at end of file diff --git a/locales/pt.json b/locales/pt.json new file mode 100644 index 000000000..a96ffe8e0 --- /dev/null +++ b/locales/pt.json @@ -0,0 +1,96 @@ +{ + "login": { + "copy": "Se você já tem uma conta no Human Connection, faça o login aqui.", + "login": "Login", + "logout": "Sair", + "email": "Seu email", + "password": "Sua senha", + "moreInfo": "O que é o Human Connection?", + "hello": "Olá" + }, + "profile": { + "name": "Meu perfil", + "memberSince": "Membro desde", + "follow": "Seguir", + "followers": "Seguidores", + "following": "Seguindo" + }, + "settings": { + "name": "Configurações", + "data": { + "name": "Seus Dados" + }, + "security": { + "name": "Segurança" + }, + "invites": { + "name": "Convites" + }, + "download": { + "name": "Baixar dados" + }, + "delete": { + "name": "Deletar conta" + }, + "organizations": { + "name": "Minhas Organizações" + }, + "languages": { + "name": "Linguagens" + } + }, + "admin": { + "name": "Administrator", + "dashboard": { + "name": "Painel de controle", + "users": "Usuários", + "posts": "Postagens", + "comments": "Comentários", + "notifications": "Notificações", + "organizations": "Organizações", + "projects": "Projetos", + "invites": "Convites", + "follows": "Seguidores" + }, + "organizations": { + "name": "Organizações" + }, + "users": { + "name": "Usuários" + }, + "pages": { + "name": "Páginas" + }, + "notifications": { + "name": "Notificações" + }, + "categories": { + "name": "Categorias", + "categoryName": "Nome", + "postCount": "Postagens" + }, + "tags": { + "name": "Etiquetas", + "tagCountUnique": "Usuários", + "tagCount": "Postagens" + }, + "settings": { + "name": "Configurações" + } + }, + "post": { + "name": "Postar", + "moreInfo": { + "name": "Mais informações" + }, + "takeAction": { + "name": "Tomar uma ação" + } + }, + "quotes": { + "african": { + "quote": "Pequenos grupos de pessoas, em pequenos locais podem fazer várias coisas pequenas, mas que podem alterar o mundo ao nosso redor.", + "author": "Provérbio Africano" + } + } +} \ No newline at end of file diff --git a/lokalise.png b/lokalise.png new file mode 100644 index 000000000..ce722f5ac Binary files /dev/null and b/lokalise.png differ diff --git a/middleware/authenticated.js b/middleware/authenticated.js index af2a7076c..f2273df58 100644 --- a/middleware/authenticated.js +++ b/middleware/authenticated.js @@ -1,4 +1,4 @@ -import { isEmpty } from 'lodash' +import isEmpty from 'lodash/isEmpty' export default async ({ store, env, route, redirect }) => { let publicPages = env.publicPages diff --git a/nuxt.config.js b/nuxt.config.js index ea5b8b52f..be8da36c5 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -26,7 +26,9 @@ module.exports = { 'pages-slug' ], // pages to keep alive - keepAlivePages: ['index'] + keepAlivePages: ['index'], + // active locales + locales: require('./locales') }, /* ** Headers of the page @@ -59,6 +61,7 @@ module.exports = { ** Plugins to load before mounting the App */ plugins: [ + { src: '~/plugins/i18n.js', ssr: true }, { src: '~/plugins/keep-alive.js', ssr: false }, { src: '~/plugins/design-system.js', ssr: true }, { src: '~/plugins/vue-directives.js', ssr: false }, @@ -71,30 +74,6 @@ module.exports = { middleware: ['authenticated'], linkActiveClass: 'router-active-link' }, - /* router: { - routes: [ - { - name: 'index', - path: '/', - component: 'pages/index.vue' - }, - { - name: 'post-slug', - path: '/post/:slug', - component: 'pages/post/_slug.vue', - children: [ - { - path: 'more-info', - component: 'pages/post/_slug.vue' - }, - { - path: 'take-action', - component: 'pages/post/_slug.vue' - } - ] - } - ] - }, */ /* ** Nuxt.js modules @@ -102,6 +81,7 @@ module.exports = { modules: [ ['@nuxtjs/dotenv', { only: envWhitelist }], ['nuxt-env', { keys: envWhitelist }], + 'cookie-universal-nuxt', '@nuxtjs/apollo', '@nuxtjs/axios', [ @@ -172,6 +152,7 @@ module.exports = { */ build: { /* + * TODO: import the polyfill instead of using the deprecated vendor key * Polyfill missing ES6 & 7 Methods to work on older Browser */ vendor: ['@babel/polyfill'], diff --git a/package.json b/package.json index cb55207e5..ac527707b 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@nuxtjs/axios": "^5.3.6", "@nuxtjs/dotenv": "^1.3.0", "accounting": "^0.4.1", + "cookie-universal-nuxt": "^2.0.11", "cross-env": "^5.2.0", "date-fns": "^2.0.0-alpha.26", "express": "^4.16.3", @@ -52,7 +53,8 @@ "nuxt-env": "^0.0.4", "v-tooltip": "^2.0.0-rc.33", "vue-count-to": "^1.0.13", - "vue-izitoast": "1.1.2" + "vue-izitoast": "1.1.2", + "vuex-i18n": "^1.10.5" }, "devDependencies": { "@vue/eslint-config-prettier": "^4.0.1", diff --git a/pages/admin.vue b/pages/admin.vue index 8d2286ae6..ce2c50960 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -1,7 +1,7 @@