{"id":89,"date":"2010-06-09T23:25:07","date_gmt":"2010-06-09T22:25:07","guid":{"rendered":"http:\/\/bemused.org\/blog\/?p=89"},"modified":"2010-06-09T23:29:47","modified_gmt":"2010-06-09T22:29:47","slug":"symfony-extracting-strings-from-1-2-forms-using-i18nextract","status":"publish","type":"post","link":"https:\/\/bemused.org\/blog\/2010\/06\/09\/symfony-extracting-strings-from-1-2-forms-using-i18nextract\/","title":{"rendered":"Symfony: extracting strings from 1.2 forms using i18n:extract"},"content":{"rendered":"<p>Anyone using Sympfony 1.2 will probably have realised by now that the i18n:extract task doesn&#8217;t extract strings from any files in lib\/form\/*<\/p>\n<p><a href=\"http:\/\/groups.google.com\/group\/symfony-devs\/browse_thread\/thread\/9780f8111273423b\">This useful thread<\/a> shows how to dump all translated strings into a file which can later be parsed by the i18n:extract task, unfortunately it creates huge files, and needs to be disabled in production environments for performance reasons.<\/p>\n<p>After a quick search through the code, I\u00a0 have patched my code to only dump untranslated strings to the i18n.temp file.<\/p>\n<p>Here&#8217;s the patch for lib\/vendor\/symfony\/lib\/i18n\/sfMessageFormat.class.php<\/p>\n<pre>\/\/ found, but untranslated\r\n if (empty($target))\r\n {\r\n+\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 file_put_contents(sfConfig::get('sf_app_template_dir').'\/i18n.temp.php',\"&lt;?php __('$string'); ?&gt;\\n\",FILE_APPEND);\r\n return $this-&gt;postscript[0].$this-&gt;replaceArgs($string, $args).$this-&gt;postscript[1];\r\n }\r\n return $this-&gt;replaceArgs($target, $args);<\/pre>\n<p>(I would have posted this in reply to the original comment, but I couldn&#8217;t find the original post for some reason)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Anyone using Sympfony 1.2 will probably have realised by now that the i18n:extract task doesn&#8217;t extract strings from any files in lib\/form\/* This useful thread shows how to dump all translated strings into a file which can later be parsed by the i18n:extract task, unfortunately it creates huge files, and needs to be disabled in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-geeky-stuff"],"_links":{"self":[{"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":5,"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/posts\/89\/revisions"}],"predecessor-version":[{"id":91,"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/posts\/89\/revisions\/91"}],"wp:attachment":[{"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/media?parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/categories?post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bemused.org\/blog\/wp-json\/wp\/v2\/tags?post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}