{"id":118,"date":"2009-11-17T02:19:58","date_gmt":"2009-11-17T07:19:58","guid":{"rendered":"http:\/\/littlesvr.ca\/grumble\/?p=118"},"modified":"2012-12-05T00:55:11","modified_gmt":"2012-12-05T05:55:11","slug":"oh-my-god-dont-use-plural-forms","status":"publish","type":"post","link":"http:\/\/littlesvr.ca\/grumble\/2009\/11\/17\/oh-my-god-dont-use-plural-forms\/","title":{"rendered":"Oh my god, don&#8217;t use plural forms"},"content":{"rendered":"<p>There is a magic thing called gettext. It&#8217;s magic because it allows some random Joe on the internet with no experience in programming to translate your application into his language. He does this by editing a .po file, then sends it to you, and you just include that file in your build system.<\/p>\n<p>Ok there is some plumbing you need to enable that, but really it&#8217;s worth it.<\/p>\n<p>In one of my applications I followed the advice in the gettext manual and used plural forms for messages. That is rather than saying &#8220;%d file(s)&#8221; the string had two forms: &#8220;%d file&#8221; (if %d is 1) and &#8220;%d files&#8221; (if %d is not one). This is specified in the po file like so:<\/p>\n<blockquote><p>&#8220;Plural-Forms: nplurals=2; plural= n!=1;\\n&#8221;<\/p>\n<p>msgid &#8220;%d file&#8221;<br \/>\nmsgid_plural &#8220;%d files&#8221;<br \/>\nmsgstr[0] &#8220;&#8221;<br \/>\nmsgstr[1] &#8220;&#8221;<\/p><\/blockquote>\n<p>But of course different languages have different singular\/plural rules. For example in Russian 0, 1, 2, and 5 have different plural forms. That means the russian translator has to figure out how this whole system works in order to translate strings with plural forms.<\/p>\n<p>These translators are volunteers. That they do it at all is amazing. Having them read the gettext manual (which doesn&#8217;t have a lot of examples like it should) is disrespectful and unproductive. You will get fewer translations of not-as-good quality if you use plural forms.<\/p>\n<p>I know, I learned this the hard way. One of my programs uses plural forms and another doesn&#8217;t. I have spent way too much time explaining to people how this works, and I am sure some of them ignored what I said and just gave me whatever compiles.<\/p>\n<p>And believe me figuring this out isn&#8217;t easy. I mentioned the russian example &#8211; honestly I have no idea what the rules are exactly (who ever thinks of these things?) and I speak russian, and I maintain the application. How can I ask Joe random to understand this?<\/p>\n<p>There you go. Use plural forms at your own peril. The gettext manual lies, plural forms are not a good thing and the problems they cause are bigger than the one problem they solve. I have just got a new translation, and guess what &#8211; the two strings with plural forms are untranslated. So I have to get a headache explaining this yet again, while kicking myself in the head for buying into the gettext dogma.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is a magic thing called gettext. It&#8217;s magic because it allows some random Joe on the internet with no experience in programming to translate your application into his language. He does this by editing a .po file, then sends it to you, and you just include that file in your build system. Ok there &hellip; <\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-andrew","4":"post-118","6":"format-standard","7":"category-opensource","8":"category-safeforseneca"},"_links":{"self":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":6,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":121,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/posts\/118\/revisions\/121"}],"wp:attachment":[{"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/littlesvr.ca\/grumble\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}