From c543e194a63a68fc4b1a90156b639767d166bc18 Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 14:12:20 +0200 Subject: [PATCH 1/8] #59 suml loader --- nuxt.config.js | 9 ++++++--- package.json | 1 + yarn.lock | 12 ++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index 8a7c015e..42abe3c2 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -66,7 +66,11 @@ export default { skipEmptyLines: true, delimiter: '\t', } - }) + }); + config.module.rules.push({ + test: /\.suml$/, + loader: 'suml-loader', + }); }, }, env: { @@ -80,6 +84,5 @@ export default { }, axios: { baseURL: process.env.BASE_URL, - } - + }, } diff --git a/package.json b/package.json index 5506583d..c6a6bd97 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "sql-template-strings": "^2.2.2", "sqlite": "^4.0.12", "sqlite3": "^5.0.0", + "suml-loader": "^0.1.1", "ulid": "^2.3.0", "vue-matomo": "^3.13.5-0" }, diff --git a/yarn.lock b/yarn.lock index 6b839e34..25ca3868 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7852,6 +7852,18 @@ stylehacks@^4.0.0: postcss "^7.0.0" postcss-selector-parser "^3.0.0" +suml-loader@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/suml-loader/-/suml-loader-0.1.1.tgz#b9ce45822ed9f7255cf868cc4d4be263d6b8cd4c" + integrity sha512-K7tcM6FXgzZIL6KT1JkK2eXajQztT2QdQOwg+t+HoApLiwGv/qPg7je8TYxP+N9fAL7VOL5/Ze1etgX134FOvA== + dependencies: + suml "^0.2.1" + +suml@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/suml/-/suml-0.2.1.tgz#f2ed3566ba3618fa2e5731b0b048d684814eda9f" + integrity sha512-QS97EY1DxZGMljvy8V1I5Mh31pvX9CcthmgnmKtJ5gI0BncUaTJSeskRTCfkXadD59NcYZq0438CATr3Oyegfw== + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" From 4bcbcceed38460c90b1a642409d1a97464b0d04b Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 14:14:00 +0200 Subject: [PATCH 2/8] #59 translation framework --- components/LinkedText.vue | 57 +++++++++++++++++++++++++++++++++++++++ components/T.vue | 34 +++++++++++++++++++++++ data/pl/translations.suml | 5 ++++ 3 files changed, 96 insertions(+) create mode 100644 components/LinkedText.vue create mode 100644 components/T.vue create mode 100644 data/pl/translations.suml diff --git a/components/LinkedText.vue b/components/LinkedText.vue new file mode 100644 index 00000000..44bda63c --- /dev/null +++ b/components/LinkedText.vue @@ -0,0 +1,57 @@ + diff --git a/components/T.vue b/components/T.vue new file mode 100644 index 00000000..0b82fc00 --- /dev/null +++ b/components/T.vue @@ -0,0 +1,34 @@ + + + diff --git a/data/pl/translations.suml b/data/pl/translations.suml new file mode 100644 index 00000000..2b5a0394 --- /dev/null +++ b/data/pl/translations.suml @@ -0,0 +1,5 @@ +foo: + bar: + - 'baz' + - 'heheh' + hehe: '{osiem}!' From a3ad9d03bb2b3d4c83acac97180978cbd7ed644a Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 17:51:26 +0200 Subject: [PATCH 3/8] #59 move strings to translations, use symlink to select locale --- .gitignore | 3 +- README.md | 3 +- components/About.vue | 55 -------- components/Footer.vue | 9 +- components/Header.vue | 14 +- components/Homepage.vue | 2 +- components/LinkedText.vue | 25 +++- components/Links.vue | 2 +- components/Literature.vue | 8 +- components/Media.vue | 2 +- components/NormativeBadge.vue | 2 +- components/NotFound.vue | 4 +- components/NounSubmitForm.vue | 36 ++--- components/Share.vue | 2 +- components/Socials.vue | 2 +- components/T.vue | 16 +-- data/pl/translations.suml | 5 - {data => locale/pl}/examples.tsv | 30 ++-- {data => locale/pl}/nounTemplates.tsv | 0 {data => locale/pl}/sources.tsv | 174 +++++++++++------------ {data => locale/pl}/templateGroups.tsv | 0 {data => locale/pl}/templates.tsv | 46 +++---- locale/pl/translations.suml | 183 +++++++++++++++++++++++++ nuxt.config.js | 8 +- pages/_.vue | 19 +-- pages/dowolne.vue | 18 ++- pages/index.vue | 56 ++++---- pages/kontakt.vue | 6 +- pages/literatura.vue | 41 +++--- pages/neutratywy.vue | 61 +++------ plugins/plugin-translate.js | 6 + server/banner.js | 3 +- server/translations.js | 3 + src/classes.js | 18 +-- src/translator.js | 14 ++ 35 files changed, 502 insertions(+), 374 deletions(-) delete mode 100644 components/About.vue delete mode 100644 data/pl/translations.suml rename {data => locale/pl}/examples.tsv (99%) rename {data => locale/pl}/nounTemplates.tsv (100%) rename {data => locale/pl}/sources.tsv (99%) rename {data => locale/pl}/templateGroups.tsv (100%) rename {data => locale/pl}/templates.tsv (99%) create mode 100644 locale/pl/translations.suml create mode 100644 plugins/plugin-translate.js create mode 100644 server/translations.js create mode 100644 src/translator.js diff --git a/.gitignore b/.gitignore index 48370ec6..04927aff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -/data/db.sqlite +/data +/locale/*/db.sqlite /daemonise.json /daemonise.log diff --git a/README.md b/README.md index 10085c23..3cba9be9 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ $ yarn install # configure environment $ cp .env.dist .env $ nano .env +$ ln -s locale/pl data # or other locale $ node server/initDb.js # serve with hot reload at localhost:3000 @@ -26,5 +27,5 @@ For detailed explanation on how things work, check out [Nuxt.js docs](https://nu ## Copyright - * **Author:** Andrea Prusinowski [(Avris.it)](https://avris.it) + * **Author:** Andrea [(Avris.it)](https://avris.it) * **Licence:** [MIT](https://mit.avris.it) diff --git a/components/About.vue b/components/About.vue deleted file mode 100644 index 558a3c4e..00000000 --- a/components/About.vue +++ /dev/null @@ -1,55 +0,0 @@ - diff --git a/components/Footer.vue b/components/Footer.vue index ca80b90b..8a527e32 100644 --- a/components/Footer.vue +++ b/components/Footer.vue @@ -4,22 +4,19 @@

- Autorza strony: + contact.authors:

- Kod jest - udostępniony - na licencji - MIT. + footer.source

- Kontakt, social media, wsparcie: + footer.links:

diff --git a/components/Header.vue b/components/Header.vue index 6168c6b0..362f2596 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -3,7 +3,7 @@

- Zaimki.pl + title

@@ -27,15 +27,17 @@ diff --git a/components/Header.vue b/components/Header.vue index 362f2596..eebfda98 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -31,14 +31,27 @@ export default { data() { + const links = []; + links.push({ link: '/', icon: 'home', text: t('home.header'), textLong: t('home.headerLong'), extra: ['all', this.config.template.any.route] }); + + if (this.config.sources.enabled) { + links.push({ link: '/' + this.config.sources.route, icon: 'books', text: t('sources.header'), textLong: t('sources.headerLong') }); + } + + if (this.config.nouns.enabled) { + links.push({ link: '/' + this.config.nouns.route, icon: 'atom-alt', text: t('nouns.header'), textLong: t('nouns.headerLong') }); + } + + if (this.config.links.enabled) { + links.push({ link: '/' + this.config.links.route, icon: 'bookmark', text: t('links.header'), textLong: t('links.headerLong') }); + } + + if (this.config.contact.enabled) { + links.push({ link: '/' + this.config.contact.route, icon: 'comment-alt-smile', text: t('contact.header')}); + } + return { - links: [ - { link: '/', icon: 'home', text: t('home.header'), textLong: t('home.headerLong'), extra: ['all', 'dowolne'] }, // TODO multilingual "any" - { link: '/literatura', icon: 'books', text: t('sources.header'), textLong: t('sources.headerLong') }, - { link: '/neutratywy', icon: 'atom-alt', text: t('nouns.header'), textLong: t('nouns.headerLong') }, - { link: '/linki', icon: 'bookmark', text: t('links.header'), textLong: t('links.headerLong') }, - { link: '/kontakt', icon: 'comment-alt-smile', text: t('contact.header') }, - ], + links, }; }, methods: { diff --git a/components/Link.vue b/components/Link.vue new file mode 100644 index 00000000..32ceba36 --- /dev/null +++ b/components/Link.vue @@ -0,0 +1,17 @@ + + + diff --git a/components/Links.vue b/components/Links.vue index 0ec7cb33..0ae673bd 100644 --- a/components/Links.vue +++ b/components/Links.vue @@ -1,70 +1,11 @@ diff --git a/components/Media.vue b/components/Media.vue index abea8520..497cc555 100644 --- a/components/Media.vue +++ b/components/Media.vue @@ -1,24 +1,11 @@ diff --git a/components/Socials.vue b/components/Socials.vue index 421d1bf9..4f80f2b2 100644 --- a/components/Socials.vue +++ b/components/Socials.vue @@ -1,26 +1,11 @@ diff --git a/locale/pl/GrammarTables.vue b/locale/pl/GrammarTables.vue new file mode 100644 index 00000000..3c5f2a53 --- /dev/null +++ b/locale/pl/GrammarTables.vue @@ -0,0 +1,63 @@ + + + diff --git a/locale/pl/config.suml b/locale/pl/config.suml new file mode 100644 index 00000000..bcf44d13 --- /dev/null +++ b/locale/pl/config.suml @@ -0,0 +1,116 @@ +locale: 'pl' + +template: + any: + route: 'dowolne' + +sources: + enabled: true + route: 'literatura' + +nouns: + enabled: true + route: 'neutratywy' + + +links: + enabled: true + route: 'linki' + links: + - + icon: 'globe-europe' + url: 'https://pronoun.is/' + headline: 'Pronoun.is' + extra: '– anglojęzyczna inspiracja dla tej strony.' + - + icon: 'comment-alt-edit' + url: 'https://avris.it/blog/czemu-każdy-powinien-mieć-zaimki-w-bio' + headline: 'Czemu KAŻDY powinien mieć zaimki w bio' + - + icon: 'comment-alt-edit' + url: 'https://avris.it/blog/genderneutralizacja-polszczyzny' + headline: 'Genderneutralizacja polszczyzny?' + extra: '– artykuł opisujący, dlaczego język neutralny płciowo jest ważny, i zbierający pomysły na stworzenie takiego.' + - + icon: 'comment-alt-edit' + url: 'https://www.przemyslenia-maniaka.pl/2019/11/maniak-marudzi-27-niebinarne-tumaczenia.html' + headline: 'Maniak marudzi #27: Niebinarne tłumaczenia' + extra: '– artykuł pokazujący, że „nie da się przetłumaczyć they/them na polski” to tylko wymówka.' + - + icon: 'comment-alt-edit' + url: 'http://wasowska.net/2020/09/rowni-wobec-jezyka-o-jezyku-neutralnym-plciowo/' + headline: 'Równi wobec języka – o języku neutralnym płciowo' + extra: '– artykuł Agnieszki Wąsowskiej' + - + icon: 'play-circle' + url: 'https://www.youtube.com/watch?v=YOEB6Ixp048' + headline: 'Nie-binarny język polski – seminarium naukowe (Queer UW)' + extra: '' + - + icon: 'play-circle' + url: 'https://rss.com/podcasts/bezwstydny/75056/' + headline: 'Niebinarność, neutratywy i prawa człowieka – Rozmowa z W. Dynarskim (Bezwstydne Podcast)' + extra: '– o zaimki.pl i neutratywach w okolicach 13:40' + - + icon: 'instagram' + iconSet: 'b' + url: 'https://www.instagram.com/inkluzywnamowa/' + headline: '@inkluzywnamowa' + - + icon: 'facebook' + iconSet: 'b' + url: 'https://facebook.com/slownikempatyczny' + headline: 'Słownik Empatyczny Języka Polskiego' + media: + - + icon: 'newspaper' + url: 'https://queer.pl/artykul/204685/zaimkipl-strona-jezyk-polski-niebinarnosc' + headline: 'Zaimki.pl: powstała strona ułatwiająca dostosowanie języka polskiego osobom niebinarnym. Rozmawialiśmy z jej twórcą i twórczynium – Queer.pl' + - + icon: 'radio' + url: 'https://pod.co/haloradio/joanna-frejus-2020-08-23-17-00' + headline: 'Osoby redaktorskie Słownika Neutratywów u Joanny Frejus w Halo.Radio' + socials: + - + icon: 'instagram' + iconSet: 'b' + url: 'https://instagram.com/neutratywy' + headline: 'instagram.com/neutratywy – „Słownik Neutratywów Języka Polskiego”' + - + icon: 'facebook' + iconSet: 'b' + url: 'https://facebook.com/neutratywy' + headline: 'fb.com/neutratywy – „Słownik Neutratywów Języka Polskiego”' + +contact: + enabled: true + route: 'kontakt' + authors: + - + name: 'Andrea' + pronouns: 'onu' + pronounsLink: '/onu' + website: 'https://avris.it' + twitter: 'AvrisIT' + mail: 'andrea@avris.it' + areas: + kod: 'https://gitlab.com/Avris/Zaimki' + język: ~ + - + name: 'Paweł Dembowski' + pronouns: 'on' + pronounsLink: '/on' + twitter: 'VaultAusir' + mail: 'pawel.dembowski@gmail.com' + areas: + język: ~ + literatura: '/literatura' + - + name: 'Zuzanna Sybilla Grzybowska' + pronouns: 'on/ona/ono' + pronounsLink: '/on&ona&ono' + twitter: 'mykofanes' + mail: 'zuzannagrzybowska@protonmail.com' + areas: + neutratywy: '/neutratywy' + social_media: ~ diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml index 570fd608..422bde48 100644 --- a/locale/pl/translations.suml +++ b/locale/pl/translations.suml @@ -70,7 +70,6 @@ template: others: 'Inne formy' othersRaw: 'inne' or: 'lub' - declension: 'Odmiana' sources: header: 'Teksty kultury' diff --git a/nuxt.config.js b/nuxt.config.js index 34cebc9c..3528fb0a 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -40,7 +40,7 @@ export default { css: [], plugins: [ { src: '~/plugins/vue-matomo.js', ssr: false }, - { src: '~/plugins/plugin-translate.js' }, + { src: '~/plugins/globals.js' }, ], components: true, buildModules: [], diff --git a/pages/_.vue b/pages/_.vue index b08a0d51..46d5d353 100644 --- a/pages/_.vue +++ b/pages/_.vue @@ -35,58 +35,7 @@ -
-

- - template.declension: -

- -
- - - - - - - - - - - - - - - - - - - - - -
MianownikDopełniaczCelownikBiernikNarzędnikMiejscownik
{{ selectedTemplate.getMorpheme('pronoun_n', counter) }}{{ selectedTemplate.getMorpheme('pronoun_g', counter) }} / {{ selectedTemplate.getMorpheme('pronoun_g_acc', counter) }}{{ selectedTemplate.getMorpheme('pronoun_d', counter) }}{{ selectedTemplate.getMorpheme('pronoun_a', counter) }}{{ selectedTemplate.getMorpheme('pronoun_i', counter) }}{{ selectedTemplate.getMorpheme('pronoun_l', counter) }}
-
- -
- - - - - - - - - - - - - - - - - -
1 os.2 os.3 os.Przymiotniki
-{{ selectedTemplate.getMorpheme('verb_middle_inter', counter) }}{{ selectedTemplate.plural ? 'śmy' : 'm'}}-{{ selectedTemplate.getMorpheme('verb_middle_inter', counter) }}{{ selectedTemplate.plural ? 'ście' : 'ś'}}-{{ selectedTemplate.getMorpheme('verb_end_about', counter) }}-{{ selectedTemplate.getMorpheme('adjective_n', counter) }}
-
-
+
@@ -119,8 +68,10 @@ import { examples, templates, getSources } from "~/src/data"; import { buildTemplate } from "../src/buildTemplate"; import { head } from "../src/helpers"; + import GrammarTables from "../data/GrammarTables"; export default { + components: { GrammarTables }, data() { return { examples: examples, diff --git a/plugins/plugin-translate.js b/plugins/globals.js similarity index 60% rename from plugins/plugin-translate.js rename to plugins/globals.js index ebca0ad0..fbcc1bdb 100644 --- a/plugins/plugin-translate.js +++ b/plugins/globals.js @@ -1,6 +1,8 @@ import Vue from 'vue' import t from '../src/translator'; +import config from '../data/config.suml'; export default ({ app }) => { Vue.prototype.$t = t; + Vue.prototype.config = config; } From a12a55b166fc1dda1e834ced375a61570592e23f Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 19:22:36 +0200 Subject: [PATCH 5/8] #59 multilingual support - routing, fixes --- components/LinkedText.vue | 2 +- components/Links.vue | 2 +- components/Literature.vue | 5 +++-- components/Media.vue | 2 +- components/Socials.vue | 2 +- locale/pl/config.suml | 1 - locale/pl/translations.suml | 1 + nuxt.config.js | 24 ++++++++++++++++++++++ pages/index.vue | 4 ++-- pages/dowolne.vue => routes/any.vue | 4 ++-- pages/kontakt.vue => routes/contact.vue | 0 pages/linki.vue => routes/links.vue | 0 pages/neutratywy.vue => routes/nouns.vue | 4 ++-- pages/literatura.vue => routes/sources.vue | 2 +- pages/_.vue => routes/template.vue | 6 +----- server/banner.js | 2 +- server/config.js | 3 +++ 17 files changed, 44 insertions(+), 20 deletions(-) rename pages/dowolne.vue => routes/any.vue (92%) rename pages/kontakt.vue => routes/contact.vue (100%) rename pages/linki.vue => routes/links.vue (100%) rename pages/neutratywy.vue => routes/nouns.vue (97%) rename pages/literatura.vue => routes/sources.vue (98%) rename pages/_.vue => routes/template.vue (96%) create mode 100644 server/config.js diff --git a/components/LinkedText.vue b/components/LinkedText.vue index 1df8d7dc..3775177d 100644 --- a/components/LinkedText.vue +++ b/components/LinkedText.vue @@ -34,7 +34,7 @@ ); } - return h('nuxt-link', {props: { to: linkBuffer || '/neutratywy#' + buffer }}, buffer); + return h('nuxt-link', {props: { to: linkBuffer || '/' + this.config.nouns.route + '#' + buffer }}, buffer); } const addChild = _ => { if (!buffer) { diff --git a/components/Links.vue b/components/Links.vue index 0ae673bd..d278eb3f 100644 --- a/components/Links.vue +++ b/components/Links.vue @@ -5,7 +5,7 @@ links.headerLong
    - +
diff --git a/components/Literature.vue b/components/Literature.vue index 32e1a2ce..b4aaed38 100644 --- a/components/Literature.vue +++ b/components/Literature.vue @@ -1,7 +1,7 @@ diff --git a/components/Socials.vue b/components/Socials.vue index 4f80f2b2..5a451bb5 100644 --- a/components/Socials.vue +++ b/components/Socials.vue @@ -5,7 +5,7 @@ links.social
    - +
diff --git a/locale/pl/config.suml b/locale/pl/config.suml index bcf44d13..d23b27cf 100644 --- a/locale/pl/config.suml +++ b/locale/pl/config.suml @@ -12,7 +12,6 @@ nouns: enabled: true route: 'neutratywy' - links: enabled: true route: 'linki' diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml index 422bde48..4a24480f 100644 --- a/locale/pl/translations.suml +++ b/locale/pl/translations.suml @@ -89,6 +89,7 @@ sources: nouns: header: 'Neutratywy' headerLong: 'Słownik neutratywów' + description: 'Feminatywy feminatywami, ale prawdziwe wyzwanie to tworzenie neutratywów! Przedstawiamy tworzony przez społeczność słownik rzeczowników z wyszczególnieniem ich formy męskiej, żeńskiej i neutralnej.' intro: - > Feminatywy feminatywami, ale prawdziwe wyzwanie to tworzenie neutratywów! diff --git a/nuxt.config.js b/nuxt.config.js index 3528fb0a..6ccc9960 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,4 +1,5 @@ import translations from './server/translations'; +import config from './server/config'; const title = translations.title; const description = translations.description; @@ -89,4 +90,27 @@ export default { axios: { baseURL: process.env.BASE_URL, }, + router: { + extendRoutes(routes, resolve) { + if (config.sources.enabled) { + routes.push({ path: '/' + config.sources.route, component: resolve(__dirname, 'routes/sources.vue') }); + } + + if (config.nouns.enabled) { + routes.push({ path: '/' + config.nouns.route, component: resolve(__dirname, 'routes/nouns.vue') }); + } + + if (config.links.enabled) { + routes.push({ path: '/' + config.links.route, component: resolve(__dirname, 'routes/links.vue') }); + } + + if (config.contact.enabled) { + routes.push({ path: '/' + config.contact.route, component: resolve(__dirname, 'routes/contact.vue') }); + } + + routes.push({ path: '/' + config.template.any.route, component: resolve(__dirname, 'routes/any.vue') }); + + routes.push({ path: '*', component: resolve(__dirname, 'routes/template.vue') }); + }, + }, } diff --git a/pages/index.vue b/pages/index.vue index 006e2ad6..bfcbb4f2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -166,7 +166,7 @@
  • - template.any.header + template.any.header

    template.any.description @@ -271,7 +271,7 @@ diff --git a/server/banner.js b/server/banner.js index eb99d461..43460494 100644 --- a/server/banner.js +++ b/server/banner.js @@ -55,7 +55,7 @@ export default async function (req, res, next) { context.fillText(templateNameOptions.join('\n'), width / leftRatio + imageSize / 1.5, height / 2 + (templateNameOptions.length <= 2 ? 72 : 24)) } else { context.font = 'regular 120pt Quicksand' - context.fillText('Zaimki.pl', width / leftRatio + imageSize / 1.5, height / 2 + 48) + context.fillText(translations.title, width / leftRatio + imageSize / 1.5, height / 2 + 48) } res.setHeader('content-type', mime); diff --git a/server/config.js b/server/config.js new file mode 100644 index 00000000..f90562b6 --- /dev/null +++ b/server/config.js @@ -0,0 +1,3 @@ +import Suml from 'suml'; +const fs = require('fs'); +export default new Suml().parse(fs.readFileSync('./data/config.suml').toString()); From 015fc69d510a0b36946ee8cf64abef5a0d09afbf Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 19:32:05 +0200 Subject: [PATCH 6/8] #59 multilingual support - morphemes --- src/buildTemplate.js | 5 +++-- src/classes.js | 23 +---------------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/buildTemplate.js b/src/buildTemplate.js index 48b86679..79c53b5d 100644 --- a/src/buildTemplate.js +++ b/src/buildTemplate.js @@ -1,6 +1,7 @@ -import {MORPHEMES, Template} from "./classes"; +import { Template } from "./classes"; import Compressor from "./compressor"; -import {buildDict} from "./helpers"; +import { buildDict } from "./helpers"; +import MORPHEMES from '../data/morphemes'; export const addAliasesToTemplates = (templates) => { const templatesWithAliases = {} diff --git a/src/classes.js b/src/classes.js index 1a52d982..8a1bc937 100644 --- a/src/classes.js +++ b/src/classes.js @@ -1,4 +1,5 @@ import {buildDict, buildList} from "./helpers"; +import MORPHEMES from '../data/morphemes'; export class ExamplePart { constructor(variable, str) { @@ -92,28 +93,6 @@ export class Source { } } -export const MORPHEMES = [ - 'pronoun_n', - 'pronoun_g', - 'pronoun_g_acc', - 'pronoun_d', - 'pronoun_a', - 'pronoun_i', - 'pronoun_l', - 'pronoun_all', - 'adjective_n', - 'adjective_ll', - 'adjective_middle', - 'verb_end_inter', - 'verb_end_about', - 'verb_middle_inter', - 'verb_middle_about', - 'verb_nasal', - 'verb_go', - 'verb_o', - 'honorific', -]; - const escape = s => { if (Array.isArray(s)) { s = s.join('&'); From 6edb13406bc477c4601becb5da1bf59a7220ad3d Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 20:11:51 +0200 Subject: [PATCH 7/8] #59 locale switch --- Makefile | 4 ++++ README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 16a5c15d..14d754d7 100644 --- a/Makefile +++ b/Makefile @@ -12,3 +12,7 @@ stop: deploy: install yarn build + +switch: + -rm data + ln -s ./locale/${LANG} ./data diff --git a/README.md b/README.md index 3cba9be9..4f253cbf 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ $ yarn install # configure environment $ cp .env.dist .env $ nano .env -$ ln -s locale/pl data # or other locale +$ make switch LANG=pl $ node server/initDb.js # serve with hot reload at localhost:3000 From de8e216dd2cb1f6c4073668c6b3d8fabdead4048 Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 28 Sep 2020 20:28:00 +0200 Subject: [PATCH 8/8] #59 localisation fixes --- locale/pl/config.suml | 1 + locale/pl/morphemes.js | 21 +++++++++++++++++++++ pages/index.vue | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 locale/pl/morphemes.js diff --git a/locale/pl/config.suml b/locale/pl/config.suml index d23b27cf..589fcebd 100644 --- a/locale/pl/config.suml +++ b/locale/pl/config.suml @@ -1,6 +1,7 @@ locale: 'pl' template: + default: 'on' any: route: 'dowolne' diff --git a/locale/pl/morphemes.js b/locale/pl/morphemes.js new file mode 100644 index 00000000..9123cf7e --- /dev/null +++ b/locale/pl/morphemes.js @@ -0,0 +1,21 @@ +export default [ + 'pronoun_n', + 'pronoun_g', + 'pronoun_g_acc', + 'pronoun_d', + 'pronoun_a', + 'pronoun_i', + 'pronoun_l', + 'pronoun_all', + 'adjective_n', + 'adjective_ll', + 'adjective_middle', + 'verb_end_inter', + 'verb_end_about', + 'verb_middle_inter', + 'verb_middle_about', + 'verb_nasal', + 'verb_go', + 'verb_o', + 'honorific', +]; diff --git a/pages/index.vue b/pages/index.vue index bfcbb4f2..552d2b02 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -198,7 +198,7 @@ getTemplate: getTemplate, templateLibrary: templateLibrary, - selectedTemplate: templates['on'].clone(), + selectedTemplate: templates[this.config.template.default].clone(), selectedMorpheme: '', customiseMultiple: false,