diff --git a/_config.yml b/_config.yml index 3962c120..e24b646c 100644 --- a/_config.yml +++ b/_config.yml @@ -47,6 +47,7 @@ permalink: pretty include: - "_pages" + - "js" - .well-known collections: usps: @@ -87,5 +88,6 @@ exclude_from_localization: - .gitignore - CNAME - css/ + - js/ - images - po/ diff --git a/_data/languagenames.json b/_data/languagenames.json new file mode 100644 index 00000000..8383eee4 --- /dev/null +++ b/_data/languagenames.json @@ -0,0 +1,10 @@ +{ + "en": "English", + "es": "Español", + "cs": "Čeština", + "nl": "Nederlands", + "hr": "Hrvatski", + "hu": "Magyar", + "ru": "Русский", + "tr": "Türkçe" +} diff --git a/_data/languages.yml b/_data/languages.yml deleted file mode 100644 index 804b24c9..00000000 --- a/_data/languages.yml +++ /dev/null @@ -1,17 +0,0 @@ -languages: - - title: English - url: "/en" - - title: Español - url: "/es" - - title: Čeština - url: "/cs" - - title: Nederlands - url: "/nl" - - title: Hrvatski - url: "/hr" - - title: Magyar - url: "/hu" - - title: Русский - url: "/ru" - - title: Türkçe - url: "/tr" diff --git a/_data/strings.yml b/_data/strings.yml index caa440f9..b38b3887 100644 --- a/_data/strings.yml +++ b/_data/strings.yml @@ -44,3 +44,5 @@ footer: tech-docs: Tech docs copyright: Copyright © 2020-2023 Arjan Molenaar and Dan Yeaw. theme: Theme +languages: + change: Change diff --git a/_includes/languages.html b/_includes/languages.html index c34f0fb6..15651061 100644 --- a/_includes/languages.html +++ b/_includes/languages.html @@ -1,7 +1,20 @@ diff --git a/_pages/contribute.md b/_pages/contribute.md index 7bbf89b8..306ce3f6 100644 --- a/_pages/contribute.md +++ b/_pages/contribute.md @@ -20,5 +20,7 @@ and expectations for the various types of contribution you can make to Gaphor. The source code is hosted on [GitHub](https://github.com/gaphor/gaphor). +Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/). + If in doubt, just ask in our discussion area and someone will be able to point you in the right direction. diff --git a/js/languages.js b/js/languages.js new file mode 100644 index 00000000..95a505ae --- /dev/null +++ b/js/languages.js @@ -0,0 +1,19 @@ + +const chooser = document.getElementById('language-chooser-select'); +let activeLang = 'en'; +for (let i = 0; i < chooser.children.length; i++) { + if (chooser.children[i].selected) { + activeLang = chooser.children[i].value; + } +} + +chooser.onchange = function() { + const lang = this.value; + let pageUrl = document.location.pathname; + + if (new RegExp('^/' + activeLang + '/').test(pageUrl)) { + pageUrl = pageUrl.substring(activeLang.length + 1); + } + + document.location = '' + '/' + lang + pageUrl; +} diff --git a/po/site.cs.po b/po/site.cs.po index 827923ef..b1148a18 100644 --- a/po/site.cs.po +++ b/po/site.cs.po @@ -522,6 +522,11 @@ msgstr "Naše technická dokumentace je umístěna na skvělé službě Read the msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "Zdrojový kód je umístěn na GitHubu." +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, fuzzy, no-wrap diff --git a/po/site.es.po b/po/site.es.po index ab7ca3b6..bc4d6b75 100644 --- a/po/site.es.po +++ b/po/site.es.po @@ -522,6 +522,11 @@ msgstr "Nuestra documentación técnica está alojada en el maravilloso servicio msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "El código fuente está alojado en GitHub." +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, fuzzy, no-wrap diff --git a/po/site.hr.po b/po/site.hr.po index 9ef84d80..07824b60 100644 --- a/po/site.hr.po +++ b/po/site.hr.po @@ -513,6 +513,11 @@ msgstr "Naša se [tehnička dokumentacija](https://docs.gaphor.org/hr/latest) č msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "Izvorni kod se nalazi na [GitHubu](https://github.com/gaphor/gaphor)." +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, no-wrap diff --git a/po/site.hu.po b/po/site.hu.po index 502acc2d..3e6fba6b 100644 --- a/po/site.hu.po +++ b/po/site.hu.po @@ -497,6 +497,11 @@ msgstr "" msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "" +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, no-wrap diff --git a/po/site.nl.po b/po/site.nl.po index 99a530b6..767dc41a 100644 --- a/po/site.nl.po +++ b/po/site.nl.po @@ -523,6 +523,11 @@ msgstr "Onze technische documentatie wordt gehost op de prachtige dienst Read th msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "De broncode is beschikbaar op GitHub." +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, fuzzy, no-wrap diff --git a/po/site.pot b/po/site.pot index 1cc5bad1..dc6045e4 100644 --- a/po/site.pot +++ b/po/site.pot @@ -542,6 +542,12 @@ msgstr "" msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "" +#. type: Plain text +#: _pages/contribute.md +#, markdown-text +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, markdown-text, no-wrap diff --git a/po/site.ru.po b/po/site.ru.po index 66574202..03e931ad 100644 --- a/po/site.ru.po +++ b/po/site.ru.po @@ -502,6 +502,11 @@ msgstr "" msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "" +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, no-wrap diff --git a/po/site.tr.po b/po/site.tr.po index 6358c31e..62df9505 100644 --- a/po/site.tr.po +++ b/po/site.tr.po @@ -497,6 +497,11 @@ msgstr "" msgid "The source code is hosted on [GitHub](https://github.com/gaphor/gaphor)." msgstr "" +#. type: Plain text +#: _pages/contribute.md +msgid "Help translate Gaphor on [Weblate](https://hosted.weblate.org/engage/gaphor/)." +msgstr "" + #. type: Plain text #: _pages/contribute.md #, no-wrap