From f6550dce8be7b2144f88b87209695ea8fdd211b6 Mon Sep 17 00:00:00 2001 From: odan Date: Sun, 25 Aug 2019 22:25:23 +0200 Subject: [PATCH] Add twig to php compiler #2 --- bin/parse-twig.php | 51 +++++++++ resources/locale/de_DE_messages.mo | Bin 470 -> 557 bytes resources/locale/de_DE_messages.po | 178 ++++++++++++++++++++++++++++- templates/empty | 0 4 files changed, 225 insertions(+), 4 deletions(-) create mode 100644 bin/parse-twig.php delete mode 100644 templates/empty diff --git a/bin/parse-twig.php b/bin/parse-twig.php new file mode 100644 index 000000000..f77257b0a --- /dev/null +++ b/bin/parse-twig.php @@ -0,0 +1,51 @@ + Properties > Source Path +// Add source path: tmp/twig-cache +// +// Open tab: Sources keywords +// Add keyword: __ +// Click 'Ok' to store the settings +// +// Click button 'Update form source' to extract the template strings. +// Translate the text and save the file. +// + +use Slim\App; +use Twig\Environment as Twig; + +/** @var App $app */ +$app = require __DIR__ . '/../config/bootstrap.php'; + +$settings = $app->getContainer()->get('settings')['twig']; +$templatePath = (string)$settings['path']; +$cachePath = (string)$settings['cache_path']; + +$twig = $app->getContainer()->get(Twig::class); + +$twig->disableDebug(); + +// Force auto-reload to always have the latest version of the template +$twig->enableAutoReload(); + +// The Twig cache must be enabled +$twig->setCache($cachePath); + +// Iterate over all your templates +$directory = new RecursiveDirectoryIterator($templatePath, FilesystemIterator::SKIP_DOTS); + +foreach (new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST) as $file) { + /** @var SplFileInfo $file */ + if ($file->isFile() && $file->getExtension() === 'twig') { + $templateName = substr($file->getPathname(), strlen($templatePath) + 1); + $templateName = str_replace('\\', '/', $templateName); + echo sprintf("Parsing: %s\n", $templateName); + $twig->loadTemplate($templateName); + } +} diff --git a/resources/locale/de_DE_messages.mo b/resources/locale/de_DE_messages.mo index abe7aca4e0ddebbd3842b2b549c277bc78bb6260..c2a40f888259d44a28ce25bb12e5fab7f25ebf11 100644 GIT binary patch delta 198 zcmcb{yp|>Qo)F7a1|VPpVi_RT0b*7lwgF-g2moRpAPxlL1B?s|aX^|Eh~4gL5(xRf&yb^_y%-qz87Cy{IR)!PXRYBCo^&E_WToJkf`Kc+HCAz_>iABj70f{9U ux&~GX#YM?jr3|eUN^%SIOUg6Tb(0g5Gg7%29J5PGQ*&}s6{1ozOBeu8m@5we delta 92 zcmZ3>a*f&Io)F7a1|VPrVi_P-0b*t#)&XJ=umIvYKuJp=4N?OG6Jvdt4XlhOu2BV1 W8?SIMvgj8VB~QM?D8a19#Q*>eUk!5r diff --git a/resources/locale/de_DE_messages.po b/resources/locale/de_DE_messages.po index 12342fa5f..5e2f0031e 100644 --- a/resources/locale/de_DE_messages.po +++ b/resources/locale/de_DE_messages.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-25 20:36+0200\n" -"PO-Revision-Date: 2019-08-25 20:36+0200\n" +"POT-Creation-Date: 2019-08-25 22:16+0200\n" +"PO-Revision-Date: 2019-08-25 22:16+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: de_DE\n" @@ -13,5 +13,175 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Poedit 2.2.1\n" "X-Poedit-KeywordsList: __\n" -"X-Poedit-Basepath: ../../src\n" -"X-Poedit-SearchPath-0: .\n" +"X-Poedit-Basepath: ../..\n" +"X-Poedit-SearchPath-0: src\n" +"X-Poedit-SearchPath-1: tmp/twig-cache\n" + +#: tmp/twig-cache/b0/b08ae06e89f7c1e908c0731b35e84c0b3e3279a56c5d89492838e25dc98c7353.php:72 +msgid "Current time" +msgstr "Aktuelle Zeit" + +#~ msgid "User list" +#~ msgstr "Benutzerliste" + +#~ msgid "Add user" +#~ msgstr "Benutzer hinzufügen" + +#~ msgid "Username" +#~ msgstr "Benutzername" + +#~ msgid "E-Mail" +#~ msgstr "E-Mail" + +#~ msgid "First name" +#~ msgstr "Vorname" + +#~ msgid "Last name" +#~ msgstr "Nachname" + +#~ msgid "Role" +#~ msgstr "Rolle" + +#~ msgid "Enabled" +#~ msgstr "Aktiviert" + +#~ msgid "Created at" +#~ msgstr "Erstellt am" + +#~ msgid "Action" +#~ msgstr "Aktion" + +#~ msgid "Server error" +#~ msgstr "Server Error" + +#~ msgid "Yes" +#~ msgstr "Ja" + +#~ msgid "No" +#~ msgstr "Nein" + +#~ msgid "Loaded successfully!" +#~ msgstr "Erfolgreich gestartet!" + +#~ msgid "Loading..." +#~ msgstr "Laden..." + +#~ msgid "Hello World" +#~ msgstr "Hallo Welt" + +#~ msgid "Current user" +#~ msgstr "Aktueller Benutzer" + +#~ msgid "User-ID" +#~ msgstr "Benutzer-ID" + +#~ msgid "User ID" +#~ msgstr "Benutzer ID" + +#~ msgid "Message" +#~ msgstr "Meldung" + +#~ msgid "Selected" +#~ msgstr "Markiert" + +#~ msgid "Edit user: %s" +#~ msgstr "Benutzer bearbeiten: %s" + +#~ msgid "Sign in" +#~ msgstr "Einloggen" + +#~ msgid "Please sign in" +#~ msgstr "Bitte einloggen" + +#~ msgid "Password" +#~ msgstr "Kennwort" + +#~ msgid "js/datatable-english.json" +#~ msgstr "js/datatable-german.json" + +#~ msgid "Edit" +#~ msgstr "Bearbeiten" + +#~ msgid "en" +#~ msgstr "de" + +#~ msgid "Demo" +#~ msgstr "Demo" + +#~ msgid "Project name" +#~ msgstr "Projektname" + +#~ msgid "Toggle navigation" +#~ msgstr "Navigation umschalten" + +#~ msgid "Home" +#~ msgstr "Home" + +#~ msgid "Link" +#~ msgstr "Link" + +#~ msgid "Disabled" +#~ msgstr "Deaktiviert" + +#~ msgid "Dropdown" +#~ msgstr "Dropdown" + +#~ msgid "Another action" +#~ msgstr "Weitere Aktion" + +#~ msgid "Something else here" +#~ msgstr "Etwas anderes" + +#~ msgid "Settings" +#~ msgstr "Einstellungen" + +#~ msgid "Logout" +#~ msgstr "Logout" + +#~ msgid "Page {page} / {pages}" +#~ msgstr "Seite {page} / {pages}" + +#~ msgid "{start} - {end} of {count} items" +#~ msgstr "{start} - {end} von {count} Einträgen" + +#~ msgid "Please enter the page number" +#~ msgstr "Geben Sie bitte die Seitennummer ein" + +#~ msgid "required" +#~ msgstr "erforderlich" + +#~ msgid "invalid" +#~ msgstr "ungülig" + +#~ msgid "Search" +#~ msgstr "Suchen" + +#~ msgid "per Page" +#~ msgstr "pro Seite" + +#~ msgid "OK" +#~ msgstr "OK" + +#~ msgid "Cancel" +#~ msgstr "Abbrechen" + +#~ msgid "The filetype is invalid" +#~ msgstr "Der Dateityp ist ungültig" + +#~ msgid "The file size exceeds the limit allowed" +#~ msgstr "Die Dateigrösse überschreitet das erlaubte Maximum." + +#~ msgid "The file could not be opened." +#~ msgstr "Die Datei konnte nicht gelesen werden." + +#~ msgid "Invalid or empty User-ID" +#~ msgstr "Ungültige oder leere User-ID" + +#~ msgid "User not found: %s" +#~ msgstr "Benutzer nicht gefunden: %s" + +#~ msgid "Columns not found in table: %s" +#~ msgstr "Keine Felder gefunden in der Tabelle: %s" + +#~ msgid "Invalid type ID: %s" +#~ msgstr "Ungültige Type-ID: %s" diff --git a/templates/empty b/templates/empty deleted file mode 100644 index e69de29bb..000000000