From cbcae4037c02cd6c1ce7c373c6dae390565b7c51 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Wed, 26 Feb 2014 15:43:49 +0200 Subject: translation related: how-to md file added, script to generate php from all twig templates, polish mo file compiled --- locale/pl_PL.utf8/LC_MESSAGES/pl_PL.utf8.mo | Bin 11248 -> 11935 bytes locale/tools/fillCache.php | 59 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 locale/tools/fillCache.php (limited to 'locale') diff --git a/locale/pl_PL.utf8/LC_MESSAGES/pl_PL.utf8.mo b/locale/pl_PL.utf8/LC_MESSAGES/pl_PL.utf8.mo index 22985970..b363385a 100755 Binary files a/locale/pl_PL.utf8/LC_MESSAGES/pl_PL.utf8.mo and b/locale/pl_PL.utf8/LC_MESSAGES/pl_PL.utf8.mo differ diff --git a/locale/tools/fillCache.php b/locale/tools/fillCache.php new file mode 100755 index 00000000..bdd9cc58 --- /dev/null +++ b/locale/tools/fillCache.php @@ -0,0 +1,59 @@ +isDir() and $tplDir!='.' and $tplDir!='..') { + echo "\n$tplDir\n"; + + $loader = new Twig_Loader_Filesystem($tplDirRoot.$tplDir); + + // force auto-reload to always have the latest version of the template + $twig = new Twig_Environment($loader, array( + 'cache' => $tmpDir, + 'auto_reload' => true + )); + + $twig->addExtension(new Twig_Extensions_Extension_I18n()); + + $filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain'); + $twig->addFilter($filter); + + $filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime'); + $twig->addFilter($filter); + + $filter = new Twig_SimpleFilter('getPrettyFilename', function($string) { return str_replace($siteRoot, '', $string); }); + $twig->addFilter($filter); + +// // iterate over all your templates + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDirRoot.$tplDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + // force compilation + if ($file->isFile() and pathinfo($file, PATHINFO_EXTENSION)=='twig') { + echo "\t$file\n"; + $twig->loadTemplate(str_replace($tplDirRoot.$tplDir.'/', '', $file)); + } + } + + } + + } + -- cgit v1.2.3