coala / gci-leaders

A website showing Google Code-in information 🏆
https://gci-leaders.netlify.com
39 stars 45 forks source link

langParser.js: Generate language list dynamically #136

Open mooncos opened 6 years ago

mooncos commented 6 years ago

This adds langParser.js to generate the available language list automatically from available translation files. This also adds a npm script for generating before webpack bundles. Modifies .gitignore so that generated languages.js file is ignored. Adds tests. Renames nb_NO.json to nb-NO.json to comply with RFC standards.

Closes: #125

mooncos commented 6 years ago

@andrewda it needs to be changed to nb-NO as per ISO and RFC standards compliance for the npm package

jayvdb commented 6 years ago

We cant rename static/i18n/nb_NO.jsonstatic/i18n/nb-NO.json . These filenames are provided by Weblate, so we must use them otherwise they think the translation is missing.

mooncos commented 6 years ago

Ok.

blazeu commented 6 years ago

There's a webpack plugin to generate json file https://www.npmjs.com/package/generate-json-webpack-plugin

Using that will prevent us from having another js script be added to build script.

mooncos commented 6 years ago

Ok. Should I write all logic within webpack.config.js?

blazeu commented 6 years ago

Not really, you can import/require langParser.js in webpack.config.js

mooncos commented 6 years ago

@blazeu fixed that. but where is the generated JSON located?

jayvdb commented 6 years ago

ack https://github.com/coala/gci-leaders/pull/136/commits/6948c27a291c68bd3e0854537bf35ada3d5253a6

jayvdb commented 6 years ago

needs a rebase, and a recheck by @blazeu , or @wisn