Merge pull request #2705 from element-hq/feature/bma/ghPagesFix

Gh pages fix and Localazy fix
This commit is contained in:
Benoit Marty 2024-04-15 13:26:33 +02:00 committed by GitHub
commit 6d86203190
2 changed files with 15 additions and 0 deletions

View file

@ -149,6 +149,7 @@ function addForm() {
}; };
label2.appendChild(input2); label2.appendChild(input2);
form.appendChild(label2); form.appendChild(label2);
/*
// Add a date picker to input the minimum date of modification // Add a date picker to input the minimum date of modification
const label3 = document.createElement('label'); const label3 = document.createElement('label');
label3.textContent = 'If modified since:'; label3.textContent = 'If modified since:';
@ -168,6 +169,7 @@ function addForm() {
addTable(); addTable();
}; };
form.appendChild(dateInput); form.appendChild(dateInput);
*/
// Add a span with id result to display the number of lines // Add a span with id result to display the number of lines
const lines = document.createElement('span'); const lines = document.createElement('span');
lines.id = 'lines'; lines.id = 'lines';
@ -191,6 +193,13 @@ function createMissingImageElement() {
return text; return text;
} }
function createUpToDateImageElement() {
const text = document.createElement('p');
text.className = "missing";
text.textContent = 'Image not updated';
return text;
}
function convertToHumanReadableDate(modifiedDayTime) { function convertToHumanReadableDate(modifiedDayTime) {
var date = new Date(modifiedDayTime * 86400000); var date = new Date(modifiedDayTime * 86400000);
return date.toLocaleDateString(); return date.toLocaleDateString();
@ -270,6 +279,8 @@ function addTable() {
const foreignFile = englishFile.replace("en]", `${dataLanguages[languageIndex]}]`).replace("_S_", "_T_") const foreignFile = englishFile.replace("en]", `${dataLanguages[languageIndex]}]`).replace("_S_", "_T_")
const fullForeignFile = `${dataLanguages[languageIndex]}/${foreignFile}.png`; const fullForeignFile = `${dataLanguages[languageIndex]}/${foreignFile}.png`;
td.appendChild(createImageElement(fullForeignFile, modifiedDayTime)); td.appendChild(createImageElement(fullForeignFile, modifiedDayTime));
} else {
td.appendChild(createUpToDateImageElement());
} }
} }
tr.appendChild(td); tr.appendChild(td);

View file

@ -18,6 +18,7 @@
import os import os
import re import re
import sys import sys
import time
from util import compare from util import compare
@ -134,6 +135,9 @@ def generateJavascriptFile():
if os.path.exists(translatedFile): if os.path.exists(translatedFile):
# Get the last modified date of the file in seconds and round to days # Get the last modified date of the file in seconds and round to days
date = os.popen("git log -1 --format=%ct -- \"" + translatedFile + "\"").read().strip() date = os.popen("git log -1 --format=%ct -- \"" + translatedFile + "\"").read().strip()
# if date is empty, use today's date
if date == "":
date = time.time()
dateDay = int(date) // 86400 dateDay = int(date) // 86400
dataForFile.append(dateDay) dataForFile.append(dateDay)
else: else: