i18n: .po compilation
This commit is contained in:
parent
69a3f34784
commit
e7b06ab509
|
@ -0,0 +1,31 @@
|
||||||
|
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",
|
"friendly-errors-webpack-plugin": "^1.1.3",
|
||||||
"html-webpack-plugin": "^2.28.0",
|
"html-webpack-plugin": "^2.28.0",
|
||||||
"http-proxy-middleware": "^0.17.3",
|
"http-proxy-middleware": "^0.17.3",
|
||||||
|
"i18next-conv": "^6.0.0",
|
||||||
"inject-loader": "^3.0.0",
|
"inject-loader": "^3.0.0",
|
||||||
"karma": "^1.4.1",
|
"karma": "^1.4.1",
|
||||||
"karma-coverage": "^1.1.1",
|
"karma-coverage": "^1.1.1",
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -0,0 +1,13 @@
|
||||||
|
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"
|
|
@ -0,0 +1,13 @@
|
||||||
|
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"
|
Loading…
Reference in New Issue