{"id":24,"date":"2008-06-05T16:42:23","date_gmt":"2008-06-05T13:42:23","guid":{"rendered":"http:\/\/nike.fixme.fi\/blag\/?p=24"},"modified":"2011-12-29T18:08:35","modified_gmt":"2011-12-29T15:08:35","slug":"gettext-support-is-coming","status":"publish","type":"post","link":"https:\/\/laxstrom.name\/blag\/2008\/06\/05\/gettext-support-is-coming\/","title":{"rendered":"Gettext support is coming"},"content":{"rendered":"<p>I have managed to translate one string with the extension and export a file including existing translations, and have it work. This means that I&#8217;ve implemented a parser and exporter for po files.<\/p>\n<p>Most of the time went into refactoring the old code to support other file formats easily. Exporting is as easy as possible:<\/p>\n<pre>$lang = array( 'fi', 'de' );\r\n$target = '\/tmp';\r\n$group = MessageGroups::getGroup( 'out-freecol' );\r\n$writer = $group-&gt;getWriter();\r\n$writer-&gt;fileExport( $langs, $target );\r\n<\/pre>\n<p>The above code exports FreeCol translations to the tmp directory. Those file can then be committed to the vcs. Each project (group) has a preferred output format. It is also possible to export to other supported file formats by creating a writer manually.<\/p>\n<p>As gettext messages don&#8217;t have ids, I had to create those. Currently it is just hash + snippet, which produces page titles like <code>MediaWiki:33e5da6ddaa6edf2f1cdf8c235813747e40fc326-Disable Ethernet Wake-On-Lan w\/fi<\/code>. It is not pretty, but good enough for now.<\/p>\n<p>Anyway, the support is &#8220;coming&#8221;, not ready. Still to do are for example gettext plural support, better formatting of authors, importing external changes and so on.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have managed to translate one string with the extension and export a file including existing translations, and have it work. This means that I&#8217;ve implemented a parser and exporter for po files. Most of the time went into refactoring the old code to support other file formats easily. Exporting is as easy as possible: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6,9],"tags":[],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-english","category-kesakoodi","category-translatewiki-net"],"_links":{"self":[{"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":1,"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":224,"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/posts\/24\/revisions\/224"}],"wp:attachment":[{"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laxstrom.name\/blag\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}