From da0125310d7539daea73172bd13fcff24a6e50a1 Mon Sep 17 00:00:00 2001 From: JosephK Date: Tue, 17 Sep 2019 17:14:54 +0200 Subject: [PATCH] Fix docs --- app/assets/scss/frama/carousel.scss | 4 +- app/components/pages/alternatives/AltMap.vue | 29 +++++-- app/components/pages/list/ListService.vue | 28 ++++-- app/data/commons/doc.yml | 84 ++++++++++++++++++ app/data/commons/icon.yml | 3 +- app/data/commons/link.yml | 1 - app/data/commons/services.yml | 41 +++++++++ app/index.js | 90 ++++++++++++-------- app/locales/{de.yml => de/main.yml} | 0 app/locales/{en.yml => en/main.yml} | 0 app/locales/{es.yml => es/main.yml} | 0 app/locales/{fr.yml => fr/main.yml} | 0 package.json | 46 +++++----- webpack.config.js | 4 +- 14 files changed, 254 insertions(+), 76 deletions(-) create mode 100644 app/data/commons/doc.yml rename app/locales/{de.yml => de/main.yml} (100%) rename app/locales/{en.yml => en/main.yml} (100%) rename app/locales/{es.yml => es/main.yml} (100%) rename app/locales/{fr.yml => fr/main.yml} (100%) diff --git a/app/assets/scss/frama/carousel.scss b/app/assets/scss/frama/carousel.scss index d2e8a70..7aa4c1b 100644 --- a/app/assets/scss/frama/carousel.scss +++ b/app/assets/scss/frama/carousel.scss @@ -50,14 +50,14 @@ button { cursor: pointer; - font-size: 30px; + font-size: 26px; z-index: 1000; background: #f3f3f3; border-radius: 30px; color: #767676; width: 40px; height: 40px; - padding-left: 4px; + padding-left: 1px; padding-top: 0px; position: absolute; opacity: 1; diff --git a/app/components/pages/alternatives/AltMap.vue b/app/components/pages/alternatives/AltMap.vue index dfbbf74..e4381a8 100644 --- a/app/components/pages/alternatives/AltMap.vue +++ b/app/components/pages/alternatives/AltMap.vue @@ -213,16 +213,14 @@

- + @click="modal.open = false;" + v-text="$t('txt.otherAlt')"> - +
@@ -383,6 +381,21 @@ export default { }); return tags; }, + docLink(key) { + const service = this.$root.services[key].id || null; + const path = this.$root.doc[service] || false; + let link = this.$root.link.docs; + if (path) { + if (this.$t('lang') !== 'fr' + && path[1] !== undefined) { + link += `/${path[1]}`; // english doc by default + } else { + link += `/${path[0]}`; // fallback on french if missing + } + link += '/index.html'; + } + return link; + } }, } \ No newline at end of file diff --git a/app/components/pages/list/ListService.vue b/app/components/pages/list/ListService.vue index 9f213d1..1cc232e 100644 --- a/app/components/pages/list/ListService.vue +++ b/app/components/pages/list/ListService.vue @@ -26,7 +26,7 @@ @click="modal.open = true; modal.key = id;"> -
  • +
  • @@ -104,10 +104,11 @@
    - + + @@ -143,6 +144,23 @@ export default { key: 'bitly', }, } - } + }, + methods: { + docLink(key) { + const service = this.$root.services[key].id || null; + const path = this.$root.doc[service] || false; + let link = this.$root.link.docs; + if (path) { + if (this.$t('lang') !== 'fr' + && path[1] !== undefined) { + link += `/${path[1]}`; // english doc by default + } else { + link += `/${path[0]}`; // fallback on french if missing + } + link += '/index.html'; + } + return link; + } + }, } \ No newline at end of file diff --git a/app/data/commons/doc.yml b/app/data/commons/doc.yml new file mode 100644 index 0000000..54e4d62 --- /dev/null +++ b/app/data/commons/doc.yml @@ -0,0 +1,84 @@ +agenda: +- fr/agenda +bag: +- fr/wallabag +bee: +- fr/searx +bin: +- fr/privatebin +board: +- fr/kanboard +calc: +- fr/ethercalc +carte: +- fr/umap +clic: +- fr/dolomon +- en/dolomon +date: +- fr/framadate +- en/framadate +drive: +- fr/nextcloud +drop: +- fr/lufi +- en/lufi +forms: +- fr/framaforms +git: +- fr/gitlab +key: +- fr/framakey +libre: +- fr/framalibre +link: +- fr/lstu +- en/lstu +listes: +- fr/sympa +maestro: +- fr/framaestro +memo: +- fr/scrumblr +mindmap: +- fr/wisemapping +my: +- fr/shaarli +news: +- fr/ttrss +notes: +- fr/turtl +pack: +- fr/framapack +piaf: +- fr/mastodon +- en/mastodon +pic: +- fr/lutim +- en/lutim +site: +- fr/framasite +site-noemie: +- fr/noemiecms +site-grav: +- fr/grav +slides: +- fr/strut +sphere: +- fr/diaspora +- en/sphere +talk: +- fr/jitsimeet +- en/jitsimeet +team: +- fr/mattermost +- en/mattermost +vox: +- fr/loomio +- en/loomio +wiki: +- fr/dokuwiki + +huitre: +- fr/lstu +- en/lstu \ No newline at end of file diff --git a/app/data/commons/icon.yml b/app/data/commons/icon.yml index 68c422b..862cbc7 100644 --- a/app/data/commons/icon.yml +++ b/app/data/commons/icon.yml @@ -1,10 +1,11 @@ cuo: fa-shield dio: fa-shield -aide: fa-life-ring +aide: fa-map-signs asso: fa-home benevalo: fa-trophy cgu: fa-legal +moderation: fa-handshake-o charte: fa-heart contact: fa-envelope credits: fa-creative-commons diff --git a/app/data/commons/link.yml b/app/data/commons/link.yml index 4e7cd8a..59fbace 100644 --- a/app/data/commons/link.yml +++ b/app/data/commons/link.yml @@ -80,6 +80,5 @@ diaspora: https://framasphere.org/u/framasoft mastodon: https://framapiaf.org/@Framasoft twitter: https://twitter.com/framasoft facebook: https://www.facebook.com/framasoft -newsletter: https://contact.framasoft.org/newsletter rss: https://rss.framasoft.org wikipedia: https://fr.wikipedia.org/wiki/Framasoft diff --git a/app/data/commons/services.yml b/app/data/commons/services.yml index 8a4e86d..855e997 100644 --- a/app/data/commons/services.yml +++ b/app/data/commons/services.yml @@ -1,4 +1,5 @@ bitly: + id: link FL: https://frama.link CL: https://framacloud.org/fr/cultiver-son-jardin/lstu.html i: link @@ -20,6 +21,7 @@ bitly: c2: tools blogger: + id: site FL: https://frama.site CL: https://framacloud.org/fr/cultiver-son-jardin/grav.html i: globe @@ -41,6 +43,7 @@ blogger: c1: site bubblus: + id: mindmap FL: https://framindmap.org CL: https://framacloud.org/fr/cultiver-son-jardin/wisemapping.html i: sitemap @@ -59,6 +62,7 @@ bubblus: c2: prod change: + id: petition FL: https://wip.framasoft.org/ CL: i: balance-scale @@ -76,6 +80,7 @@ change: c1: social delicious: + id: my FL: https://my.framasoft.org CL: https://framacloud.org/fr/cultiver-son-jardin/shaarli.html i: star @@ -94,6 +99,7 @@ delicious: c2: share doodle: + id: date FL: https://framadate.org CL: https://framacloud.org/fr/cultiver-son-jardin/framadate.html i: calendar-check-o @@ -110,6 +116,7 @@ doodle: c2: orga dropbox: + id: drive FL: https://framadrive.org CL: https://framacloud.org/fr/cultiver-son-jardin/nextcloud.html i: cloud-upload @@ -133,6 +140,7 @@ dropbox: c2: tools evernote: + id: note FL: https://framanotes.org CL: https://framacloud.org/fr/cultiver-son-jardin/turtl.html i: sticky-note @@ -150,6 +158,7 @@ evernote: c2: tools facebook: + id: sphere FL: https://framasphere.org CL: i: diaspora @@ -173,6 +182,7 @@ facebook: c2: com github: + id: git FL: https://framagit.org CL: https://framacloud.org/fr/cultiver-son-jardin/gitlab.html i: git @@ -195,6 +205,7 @@ github: c2: tools gmail: + id: mail FL: https://wip.framasoft.org/ CL: i: mail @@ -220,6 +231,7 @@ gmail: c1: social gagenda: + id: agenda FL: https://framagenda.org CL: https://framacloud.org/fr/cultiver-son-jardin/nextcloud.html i: calendar @@ -238,6 +250,7 @@ gagenda: c2: orga gbooks: + id: bookin FL: https://framabookin.org CL: https://framacloud.org/fr/cultiver-son-jardin/bicbucstriim.html i: coffee @@ -259,6 +272,7 @@ gbooks: c2: games gdocs: + id: pad FL: https://framapad.org CL: https://framacloud.org/fr/cultiver-son-jardin/etherpad.html i: align-left @@ -278,6 +292,7 @@ gdocs: c2: collab gforms: + id: forms FL: https://framaforms.org CL: https://framacloud.org/fr/cultiver-son-jardin/framaforms.html i: list-ul @@ -297,6 +312,7 @@ gforms: c2: prod ggroups: + id: listes FL: https://framalistes.org CL: https://framacloud.org/fr/cultiver-son-jardin/sympa.html i: group @@ -317,6 +333,7 @@ ggroups: c2: com gmaps: + id: carte FL: https://framacarte.org CL: https://framacloud.org/fr/cultiver-son-jardin/umap.html i: map @@ -337,6 +354,7 @@ gmaps: c2: prod greader: + id: news FL: https://framanews.org CL: https://framacloud.org/fr/cultiver-son-jardin/ttrss.html i: newspaper-o @@ -355,6 +373,7 @@ greader: c2: search gsearch: + id: bee FL: https://framabee.org CL: https://framacloud.org/fr/cultiver-son-jardin/searx.html i: search @@ -378,6 +397,7 @@ gsearch: c2: search gslides: + id: slides FL: https://framaslides.org CL: i: pie-chart @@ -393,6 +413,7 @@ gslides: c2: prod gspreadsheet: + id: calc FL: https://framacalc.org CL: i: th @@ -411,6 +432,7 @@ gspreadsheet: c2: collab imgur: + id: pic FL: https://framapic.org CL: https://framacloud.org/fr/cultiver-son-jardin/lutim.html i: photo @@ -431,6 +453,7 @@ imgur: c2: share meetup: + id: mobilizon FL: https://wip.framasoft.org/ CL: i: @@ -446,6 +469,7 @@ meetup: c1: social minecraft: + id: minetest FL: https://framinetest.org CL: https://framacloud.org/fr/cultiver-son-jardin/minetest.html i: cube @@ -461,6 +485,7 @@ minecraft: c2: games padlet: + id: memo FL: https://framemo.org/ CL: https://framacloud.org/fr/cultiver-son-jardin/scrumblr.html i: object-group @@ -476,6 +501,7 @@ padlet: c2: collab pastebin: + id: bin FL: https://framabin.org CL: https://framacloud.org/fr/cultiver-son-jardin/privatebin.html i: paste @@ -492,6 +518,7 @@ pastebin: c2: share pocket: + id: bag FL: https://framabag.org CL: https://framacloud.org/fr/cultiver-son-jardin/wallabag.html i: briefcase @@ -507,6 +534,7 @@ pocket: c2: search scribd: + id: FL: https://wip.framasoft.org/ CL: i: @@ -521,6 +549,7 @@ scribd: c1: files loomio: + id: vox FL: https://framavox.org CL: https://framacloud.org/fr/cultiver-son-jardin/loomio.html i: bullhorn @@ -538,6 +567,7 @@ loomio: c2: orga skype: + id: talk FL: https://framatalk.org CL: https://framacloud.org/fr/cultiver-son-jardin/jitsi-meet.html i: video-camera @@ -559,6 +589,7 @@ skype: c2: orga slack: + id: team FL: https://framateam.org CL: https://framacloud.org/fr/cultiver-son-jardin/gitlab.html i: comments-o @@ -577,6 +608,7 @@ slack: c2: com trello: + id: board FL: https://framaboard.org CL: https://framacloud.org/fr/cultiver-son-jardin/kanboard.html i: dashboard @@ -593,6 +625,7 @@ trello: c2: orga wetransfer: + id: drop FL: https://framadrop.org CL: https://framacloud.org/fr/cultiver-son-jardin/lufi.html i: send @@ -612,6 +645,7 @@ wetransfer: c2: share youtube: + id: tube FL: https://framatube.org CL: i: peertube @@ -636,6 +670,7 @@ youtube: # Not on map ----------------------------------------------------------- jsfiddle: + id: FL: https://wip.framasoft.org/ CL: i: @@ -652,6 +687,7 @@ jsfiddle: c1: dev kongregate: + id: games FL: https://framagames.org CL: i: gamepad @@ -669,6 +705,7 @@ kongregate: c2: games maestro: + id: maestro FL: https://framaestro.org CL: https://framacloud.org/cultiver-son-jardin/installation-de-framaestro/ i: magic @@ -684,6 +721,7 @@ maestro: c2: collab pixlr: + id: vectoriel FL: https://framavectoriel.org CL: https://framacloud.org/cultiver-son-jardin/installation-de-svg-edit/ i: paint-brush @@ -699,6 +737,7 @@ pixlr: c2: games twitter: + id: piaf FL: https://framapiaf.org CL: i: mastodon @@ -718,6 +757,7 @@ twitter: c2: com transifex: + id: trad FL: https://trad.framasoft.org/ CL: i: language @@ -736,6 +776,7 @@ transifex: c1: dev ganalytics: + id: clic FL: https://framaclic.org/ CL: https://framacloud.org/fr/cultiver-son-jardin/dolomon.html i: hand-pointer-o diff --git a/app/index.js b/app/index.js index 916e581..0940ab9 100644 --- a/app/index.js +++ b/app/index.js @@ -32,15 +32,30 @@ Vue.use(cookie); Vue.use(merge); const defaultLocale = 'en'; -const locales = []; +const locales = {}; const pages = []; const commons = []; -const dataLocales = []; // Import locales list -let req = require.context('./locales/', false, /\.yml$/); +// in locales/[lg]/[file].yml +let req = require.context('./locales/', true, /\.\/.*\/.*\.yml$/); req.keys().forEach((key) => { - locales.push(key.replace(/\.\/(.*)\.yml/, '$1')); + const lg = key.split('/')[1]; + const file = key.split('/')[2].replace(/\.yml/, ''); + if (locales[lg] === undefined) { + locales[lg] = []; + } + if (!locales[lg].includes(file)) { + locales[lg].push(file); + } +}); +// Flag if data/locales/[lg].yml is available +req = require.context('./data/locales/', false, /\.yml$/); +req.keys().forEach((key) => { + const lg = key.replace(/\.\/(.*)\.yml/, '$1'); + if (Array.isArray(locales[lg])) { + locales[lg].push('data'); + } }); // Import pages list req = require.context('./components/pages', false, /\.vue$/); @@ -52,11 +67,6 @@ req = require.context('./data/commons/', false, /\.yml$/); req.keys().forEach((key) => { commons.push(key.replace(/\.\/(.*)\.yml/, '$1')); }); -// Import dataLocales list -req = require.context('./data/locales/', false, /\.yml$/); -req.keys().forEach((key) => { - dataLocales.push(key.replace(/\.\/(.*)\.yml/, '$1')); -}); // Import logos list const gafam = []; @@ -82,7 +92,9 @@ let defaultRouteLang = ''; const messages = {}; const numberFormats = {}; messages.locales = require('./data/lang.yml'); // eslint-disable-line -messages.locales.available = Object.keys(messages.locales).filter(n => locales.indexOf(n) > -1); +messages.locales.available = Object + .keys(messages.locales) + .filter(n => Object.keys(locales).indexOf(n) > -1); // Data import const data = {}; @@ -136,50 +148,58 @@ Object.keys(data.services).forEach((k) => { }); const routes = []; -for (let i = 0; i < locales.length; i += 1) { - messages[locales[i]] = {}; - numberFormats[locales[i]] = {}; +Object.keys(locales).forEach((k) => { + messages[k] = {}; + numberFormats[k] = {}; // Locales import /* eslint-disable */ - messages[locales[i]] = require(`./locales/${locales[i]}.yml`); - messages[locales[i]].data = data; - messages[locales[i]].lang = locales[i]; - numberFormats[locales[i]].eur = { + for (let i = 0; i < commons.length; i += 1) { + messages[k] = require(`./data/commons/${commons[i]}.yml`); // eslint-disable-line + } + messages[k] = require(`./locales/${k}/main.yml`); // eslint-disable-line + for (let i = 0; i < locales[k].length; i += 1) { + const file = locales[k][i]; + if (!/main|data/.test(file)) { + messages[k][file] = require(`./locales/${k}/${file}.yml`); // eslint-disable-line + } + if (/data/.test(file)) { + const dataLocale = require(`./data/locales/${k}.yml`); + Object.keys(dataLocale).forEach((l) => { + if (messages[k][l] === undefined) { + messages[k][l] = dataLocale[l]; + } else { + Object.assign(messages[k][l], dataLocale[l]); + } + }); + } + } + + messages[k].data = data; + messages[k].lang = k; + numberFormats[k].eur = { style: 'currency', currency: 'EUR', maximumFractionDigits: 0, minimumFractionDigits: 0, }; - - if (dataLocales.includes(locales[i])) { - const dataLocale = require(`./data/locales/${locales[i]}.yml`); - Object.keys(dataLocale).forEach((k) => { - if (messages[locales[i]][k] === undefined) { - messages[locales[i]][k] = dataLocale[k]; - } else { - Object.assign(messages[locales[i]][k], dataLocale[k]); - } - }); - } /* eslint-enable */ // Localized routes for (let j = 0; j < pages.length; j += 1) { const component = require(`./components/pages/${pages[j]}.vue`); // eslint-disable-line routes.push({ - path: `/${locales[i]}${pages[j].toLowerCase().replace(/^/, '/').replace('/home', '')}`, + path: `/${k}${pages[j].toLowerCase().replace(/^/, '/').replace('/home', '')}`, component: component.default, - meta: { id: pages[j].toLowerCase(), lang: locales[i] }, + meta: { id: pages[j].toLowerCase(), lang: k }, }); } -} +}); // define defaultRouteLang for (let j = 0; j < userLang.length; j += 1) { // check if user locales - for (let i = 0; i < locales.length; i += 1) { // matches with app locales - if (defaultRouteLang === '' && userLang[j].substring(0, 2).toLowerCase() === locales[i]) { - defaultRouteLang = locales[i]; - } + const lg = userLang[j].substring(0, 2).toLowerCase(); + if (defaultRouteLang === '' && Object.keys(locales).includes(lg)) { // matches with app locales + defaultRouteLang = lg; } } diff --git a/app/locales/de.yml b/app/locales/de/main.yml similarity index 100% rename from app/locales/de.yml rename to app/locales/de/main.yml diff --git a/app/locales/en.yml b/app/locales/en/main.yml similarity index 100% rename from app/locales/en.yml rename to app/locales/en/main.yml diff --git a/app/locales/es.yml b/app/locales/es/main.yml similarity index 100% rename from app/locales/es.yml rename to app/locales/es/main.yml diff --git a/app/locales/fr.yml b/app/locales/fr/main.yml similarity index 100% rename from app/locales/fr.yml rename to app/locales/fr/main.yml diff --git a/package.json b/package.json index 66cee4c..ff4bdde 100644 --- a/package.json +++ b/package.json @@ -19,48 +19,48 @@ "uiv": "^0.28.0", "vue": "^2.6.10", "vue-headful": "^2.0.1", - "vue-i18n": "^8.11.2", - "vue-router": "^3.0.6", + "vue-i18n": "^8.14.0", + "vue-router": "^3.1.3", "vue-scrollto": "^2.11.0", "vue-select": "^2.4.0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/plugin-proposal-object-rest-spread": "^7.4.4", + "@babel/core": "^7.5.5", + "@babel/plugin-proposal-object-rest-spread": "^7.5.5", "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/preset-env": "^7.4.4", - "autoprefixer": "^9.5.1", - "babel-eslint": "^10.0.2", + "@babel/preset-env": "^7.5.5", + "autoprefixer": "^9.6.1", + "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", - "copy-webpack-plugin": "^5.0.3", - "cross-env": "^5.2.0", + "copy-webpack-plugin": "^5.0.4", + "cross-env": "^5.2.1", "css-hot-loader": "^1.4.4", "css-loader": "^2.1.1", "eslint": "^5.16.0", "eslint-config-airbnb-base": "^13.2.0", - "eslint-loader": "^2.1.2", + "eslint-loader": "^2.2.1", "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-html": "^5.0.4", - "eslint-plugin-import": "^2.17.2", - "eslint-plugin-promise": "^4.1.1", - "eslint-plugin-vue": "^5.2.2", + "eslint-plugin-html": "^5.0.5", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-vue": "^5.2.3", "file-loader": "^3.0.1", - "html-webpack-plugin": "^4.0.0-beta.5", + "html-webpack-plugin": "^4.0.0-beta.8", "mini-css-extract-plugin": "^0.6.0", "node-sass": "^4.12.0", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", - "preload-webpack-plugin": "^3.0.0-beta.3", + "preload-webpack-plugin": "^3.0.0-beta.4", "prerender-spa-plugin": "^3.4.0", - "sass-loader": "^7.1.0", + "sass-loader": "^7.3.1", "style-loader": "^0.23.1", - "terser-webpack-plugin": "^1.2.3", - "vue-loader": "^15.7.0", + "terser-webpack-plugin": "^1.4.1", + "vue-loader": "^15.7.1", "vue-template-compiler": "^2.6.10", - "webpack": "^4.31.0", - "webpack-cli": "^3.3.2", - "webpack-dev-server": "^3.3.1", - "webpack-subresource-integrity": "^1.3.2", + "webpack": "^4.39.3", + "webpack-cli": "^3.3.7", + "webpack-dev-server": "^3.8.0", + "webpack-subresource-integrity": "^1.3.3", "yaml-import-loader": "^1.3.6" } } diff --git a/webpack.config.js b/webpack.config.js index f9ba64a..0629d61 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,3 +1,5 @@ +/* eslint-disable filenames/match-regex */ +/* eslint-disable import/no-commonjs */ const webpack = require('webpack'); const fs = require('fs'); const path = require('path'); @@ -133,7 +135,7 @@ module.exports = config; const locales = []; // Import locales list fs.readdirSync('./app/locales') - .forEach(file => locales.push(file.replace(/(.*)\.yml/, '$1'))); + .forEach(file => locales.push(file)); if (process.env.NODE_ENV === 'development') { module.exports.plugins = (module.exports.plugins || []) -- GitLab