<p></p>
<p dir="auto">In a <a href="https://github.com/openstreetmap/openstreetmap-website/commit/c7e9888bb6587649109d0c8d9e00c771da867cf9#commitcomment-101769123">commit comment</a>, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Nikerabbit/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Nikerabbit">@Nikerabbit</a> writes:</p>
<blockquote>
<p dir="auto">These changes are really difficult for translators because they are create patchwork messages. Especially without accompanying message documentation.</p>
<p dir="auto">More docs:</p>
<pre class="notranslate"><code class="notranslate">https://translatewiki.net/wiki/Translating:Localisation_for_developers#Message_documentation
https://www.mediawiki.org/wiki/Help:System_message#Avoid_fragmented_or_'patchwork'_messages
</code></pre>
<p dir="auto">To be fair, we have the same issue in MediaWiki. Often it can be addressed by using wikitext, but some cases that is not possible. Best would be inline syntax that handles context-dependent escaping. For example:</p>
<pre class="notranslate"><code class="notranslate">messages:
signup_message: Please ${elem|sign up}
</code></pre>
<p dir="auto">code using fake PHP syntax as I am not familiar with Ruby:</p>
<pre class="notranslate"><code class="notranslate">t( 'signup_message', function ( $label ) { return makeButton( 'someurl', htmlspecialchars( $label ) ); } );
</code></pre>
<p dir="auto">But in the meantime, I hope message doc can be added cross-linking the translatable messages to each other.</p>
</blockquote>
<p dir="auto">I'm opening this issue to explore what we can do to make it easier for our translators to handle translations with interpolations. The most common usage of the interpolations are for links, where the link text is used by a link helper and then interpolated into the rest of the sentence, for example:</p>
<div class="highlight highlight-source-yaml" dir="auto"><pre class="notranslate"><span class="pl-ent">en</span>:
<span class="pl-ent">diary_entries</span>:
<span class="pl-ent">show</span>:
<span class="pl-ent">login_to_leave_a_comment_html</span>: <span class="pl-s"><span class="pl-pds">'</span>%{login_link} to leave a comment<span class="pl-pds">'</span></span>
<span class="pl-ent">login</span>: <span class="pl-s">Login</span></pre></div>
<div class="highlight highlight-source-ruby" dir="auto"><pre class="notranslate"><span class="pl-en">t</span><span class="pl-kos">(</span><span class="pl-s">".login_to_leave_a_comment_html"</span><span class="pl-kos">,</span> <span class="pl-pds">:login_link</span> <span class="pl-c1">=></span> <span class="pl-en">link_to</span><span class="pl-kos">(</span><span class="pl-en">t</span><span class="pl-kos">(</span><span class="pl-s">".login"</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-en">login_path</span><span class="pl-kos">(</span><span class="pl-pds">:referer</span> <span class="pl-c1">=></span> <span class="pl-en">request</span><span class="pl-kos">.</span><span class="pl-en">fullpath</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">I'm currently working on a series of PRs to remove all the raw html from the translations, and so this interpolation approach is also being used for html within sentences (bold, emphasis etc) like:</p>
<div class="highlight highlight-source-yaml" dir="auto"><pre class="notranslate"><span class="pl-ent">en</span>:
<span class="pl-ent">site</span>:
<span class="pl-ent">welcome</span>:
<span class="pl-ent">whats_on_the_map</span>:
<span class="pl-ent">off_the_map_html</span>: <span class="pl-s">|</span>
<span class="pl-s"> What it %{doesnt} include is opinionated data like ratings, historical or</span>
<span class="pl-s"> hypothetical features, and data from copyrighted sources. Unless you have special</span>
<span class="pl-s"> permission, don't copy from online or paper maps.</span>
<span class="pl-s"></span> <span class="pl-ent">doesnt</span>: <span class="pl-s">doesn't</span></pre></div>
<div class="highlight highlight-source-ruby" dir="auto"><pre class="notranslate"><span class="pl-en">t</span> <span class="pl-s">".whats_on_the_map.off_the_map_html"</span><span class="pl-kos">,</span> <span class="pl-pds">:doesnt</span> <span class="pl-c1">=></span> <span class="pl-en">tag</span><span class="pl-kos">.</span><span class="pl-en">em</span><span class="pl-kos">(</span><span class="pl-en">t</span><span class="pl-kos">(</span><span class="pl-s">".whats_on_the_map.doesnt"</span><span class="pl-kos">)</span><span class="pl-kos">)</span></pre></div>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/3939">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLKNVJT2TY6WHNJHTQ3WY46F5ANCNFSM6AAAAAAVFO4R4M">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLI2JDUCSYJP3YPXZXDWY46F5A5CNFSM6AAAAAAVFO4R4OWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHF6KUSFY.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/issues/3939</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/3939",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3939",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>