0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

💄 Format translation files and remove unneeded script

This commit is contained in:
Andrés Moya 2022-01-19 11:50:18 +01:00 committed by Andrey Antukh
parent ff4d3cfeac
commit 7385445aa8
3 changed files with 46 additions and 119 deletions

View file

@ -1,73 +0,0 @@
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);
}

View file

@ -925,6 +925,9 @@ msgstr "Code"
msgid "handoff.tabs.code.selected.circle"
msgstr "Circle"
msgid "handoff.tabs.code.selected.component"
msgstr "Component"
msgid "handoff.tabs.code.selected.curve"
msgstr "Curve"
@ -937,9 +940,6 @@ msgstr "Group"
msgid "handoff.tabs.code.selected.image"
msgstr "Image"
msgid "handoff.tabs.code.selected.component"
msgstr "Component"
msgid "handoff.tabs.code.selected.mask"
msgstr "Mask"
@ -2085,6 +2085,10 @@ msgstr "Show color palette"
msgid "workspace.header.menu.show-rules"
msgstr "Show rules"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.reset-zoom"
msgstr "Reset"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.save-error"
msgstr "Error on saving"
@ -2102,32 +2106,28 @@ msgid "workspace.header.unsaved"
msgstr "Unsaved changes"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.reset-zoom"
msgstr "Reset"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit-all"
msgstr "Zoom to fil all"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-selected"
msgstr "Zoom to selected"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit"
msgstr "Fit - Scale down to fit"
msgid "workspace.header.viewer"
msgstr "View mode (%s)"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fill"
msgstr "Fill -Scale to fill"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit"
msgstr "Fit - Scale down to fit"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit-all"
msgstr "Zoom to fil all"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-full-screen"
msgstr "Full screen"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.viewer"
msgstr "View mode (%s)"
msgid "workspace.header.zoom-selected"
msgstr "Zoom to selected"
#: src/app/main/ui/workspace/libraries.cljs
msgid "workspace.libraries.add"
@ -2339,10 +2339,6 @@ msgstr "Exporting…"
msgid "workspace.options.fill"
msgstr "Fill"
#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs
msgid "workspace.options.show-fill-on-export"
msgstr "Show in exports"
#: src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs
msgid "workspace.options.flows.add-flow-start"
msgstr "Add flow start"
@ -2821,6 +2817,10 @@ msgstr "Group shadow"
msgid "workspace.options.shadow-options.title.multiple"
msgstr "Selection shadows"
#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs
msgid "workspace.options.show-fill-on-export"
msgstr "Show in exports"
#: src/app/main/ui/workspace/sidebar/options/shapes/frame.cljs, src/app/main/ui/workspace/sidebar/options/menus/measures.cljs
msgid "workspace.options.size"
msgstr "Size"

View file

@ -926,6 +926,9 @@ msgstr "Código"
msgid "handoff.tabs.code.selected.circle"
msgstr "Círculo"
msgid "handoff.tabs.code.selected.component"
msgstr "Componente"
msgid "handoff.tabs.code.selected.curve"
msgstr "Curva"
@ -938,9 +941,6 @@ msgstr "Grupo"
msgid "handoff.tabs.code.selected.image"
msgstr "Imagen"
msgid "handoff.tabs.code.selected.component"
msgstr "Componente"
msgid "handoff.tabs.code.selected.mask"
msgstr "Máscara"
@ -2100,6 +2100,10 @@ msgstr "Mostrar paleta de colores"
msgid "workspace.header.menu.show-rules"
msgstr "Mostrar reglas"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.reset-zoom"
msgstr "Restablecer"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.save-error"
msgstr "Error al guardar"
@ -2117,32 +2121,28 @@ msgid "workspace.header.unsaved"
msgstr "Cambios sin guardar"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.reset-zoom"
msgstr "Restablecer"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit-all"
msgstr "Zoom abarcar todo"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-selected"
msgstr "Zoom a selección"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit"
msgstr "Escalar para ajustar"
msgid "workspace.header.viewer"
msgstr "Modo de visualización (%s)"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fill"
msgstr "Escalar para rellenar"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit"
msgstr "Escalar para ajustar"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-fit-all"
msgstr "Zoom abarcar todo"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.zoom-full-screen"
msgstr "Pantalla completa"
#: src/app/main/ui/workspace/header.cljs
msgid "workspace.header.viewer"
msgstr "Modo de visualización (%s)"
msgid "workspace.header.zoom-selected"
msgstr "Zoom a selección"
#: src/app/main/ui/workspace/libraries.cljs
msgid "workspace.libraries.add"
@ -2354,10 +2354,6 @@ msgstr "Exportando"
msgid "workspace.options.fill"
msgstr "Relleno"
#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs
msgid "workspace.options.show-fill-on-export"
msgstr "Mostrar al exportar"
#: src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs
msgid "workspace.options.flows.add-flow-start"
msgstr "Añadir inicio de flujo"
@ -2834,6 +2830,10 @@ msgstr "Sombra del grupo"
msgid "workspace.options.shadow-options.title.multiple"
msgstr "Sombras de la seleccíón"
#: src/app/main/ui/workspace/sidebar/options/menus/fill.cljs
msgid "workspace.options.show-fill-on-export"
msgstr "Mostrar al exportar"
#: src/app/main/ui/workspace/sidebar/options/shapes/frame.cljs, src/app/main/ui/workspace/sidebar/options/menus/measures.cljs
msgid "workspace.options.size"
msgstr "Tamaño"