Skip to content

Commit

Permalink
chore: import i18n yml with webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Myllaume committed Oct 5, 2024
1 parent 4faf91a commit 1584b7b
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 16 deletions.
12 changes: 1 addition & 11 deletions core/models/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@
* @copyright GNU GPL 3.0 Cosma's authors
*/

import fs from 'node:fs';
import path from 'node:path';
import Config from './config.js';
import yml from 'yaml';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

// const config = new Config();
const file = fs.readFileSync(path.join(__dirname, '../i18n.yml'), 'utf-8');
const content = yml.parse(file);
import content from '../i18n.yml';

const i = content;

Expand Down
59 changes: 56 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"mocha": "^10.4.0",
"prettier": "3.2.5",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"yaml-loader": "^0.8.1"
},
"directories": {
"doc": "docs",
Expand Down
7 changes: 6 additions & 1 deletion webpack-back.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export default {
},
target: 'node',
module: {
rules: [],
rules: [
{
test: /\.ya?ml$/,
use: 'yaml-loader',
},
],
},
plugins: [
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
Expand Down

0 comments on commit 1584b7b

Please sign in to comment.