🌐 Add the english version of the alt

This commit is contained in:
Kazhnuz 2025-02-16 13:08:08 +01:00
parent eec1c50693
commit 1496614da1

View file

@ -8,6 +8,10 @@ const myGm = gm.subClass({imageMagick: true});
const position = {x: 4, y: 2, gravity: "NorthEast"} const position = {x: 4, y: 2, gravity: "NorthEast"}
const metadatas = [] const metadatas = []
function capitalizeFirstLetter(val) {
return String(val).charAt(0).toUpperCase() + String(val).slice(1);
}
function createFilename(prideflag, text, now = false) { function createFilename(prideflag, text, now = false) {
const adaptedText = text const adaptedText = text
.replaceAll("⋅", "_") .replaceAll("⋅", "_")
@ -43,7 +47,8 @@ function createMetadatas(prideflag, text, now = false) {
const filename = createFilename(prideflag, text, now); const filename = createFilename(prideflag, text, now);
const textForAlt = text.replaceAll("\n", " ").toLowerCase(); const textForAlt = text.replaceAll("\n", " ").toLowerCase();
const alt = `Drapeau ${prideflag.name.fr.toLowerCase()} (${prideflag.alt.fr}) avec écrit "${textForAlt}${now?", now!": ""}"` const alt = `Drapeau ${prideflag.name.fr.toLowerCase()} (${prideflag.alt.fr}) avec écrit "${textForAlt}${now?", now!": ""}"`
return {file:filename, alt:alt, text:textForAlt}; const alten = `${capitalizeFirstLetter(prideflag.name.en)} flag (${prideflag.alt.en}) with written "${textForAlt}${now?", now!": ""}"`
return {file:filename, alt:alt, localizedAlt:{en: alten, fr: alt}, text:textForAlt};
} }
let count = 0; let count = 0;