0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-11 01:28:30 -05:00

🎉 Add accidentally deleted germany translations file.

This commit is contained in:
Andrey Antukh 2021-05-05 11:15:49 +02:00
parent 4db7a6782b
commit 0030b9c3ac
3 changed files with 2481 additions and 1 deletions

View file

@ -32,7 +32,7 @@ paths.dist = "./target/dist/";
// Templates
function readLocales() {
const langs = ["ca", "el", "en", "es", "fr", "tr", "ru", "zh_cn"];
const langs = ["ca", "de", "el", "en", "es", "fr", "tr", "ru", "zh_cn"];
const result = {};
for (let lang of langs) {

View file

@ -0,0 +1,73 @@
const l = require("lodash");
const fs = require("fs");
const gt = require("gettext-parser");
function generateLang(data, lang) {
let output = {};
for (let key of Object.keys(data)) {
const trObj = data[key];
const trRef = trObj["used-in"];
let content = trObj.translations[lang];
let comments = {};
if (l.isNil(content)) {
continue;
} else {
let result = {
msgid: key,
comments: {}
}
if (l.isArray(trRef)) {
result.comments.reference = trRef.join(", ");
}
if (trObj.permanent) {
result.comments.flag = "permanent";
}
if (l.isArray(content)) {
result.msgid_plural = key;
result.msgstr = content;
} else if (l.isString(content)) {
result.msgstr = [content];
} else {
throw new Error("unexpected");
}
output[key] = result;
}
}
if (lang.includes("_")) {
const [a, b] = lang.split("_");
lang = `${a}_${b.toUpperCase()}`;
}
const poData = {
charset: "utf-8",
headers: {
"Language": lang,
"MIME-Version": "1.0",
"Content-Type": "text/plain; charset=UTF-8",
"Content-Transfer-Encoding": "8bit",
"Plural-Forms": "nplurals=2; plural=(n != 1);"
},
"translations": {
"": output
}
}
const buff = gt.po.compile(poData, {sort: true});
fs.writeFileSync(`./translations/${lang}.po`, buff);
}
const content = fs.readFileSync("./resources/locales.json");
const data = JSON.parse(content);
const langs = ["de"];
for (let lang of langs) {
generateLang(data, lang);
}

2407
frontend/translations/de.po Normal file

File diff suppressed because it is too large Load diff