Icons_to_HTML: Allow to create an English HTML file.

This commit is contained in:
wp_xyz 2024-10-20 23:16:21 +02:00
parent 9a3e82cf06
commit 86747675cb
7 changed files with 260 additions and 67 deletions

View File

@ -21,7 +21,7 @@
<table>
<tr class="no_border">
<td class="colorset1 right_border"></td>
<td class="colorset2 text_center" colspan="6">Size</td>
<td class="colorset2 text_center" colspan="6">Größe</td>
</tr>
<tr>
<td class="colorset1 right_border">Name</td>
@ -5641,7 +5641,7 @@
</tr>
</table>
<div class="infobox colorset2">
This folder contains 3738 icons in 623 icon groups with 6 icon sizes.
Dieser Ordner enthält 3738 Icons in 623 Icon-Gruppen mit 6 Icon-Größen.
<hr>
The images in this folder can be used in Lazarus applications as toolbar or button icons.<br>
<br>

View File

@ -15,24 +15,48 @@ msgstr ""
msgid "Error"
msgstr "Fehler"
#: main.rsfreelyavailable
msgid "freely available, no restrictions in usage"
msgstr "Frei verwendbar ohne Einschränkungen"
#: main.rsimageswereprovidedby
#, object-pascal-format
msgid "The images were kindly provided by Roland Hahn (%s)."
msgstr "Die Bilder wurden freundlicherweise von Roland Hahn zur Verfügung gestellt (%s)."
#: main.rsinformation
msgid "Information"
msgstr "Information"
#: main.rsinfotext1
msgid "The images in this folder can be used in Lazarus applications as toolbar or button icons."
msgstr "Die Bilder in diesem Ordner können in Lazarus-Anwendungen als Toolbar- oder Button-Icons verwendet werden."
#: main.rsinfotext2
msgid "The different sizes as required by LCL scaling for high-dpi screens can be used like this, for example:"
msgstr "Die verschiedenen, für LCL-Skalierung auf hochaufgelösten Bildschirmen benötigten Größen können beispielsweise wie folgt eingesetzt werden:"
#: main.rslicense
#, object-pascal-format
msgid ""
"License:\n"
"%s"
msgstr ""
"Lizenz:\n"
"%s"
#: main.rsname
msgid "Name"
msgstr "Name"
#: main.rsnomatchingpngimagefilesfoundin
#, object-pascal-format, fuzzy
#| msgid "No matching png image files found in %s"
msgid "No matching PNG image files found in %s"
#, object-pascal-format
msgid "No matching png image files found in %s"
msgstr "Keine passenden png-Bilddateien gefunden in %s"
#: main.rsnopngimagefilesfoundin
#, object-pascal-format, fuzzy
#| msgid "No png image files found in %s"
msgid "No PNG image files found in %s"
#, object-pascal-format
msgid "No png image files found in %s"
msgstr "Keine png-Bilddateien gefunden in %s"
#: main.rssavedas
@ -44,10 +68,20 @@ msgstr "Gespeichert als: %s"
msgid "Size"
msgstr "Größe"
#: main.rssizeinfolarge
msgid "32x32, 48x48 and 64x64 pixels for \"large\" images."
msgstr "32x32, 48x48 und 64x64 Pixel für \"große\" Bilder."
#: main.rssizeinfomedium
msgid "24x24, 36x36 and 48x48 pixels for \"medium\" sized images,"
msgstr "24x24, 36x36 und 48x48 Pixel für Bilder \"mittlerer\" Größe,"
#: main.rssizeinfosmall
msgid "16x16, 24x24 and 32x32 pixels for \"small\" images,"
msgstr "16x16, 24x24 und 32x32 Pixel für \"kleine\" Bilder,"
#: main.rstheconfigurationcouldnotbesaved
#, fuzzy
#| msgid "The configuration could not be saved."
msgid "Configuration file could not be saved."
msgid "The configuration file could not be saved."
msgstr "Die Konfiguration konnte nicht gespeichert werden."
#: main.rsthefilecouldnotbesavedas
@ -56,13 +90,9 @@ msgid "The file could not be saved as: %s"
msgstr "Die Datei konnte nicht gespeichert werden als: %s"
#: main.rsthefolderdoesnotexist
#, object-pascal-format, fuzzy
#| msgid ""
#| "The folder [%s] does not exist or is currently not available.\n"
#| "\n"
#| "Should it be removed from the list?"
#, object-pascal-format
msgid ""
"Folder \"%s\" does not exist or is currently not available.\n"
"The folder [%s] does not exist or is currently not available.\n"
"\n"
"Should it be removed from the list?"
msgstr ""
@ -71,9 +101,7 @@ msgstr ""
"Soll er von der Liste gestrichen werden?"
#: main.rsthetempfilecouldnotbedeleted
#, fuzzy
#| msgid "The temp file could not be deleted."
msgid "Temporary file could not be deleted."
msgid "The temp file could not be deleted."
msgstr "Die Temporär-Datei konnte nicht gelöscht werden."
#: main.rsthisfoldercontains
@ -90,8 +118,6 @@ msgid "Create HTML"
msgstr "HTML erzeugen"
#: tmainform.bbtncreatehtml.hint
#, fuzzy
#| msgid "Create a html page for the images found in the selected directory"
msgid "Create HTML page for images found in the selected directory"
msgstr "Erzeugt den HTML-Code für die im ausgewählten Ordner gefundenen Icons"
@ -104,8 +130,6 @@ msgid "Save"
msgstr "Speichern"
#: tmainform.bbtnsave.hint
#, fuzzy
#| msgid "Save the generated html text as file \"IconTable.html\" in the specified folder"
msgid "Save created HTML page as \"IconTable.html\" file in the specified folder"
msgstr "Speichert den generierten HTML-Code in der Datei \"IconTable.html\" im angegebenen Ordner"
@ -118,18 +142,25 @@ msgid "Dark Mode"
msgstr "Dunkler Modus"
#: tmainform.cbdarkmode.hint
#, fuzzy
#| msgid "Creates an html page with dark background"
msgid "Create HTML page with dark background"
msgstr "Erzeugt eine HTML-Seite mit dunklem Hintergrund"
#: tmainform.cbtranslatedhtml.caption
msgid "Translated HTML text"
msgstr "Übersetzter HTML-Text"
#: tmainform.cbtranslatedhtml.hint
msgid ""
"Unchecked: Use the GUI language in the HTML text\n"
"Checked: Write the HTML text in English"
msgstr ""
"Nicht markiert: HTML-Text in der Sprache der Benutzeroberfläche speicher\n"
"Markiert: HTML-Text auf Englisch erzeugen"
#: tmainform.directoryedit.hint
#, fuzzy
#| msgid "Folder with images for which the html preview should be created"
msgid "Folder with images for which the HTML preview should be created"
msgstr "Ordner mit den Bildern, für die der HTML-Code erzeugt werden soll"
#: tmainform.sbtnlastdirs.hint
msgid "Last used"
msgstr "Zuletzt benutzt"

View File

@ -5,22 +5,46 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Error"
msgstr ""
#: main.rsfreelyavailable
msgid "freely available, no restrictions in usage"
msgstr ""
#: main.rsimageswereprovidedby
#, object-pascal-format
msgid "The images were kindly provided by Roland Hahn (%s)."
msgstr ""
#: main.rsinformation
msgid "Information"
msgstr ""
#: main.rsinfotext1
msgid "The images in this folder can be used in Lazarus applications as toolbar or button icons."
msgstr ""
#: main.rsinfotext2
msgid "The different sizes as required by LCL scaling for high-dpi screens can be used like this, for example:"
msgstr ""
#: main.rslicense
#, object-pascal-format
msgid ""
"License:\n"
"%s"
msgstr ""
#: main.rsname
msgid "Name"
msgstr ""
#: main.rsnomatchingpngimagefilesfoundin
#, object-pascal-format
msgid "No matching PNG image files found in %s"
msgid "No matching png image files found in %s"
msgstr ""
#: main.rsnopngimagefilesfoundin
#, object-pascal-format
msgid "No PNG image files found in %s"
msgid "No png image files found in %s"
msgstr ""
#: main.rssavedas
@ -32,8 +56,20 @@ msgstr ""
msgid "Size"
msgstr ""
#: main.rssizeinfolarge
msgid "32x32, 48x48 and 64x64 pixels for \"large\" images."
msgstr ""
#: main.rssizeinfomedium
msgid "24x24, 36x36 and 48x48 pixels for \"medium\" sized images,"
msgstr ""
#: main.rssizeinfosmall
msgid "16x16, 24x24 and 32x32 pixels for \"small\" images,"
msgstr ""
#: main.rstheconfigurationcouldnotbesaved
msgid "Configuration file could not be saved."
msgid "The configuration file could not be saved."
msgstr ""
#: main.rsthefilecouldnotbesavedas
@ -44,13 +80,13 @@ msgstr ""
#: main.rsthefolderdoesnotexist
#, object-pascal-format
msgid ""
"Folder \"%s\" does not exist or is currently not available.\n"
"The folder [%s] does not exist or is currently not available.\n"
"\n"
"Should it be removed from the list?"
msgstr ""
#: main.rsthetempfilecouldnotbedeleted
msgid "Temporary file could not be deleted."
msgid "The temp file could not be deleted."
msgstr ""
#: main.rsthisfoldercontains
@ -94,6 +130,16 @@ msgstr ""
msgid "Create HTML page with dark background"
msgstr ""
#: tmainform.cbtranslatedhtml.caption
msgid "Translated HTML text"
msgstr ""
#: tmainform.cbtranslatedhtml.hint
msgid ""
"Unchecked: Use the GUI language in the HTML text\n"
"Checked: Write the HTML text in English"
msgstr ""
#: tmainform.directoryedit.hint
msgid "Folder with images for which the HTML preview should be created"
msgstr ""

View File

@ -15,22 +15,48 @@ msgstr ""
msgid "Error"
msgstr "Ошибка"
#: main.rsfreelyavailable
msgid "freely available, no restrictions in usage"
msgstr ""
#: main.rsimageswereprovidedby
#, object-pascal-format
msgid "The images were kindly provided by Roland Hahn (%s)."
msgstr ""
#: main.rsinformation
msgid "Information"
msgstr "Сведения"
#: main.rsinfotext1
msgid "The images in this folder can be used in Lazarus applications as toolbar or button icons."
msgstr ""
#: main.rsinfotext2
msgid "The different sizes as required by LCL scaling for high-dpi screens can be used like this, for example:"
msgstr ""
#: main.rslicense
#, object-pascal-format
msgid ""
"License:\n"
"%s"
msgstr ""
#: main.rsname
msgid "Name"
msgstr "Имя"
#: main.rsnomatchingpngimagefilesfoundin
#, object-pascal-format
msgid "No matching PNG image files found in %s"
#, object-pascal-format, fuzzy
#| msgid "No matching PNG image files found in %s"
msgid "No matching png image files found in %s"
msgstr "Не найдено соответствующих файлов изображений PNG в %s"
#: main.rsnopngimagefilesfoundin
#, object-pascal-format
msgid "No PNG image files found in %s"
#, object-pascal-format, fuzzy
#| msgid "No PNG image files found in %s"
msgid "No png image files found in %s"
msgstr "Не найдено файлов изображений PNG в %s"
#: main.rssavedas
@ -42,8 +68,22 @@ msgstr "Сохранено в %s"
msgid "Size"
msgstr "Размер"
#: main.rssizeinfolarge
msgid "32x32, 48x48 and 64x64 pixels for \"large\" images."
msgstr ""
#: main.rssizeinfomedium
msgid "24x24, 36x36 and 48x48 pixels for \"medium\" sized images,"
msgstr ""
#: main.rssizeinfosmall
msgid "16x16, 24x24 and 32x32 pixels for \"small\" images,"
msgstr ""
#: main.rstheconfigurationcouldnotbesaved
msgid "Configuration file could not be saved."
#, fuzzy
#| msgid "Configuration file could not be saved."
msgid "The configuration file could not be saved."
msgstr "Невозможно сохранить файл настройки."
#: main.rsthefilecouldnotbesavedas
@ -52,9 +92,13 @@ msgid "The file could not be saved as: %s"
msgstr "Невозможно сохранить файл %s"
#: main.rsthefolderdoesnotexist
#, object-pascal-format
#, object-pascal-format, fuzzy
#| msgid ""
#| "Folder \"%s\" does not exist or is currently not available.\n"
#| "\n"
#| "Should it be removed from the list?"
msgid ""
"Folder \"%s\" does not exist or is currently not available.\n"
"The folder [%s] does not exist or is currently not available.\n"
"\n"
"Should it be removed from the list?"
msgstr ""
@ -63,7 +107,9 @@ msgstr ""
"Удалить его из списка?"
#: main.rsthetempfilecouldnotbedeleted
msgid "Temporary file could not be deleted."
#, fuzzy
#| msgid "Temporary file could not be deleted."
msgid "The temp file could not be deleted."
msgstr "Невозможно удалить временный файл."
#: main.rsthisfoldercontains
@ -107,6 +153,16 @@ msgstr "Тёмный режим"
msgid "Create HTML page with dark background"
msgstr "Создать страницу HTML с тёмным фоном"
#: tmainform.cbtranslatedhtml.caption
msgid "Translated HTML text"
msgstr ""
#: tmainform.cbtranslatedhtml.hint
msgid ""
"Unchecked: Use the GUI language in the HTML text\n"
"Checked: Write the HTML text in English"
msgstr ""
#: tmainform.directoryedit.hint
msgid "Folder with images for which the HTML preview should be created"
msgstr "Каталог с изображениями для создания страницы предпросмотра HTML"

View File

@ -660,6 +660,21 @@ object MainForm: TMainForm
TabOrder = 4
OnClick = bbtnPreviewClick
end
object cbTranslatedHTML: TCheckBox
AnchorSideLeft.Control = cbDarkMode
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbDarkMode
Left = 115
Height = 19
Hint = 'Unchecked: Use the GUI language in the HTML text'#13#10'Checked: Write the HTML text in English'
Top = 483
Width = 130
BorderSpacing.Left = 24
Caption = 'Translated HTML text'
Checked = True
State = cbChecked
TabOrder = 7
end
object TaskDialog: TTaskDialog
Buttons = <>
RadioButtons = <>

View File

@ -9,5 +9,7 @@
{"hash":366789,"name":"tmainform.bbtnsave.caption","sourcebytes":[83,97,118,101],"value":"Save"},
{"hash":119190121,"name":"tmainform.bbtncreatehtml.hint","sourcebytes":[67,114,101,97,116,101,32,72,84,77,76,32,112,97,103,101,32,102,111,114,32,105,109,97,103,101,115,32,102,111,117,110,100,32,105,110,32,116,104,101,32,115,101,108,101,99,116,101,100,32,100,105,114,101,99,116,111,114,121],"value":"Create HTML page for images found in the selected directory"},
{"hash":171857052,"name":"tmainform.bbtncreatehtml.caption","sourcebytes":[67,114,101,97,116,101,32,72,84,77,76],"value":"Create HTML"},
{"hash":126668695,"name":"tmainform.bbtnpreview.caption","sourcebytes":[80,114,101,118,105,101,119],"value":"Preview"}
{"hash":126668695,"name":"tmainform.bbtnpreview.caption","sourcebytes":[80,114,101,118,105,101,119],"value":"Preview"},
{"hash":91817512,"name":"tmainform.cbtranslatedhtml.hint","sourcebytes":[85,110,99,104,101,99,107,101,100,58,32,85,115,101,32,116,104,101,32,71,85,73,32,108,97,110,103,117,97,103,101,32,105,110,32,116,104,101,32,72,84,77,76,32,116,101,120,116,13,10,67,104,101,99,107,101,100,58,32,87,114,105,116,101,32,116,104,101,32,72,84,77,76,32,116,101,120,116,32,105,110,32,69,110,103,108,105,115,104],"value":"Unchecked: Use the GUI language in the HTML text\r\nChecked: Write the HTML text in English"},
{"hash":64243252,"name":"tmainform.cbtranslatedhtml.caption","sourcebytes":[84,114,97,110,115,108,97,116,101,100,32,72,84,77,76,32,116,101,120,116],"value":"Translated HTML text"}
]}

View File

@ -5,7 +5,7 @@ unit main;
interface
uses
Classes, SysUtils, Forms, FPImage, Controls, Dialogs, StdCtrls, EditBtn, FileUtil,
Classes, SysUtils, StrUtils, Forms, FPImage, Controls, Dialogs, StdCtrls, EditBtn, FileUtil,
LazUTF8, LazFileUtils, LCLIntf, LCLType, Buttons, Menus, IniFiles,
SynEdit, SynHighlighterHTML, DefaultTranslator;
@ -19,6 +19,7 @@ type
bbtnSave: TBitBtn;
bbtnPreview: TBitBtn;
cbDarkMode: TCheckBox;
cbTranslatedHTML: TCheckBox;
DirectoryEdit: TDirectoryEdit;
ImageList: TImageList;
popLastDirs: TPopupMenu;
@ -58,20 +59,6 @@ implementation
{$R *.lfm}
resourcestring
rsInformation = 'Information';
rsError = 'Error';
rsTheConfigurationCouldNotBeSaved = 'Configuration file could not be saved.';
rsTheTempFileCouldNotBeDeleted = 'Temporary file could not be deleted.';
rsTheFileCouldNotBeSavedAs = 'The file could not be saved as: %s';
rsSavedAs = 'Saved as: %s';
rsNoPngImageFilesFoundIn = 'No PNG image files found in %s';
rsNoMatchingPngImageFilesFoundIn = 'No matching PNG image files found in %s';
rsTheFolderDoesNotExist = 'Folder "%s" does not exist or is currently not available.'+LineEnding+LineEnding+'Should it be removed from the list?';
rsThisFolderContains = 'This folder contains %0:d icons in %1:d icon groups with %2:d icon sizes.';
rsSize = 'Size';
rsName = 'Name';
const
ConfigFileName = 'IconTableConfig.ini';
IconTableFileName = 'IconTable.html';
@ -79,6 +66,33 @@ const
TempFileName = 'IconTableTemp.html';
DefaultDirectory = '../../images/general_purpose/';
LastDirsMax = 9;
URL_RolandHahn = 'https://www.rhsoft.de/';
URL_CC0 = 'https://creativecommons.org/publicdomain/zero/1.0/';
License_CC0 = 'Creative Commons CC0 1.0 Universal';
ThisFolderContains = 'This folder contains %0:d icons in %1:d icon groups with %2:d icon sizes.';
resourcestring
rsInformation = 'Information';
rsError = 'Error';
rsTheConfigurationCouldNotBeSaved = 'The configuration file could not be saved.';
rsTheTempFileCouldNotBeDeleted = 'The temp file could not be deleted.';
rsTheFileCouldNotBeSavedAs = 'The file could not be saved as: %s';
rsSavedAs = 'Saved as: %s';
rsNoPngImageFilesFoundIn = 'No png image files found in %s';
rsNoMatchingPngImageFilesFoundIn = 'No matching png image files found in %s';
rsTheFolderDoesNotExist = 'The folder [%s] does not exist or is currently not available.'#13#13'Should it be removed from the list?';
rsThisFolderContains = ThisFolderContains;
rsSize = 'Size';
rsName = 'Name';
rsInfoText1 = 'The images in this folder can be used in Lazarus applications as toolbar or button icons.';
rsInfoText2 = 'The different sizes as required by LCL scaling for high-dpi screens can be used like this, for example:';
rsSizeInfoSmall = '16x16, 24x24 and 32x32 pixels for "small" images,';
rsSizeInfoMedium = '24x24, 36x36 and 48x48 pixels for "medium" sized images,';
rsSizeInfoLarge = '32x32, 48x48 and 64x64 pixels for "large" images.';
rsImagesWereProvidedBy = 'The images were kindly provided by Roland Hahn (%s).';
rsLicense = 'License:'#13'%s';
rsFreelyAvailable = 'freely available, no restrictions in usage';
{ TMainForm }
@ -124,6 +138,7 @@ begin
end;
cbDarkMode.Checked := Config.ReadBool('Options', 'DarkMode', False);
cbTranslatedHTML.Checked := Config.ReadBool('Options', 'TranslatedHTML', true);
finally
Config.Free;
end;
@ -178,6 +193,7 @@ begin
Config.WriteString('LastDirs', 'LastDir' + i.ToString, popLastDirs.Items[i].Caption);
Config.WriteBool('Options', 'DarkMode', cbDarkMode.Checked);
Config.WriteBool('Options', 'TranslatedHTML', cbTranslatedHTML.Checked);
except
ShowMsg(rsError, rsTheConfigurationCouldNotBeSaved);
end;
@ -245,6 +261,12 @@ begin
end;
procedure TMainForm.CreateHTML(HTMLLines: TStrings; Preview: Boolean);
function Link(URL, AText: String): string;
begin
Result := Format('<a href="%s">%s</a>', [URL, AText]);
end;
var
AllFileList: TStringList;
IcoFileList: TStringList;
@ -256,6 +278,8 @@ var
IcoFile: String;
IcoSize: String;
IcoName: String;
translated: Boolean;
ThisFolderContainsStr: String;
IcoWidth: Integer = 0;
IcoHeight: Integer = 0;
DPos: Integer;
@ -270,13 +294,14 @@ var
BodyColors: String = 'color: #000000; background-color: #ffffff;}';
HoverColors: String = 'color: #ffffff; background-color: #303030;}';
begin
Screen.BeginWaitCursor;
AllFileList := TStringList.Create;
IcoFileList := TStringList.Create;
IcoNameList := TStringList.Create;
IcoSizeList := TStringList.Create;
PixSizeList := TStringList.Create;
try
Screen.BeginWaitCursor;
AllFileList := TStringList.Create;
IcoFileList := TStringList.Create;
IcoNameList := TStringList.Create;
IcoSizeList := TStringList.Create;
PixSizeList := TStringList.Create;
translated := cbTranslatedHTML.Checked;
FindAllFiles(AllFileList, ImgDirectory, '*.png', False);
@ -356,10 +381,10 @@ begin
HTMLLines.Add('<table>');
HTMLLines.Add(' <tr class="no_border">');
HTMLLines.Add(' <td class="colorset1 right_border"></td>');
HTMLLines.Add(' <td class="colorset2 text_center" colspan="' + PixSizeList.Count.ToString + '">' + rsSize + '</td>');
HTMLLines.Add(' <td class="colorset2 text_center" colspan="' + PixSizeList.Count.ToString + '">' + IfThen(translated, rsSize, 'Size') + '</td>');
HTMLLines.Add(' </tr>');
HTMLLines.Add(' <tr>');
HTMLLines.Add(' <td class="colorset1 right_border">' + rsName + '</td>');
HTMLLines.Add(' <td class="colorset1 right_border">' + IfThen(translated, rsName, 'Name') + '</td>');
for i := 0 to PixSizeList.Count - 1 do
HTMLLines.Add(' <td class="colorset2 text_center">' + PixSizeList[i] + '</td>');
HTMLLines.Add(' </tr>');
@ -390,7 +415,25 @@ begin
HTMLLines.Add('</table>');
HTMLLines.Add('<div class="infobox colorset2">');
HTMLLines.Add(Format(rsThisFolderContains, [IcoFileList.Count, IconGroups, PixSizeList.Count]));
HTMLLines.Add(Format(IfThen(translated, rsThisFolderContains, ThisFolderContains), [
IcoFileList.Count, IconGroups, PixSizeList.Count
]));
if cbTranslatedHTML.Checked then
begin
HTMLLines.Add('<hr>');
HTMLLines.Add('<p>' + rsInfoText1 + '</p>');
HTMLLines.Add('<p>' + rsInfoText2 + '</p>');
HTMLLines.Add('<ul>');
HTMLLines.Add(' <li>' + rsSizeInfoSmall + '</li>');
HTMLLines.Add(' <li>' + rsSizeInfoMedium + '</li>');
HTMLLines.Add(' <li>' + rsSizeInfoLarge + '</li>');
HTMLLines.Add('</ul>');
HTMLLines.Add('<p>' + Format(rsImagesWereProvidedBy, [Link(URL_RolandHahn, URL_RolandHahn)]) + '</p>');
HTMLLines.Add('<p>' + Format(rsLicense, [License_CC0]) + '<br>');
HTMLLines.Add(Link(URL_CC0, URL_CC0) + '<br>');
HTMLLines.Add(rsFreelyAvailable + '</p>');
end else
if FileExists(ImgDirectory + InfoTextFileName) then
begin
try