Skip to content

Commit

Permalink
Find available locales dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
markokajzer committed Aug 27, 2018
1 parent 7e2e900 commit d972d61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/i18n/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import i18n = require('i18n');

import fs from 'fs';
import path from 'path';

const files = fs.readdirSync('./config/locales');


i18n.configure({
locales: ['en', 'de', 'hu'],
locales: files.map(file => file.split('.')[0]),
defaultLocale: 'en',
directory: path.join(__dirname, '..', '..', 'config', 'locales'),
objectNotation: true
Expand Down

0 comments on commit d972d61

Please sign in to comment.