timwis / jkan

A lightweight, backend-free open data portal, powered by Jekyll
https://jkan.io
MIT License
220 stars 308 forks source link

Language support #59

Open timwis opened 8 years ago

timwis commented 8 years ago

Great to see an italian JKAN from @iltempe. We should have language/dictionary files to make it easier to implement in other languages.

iltempe commented 8 years ago

thanks! it is a partial translation...but i'll work on that!

iltempe commented 8 years ago

I've made some investigations on that. What do you think about this method? https://www.sylvaindurand.org/making-jekyll-multilingual/

keeganmcbride commented 6 years ago

Our JKAN is now going in Estonian, should be fully operational and live by 1 Nov. The approach mentioned above seems feasible.

timwis commented 6 years ago

That's fantastic news!! The plugin-free approach is great to hear, too, so we can pull it in upstream and share it with other JKAN users.

keeganmcbride commented 5 years ago

Our portal is now available in Estonian and English both. I haven't pushed it to live yet, but the code is available here: https://github.com/okestonia/jkan Some of the fixes are a bit sketchy, but everything seems to work. https://github.com/okestonia/jkan/commit/b0dac5ee71dc7a5f27bdd8d948f445ad6175e72a is the main commit and then there was some JS changes here as well: https://github.com/okestonia/jkan/commit/da2f50a531560185c80dd8f3282b577da8e3bb80

Basically every page is given a unique ref and a language tag. For example: (Estonian) ref: blog lang: et (English) ref: blog lang: en

and then you are able to navigate through the pages with
{% assign pages=site.pages | where:"ref", page.ref | sort: 'lang' %} {% for page in pages %} {{ page.lang }} {% endfor %}

All the Estonian pages are in root directory and then created a new folder for English pages (/en) and here we can put all the folders and files that we translate.

timwis commented 5 years ago

That's awesome, great work!! Hoping to dive in a bit more this weekend. Perhaps we can work it in to the upstream repo?

keeganmcbride commented 5 years ago

It is up now: http://opendata.riik.ee, but I have to say the English section is still a bit rough. I am having issues with the individual datasets/organizations pages. I guess there are sort of two different approaches. One would be to add boilerplate to the datasets and then have two folder with duplicate copies of the datasets and then just translate the layout pased on page.lang (probably this is what has to be done in a similar fashion to other pages). The other way, and a bit less clean, would be to just have two copies of every dataset, create duplicate layouts (datasets.html and datasets_english.html) and then adjust the javascript that is creating the datasets-items to have two containers, one in English and one in Estonian. Anyways this is still a work in progress on our end and I would love to hear your thoughts.

keeganmcbride commented 5 years ago

We now have translation for blogs working, see working example here: https://opendata.riik.ee/en/blogi/what-impact-border-trading-local-traffic/

The files are duplicated here: https://github.com/okestonia/jkan/tree/master/_blogi Then in config we play with the defaults (look from line 135) https://github.com/okestonia/jkan/blob/master/_config.yml

accessed on the blog layout via {% assign sortnews = site.blogi | where: "lang", page.lang | sort:"submitted" | reverse %}