Commit e7b06ab5 authored by Ana Gelez's avatar Ana Gelez

i18n: .po compilation

parent 69a3f347
const fs = require('fs');
const path = require('path');
const { gettextToI18next } = require('i18next-conv');
// Convert .po files to i18next files
fs.readdir(path.join(__dirname, '..', '..', 'po'), (err, files) => {
if (err) {
return console.log(err)
}
for (const file of files) {
if (file.endsWith('.po')) {
const lang = file.replace(/\.po$/, '')
const output = path.join(__dirname, '..', 'static', 'translations', `${lang}.json`)
fs.readFile(path.join(__dirname, '..', '..', 'po', file), (err, content) => {
if (err) {
return console.log(err)
}
gettextToI18next(lang, content).then(res => {
fs.writeFile(output, res, err => {
if (err) {
console.log(err)
}
})
})
})
}
}
})
......@@ -70,6 +70,7 @@
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"i18next-conv": "^6.0.0",
"inject-loader": "^3.0.0",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
......
{}
\ No newline at end of file
{}
\ No newline at end of file
msgid ""
msgstr ""
"Project-Id-Version: Funkwhale 0.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-23 15:49-0700\n"
"PO-Revision-Date: 2018-04-08 16:58+0100\n"
"Last-Translator: baptiste <baptiste@gelez.xyz>\n"
"Language-Team: English\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
msgstr ""
"Project-Id-Version: Funkwhale 0.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-23 15:49-0700\n"
"PO-Revision-Date: 2018-04-08 16:58+0100\n"
"Last-Translator: baptiste <baptiste@gelez.xyz>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment