{"id":988655,"date":"2015-07-21T14:38:32","date_gmt":"2015-07-21T21:38:32","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/"},"modified":"2015-07-22T09:06:46","modified_gmt":"2015-07-22T16:06:46","slug":"dos-and-donts-in-programming-for-successful-internationalization","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/","title":{"rendered":"DOs and DON&#039;Ts in programming for successful internationalization"},"content":{"rendered":"<p>While looking at a half-translated version of The Events Calendar, I found that some of the messages to be translated were made up of several strings. For instance, to display &#8220;Previous Events&#8221;, there was a one string containing &#8220;Events&#8221; and another one containing &#8220;Previous %s&#8221;. Similarly, for &#8220;New Event&#8221;, there was a string for &#8220;Event&#8221; and another one for &#8220;New %s&#8221;.<\/p>\n<p>While this may be smart from a programming point of view for reasons I&#8217;m definitely not in a position to judge, it&#8217;s typically what you <strong>shouldn&#8217;t<\/strong> do when you want your project to be translated. Fact is that in English, you use the same form of the adjective (e.g. Previous or New) regardless of the noun after it. But in French, to give just one example, the adjective for &#8220;new&#8221; can have up to 5 forms:<\/p>\n<ul>\n<li><strong>nouveau<\/strong> if followed with a singular, masculine noun which starts with a consonant (nouveau calendrier)\n<li>\n<li><strong>nouvel<\/strong> if followed with a singular, masculine noun which starts with a vowel (nouvel \u00e9v\u00e9nement)<\/li>\n<li><strong>nouvelle<\/strong> if followed with a singular, feminine noun (nouvelle cat\u00e9gorie)<\/li>\n<li><strong>nouveaux<\/strong> if followed with a plural, masculine noun (nouveaux \u00e9v\u00e9nements, nouveaux calendriers)<\/li>\n<li><strong>nouvelles<\/strong> if followed with a plural, feminine noun (nouvelles cat\u00e9gories)<\/li>\n<\/ul>\n<p>As a result, there is no way we can correctly translate &#8220;New %s&#8221; for all possible values of %s. Again, this is just one example; some languages are even more complex. The French language does not use case, unlike Russian or Icelandic, for instance.<\/p>\n<p>Anyway, if you want your strings to be translatable:<\/p>\n<ol>\n<li>Avoid inserting words as variables in a sentence fragment.<br \/>\nYou may, however, insert a variable part if it&#8217;s separated from the rest of the sentence (e.g. after a colon).<\/li>\n<li>If you really, really <strong>have<\/strong> to use a variable in your string, document it in your code so that translators know what will be inserted here and can figure out what it all means. Will a number be inserted? A date? A user-created description? A status or condition?<\/li>\n<li>If you think documenting your code is not worth the effort, wait until you have 30 community translators for 30 different languages asking you what&#8217;s in the variable &#8211; or until you have 300 customers complaining about wrong translations.<\/li>\n<\/ol>\n<p>These are just a few ideas; is there anything else you community translators found difficult\/impossible to translate because of the way it was programmed?<\/p>\n","protected":false},"template":"","class_list":["post-988655","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DOs and DON&#039;Ts in programming for successful internationalization -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DOs and DON&#039;Ts in programming for successful internationalization -\" \/>\n<meta property=\"og:description\" content=\"While looking at a half-translated version of The Events Calendar, I found that some of the messages to be translated were made up of several strings. For instance, to display &#8220;Previous Events&#8221;, there was a one string containing &#8220;Events&#8221; and another one containing &#8220;Previous %s&#8221;. Similarly, for &#8220;New Event&#8221;, there was a string for &#8220;Event&#8221; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-07-22T16:06:46+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/\",\"name\":\"DOs and DON&#039;Ts in programming for successful internationalization -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-07-21T21:38:32+00:00\",\"dateModified\":\"2015-07-22T16:06:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Additional Help\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Translations\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/translation\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"DOs and DON&#039;Ts in programming for successful internationalization\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DOs and DON&#039;Ts in programming for successful internationalization -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/","og_locale":"en_US","og_type":"article","og_title":"DOs and DON&#039;Ts in programming for successful internationalization -","og_description":"While looking at a half-translated version of The Events Calendar, I found that some of the messages to be translated were made up of several strings. For instance, to display &#8220;Previous Events&#8221;, there was a one string containing &#8220;Events&#8221; and another one containing &#8220;Previous %s&#8221;. Similarly, for &#8220;New Event&#8221;, there was a string for &#8220;Event&#8221; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/","article_modified_time":"2015-07-22T16:06:46+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/","name":"DOs and DON&#039;Ts in programming for successful internationalization -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-07-21T21:38:32+00:00","dateModified":"2015-07-22T16:06:46+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/dos-and-donts-in-programming-for-successful-internationalization\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Additional Help","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/"},{"@type":"ListItem","position":4,"name":"Translations","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/translation\/"},{"@type":"ListItem","position":5,"name":"DOs and DON&#039;Ts in programming for successful internationalization"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/988655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/988655\/revisions"}],"predecessor-version":[{"id":988695,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/988655\/revisions\/988695"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=988655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}