{"id":114,"date":"2008-08-20T22:36:02","date_gmt":"2008-08-21T03:36:02","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/08\/20\/hardwired-strings\/"},"modified":"2008-08-20T22:36:04","modified_gmt":"2008-08-21T03:36:04","slug":"hardwired-strings","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/08\/20\/hardwired-strings\/","title":{"rendered":"Hardwired Strings"},"content":{"rendered":"<p>With every programming language\/development environment I know of, you have to do <em>extra work<\/em> to make a string localizable.  For example, <br \/>\n<code>errorMessage = <strong>NSLocalizedString(<\/strong>@\"This is hard!\"<strong>,@\"\");<\/strong><\/code><br \/>\nnot simply,<br \/>\n<code>errorMessage = @\"This is hard!\";<\/code><\/p>\n<p>And it&#8217;s not just extra work, it&#8217;s a <em>ridiculous amount of work.<\/em>  E.g. to create an Objective-C string, you just put an <code>@<\/code> in front of a standard C string.  But to create a localized string, you have to surround your string in <code>()<\/code>&#8216;s, and prefix it with a seventeen character mixed-case function-name, and finally add an empty &#8220;note&#8221; for the translator.  (Rarely, you may <em>want<\/em> to add a note for the translator, and it&#8217;s good that you can, but you should not be <em>forced<\/em> to write something when it is not necessary.)<\/p>\n<p>There isn&#8217;t really an excuse for this; it&#8217;s just how languages have lazily evolved.<\/p>\n<p>Non-localizable (&#8220;hardcoded&#8221;) strings are a <em>huge<\/em> issue, even though they are trivially simple for <em>programmers<\/em> to fix.  The problem is that translators do not work with source code, they work with resource files.  So when they find a &#8220;hardwired&#8221; string that must be changed in code, they <em>tell a programmer to fix it<\/em>. And that communication is slow and costly.  Especially when you consider that good localizers are probably native to the place they are localizing for &#8212; meaning that having a real-time conversation involves at least one party staying up past 3AM.<\/p>\n<p>I dream of a day where <code>\"this would be localized by default\"<\/code>; <code>\"and\"(\"syntactic sugar for adding optional translator notes would be there too\")<\/code>; and creating <code>C\"literal C-strings\"<\/code> would be easy.<\/p>\n<p>&#8220;Unicode support libraries&#8221; are doomed to institutionalized-failure, because they will never make it <em>easier<\/em> to do the right thing.  It must be so easy to create a localizable program that you wouldn&#8217;t dream of doing anything else.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With every programming language\/development environment I know of, you have to do extra work to make a string localizable. For example, errorMessage = NSLocalizedString(@&#8221;This is hard!&#8221;,@&#8221;&#8221;); not simply, errorMessage = @&#8221;This is hard!&#8221;; And it&#8217;s not just extra work, it&#8217;s a ridiculous amount of work. E.g. to create an Objective-C string, you just put an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,12,5,4,8],"tags":[144,142,141,140,139,143],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-accessibility","category-design","category-objective-c","category-programming","category-usability","tag-documentation","tag-i18n","tag-internationalization","tag-l10n","tag-localization","tag-translation"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}