<p></p>
<p dir="auto">As found while working on <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1334850757" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3653" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/3653/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/3653">#3653</a> we have a stray translation file <code class="notranslate">pt.yml</code> that <a href="https://github.com/openstreetmap/openstreetmap-website/blob/04ff7d4ee81040f152c38ee39ba84491c91a66f3/config/locales/pt.yml">hasn't been updated in around 8 years</a>.</p>
<p dir="auto">My first thought is to simply remove it immediately, since it's woefully outdated, and we have <code class="notranslate">pt-PT</code> and <code class="notranslate">pt-BR</code> translations that are kept up to date. But my concern is that without this file, any browser requesting "pt" will see the default English translation, since our Locale detection doesn't "fall-forwards" i.e. it doesn't choose a more specific locale if the more general locale is missing.</p>
<p dir="auto">After removing the <code class="notranslate">pt.yml</code> file:</p>
<div class="highlight highlight-source-ruby" dir="auto"><pre><span class="pl-v">Locale</span><span class="pl-kos">.</span><span class="pl-en">available</span><span class="pl-kos">.</span><span class="pl-en">preferred</span><span class="pl-kos">(</span><span class="pl-v">Locale</span><span class="pl-kos">.</span><span class="pl-en">list</span><span class="pl-kos">(</span><span class="pl-s">"pt"</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
<span class="pl-c1">=></span> <span class="pl-c">#<struct Locale language="en", script=nil, region=nil, variant=nil, extension=nil, privateuse=nil, grandfathered=nil></span>
<span class="pl-v">Locale</span><span class="pl-kos">.</span><span class="pl-en">available</span><span class="pl-kos">.</span><span class="pl-en">preferred</span><span class="pl-kos">(</span><span class="pl-v">Locale</span><span class="pl-kos">.</span><span class="pl-en">list</span><span class="pl-kos">(</span><span class="pl-s">"pt-PT"</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
<span class="pl-c1">=></span> <span class="pl-c">#<struct Locale language="pt", script=nil, region="PT", variant=nil, extension=nil, privateuse=nil, grandfathered=nil></span></pre></div>
<p dir="auto">Would this limitation be acceptable? Does anyone know how common it is for browsers to request "pt" translations, as opposed to "pt-PT" or "pt-BR"?</p>
<p dir="auto">An alternative would be to change one of the two <code class="notranslate">pt-*</code> translations to use the <code class="notranslate">pt</code> key, and then the regular fallbacks would cover all situations. It's worth noting here that:</p>
<ul dir="auto">
<li><a href="https://translatewiki.net/wiki/Translating:OpenStreetMap" rel="nofollow">Translatewiki</a> has <code class="notranslate">pt</code> and <code class="notranslate">pt-br</code></li>
<li><a href="https://www.transifex.com/openstreetmap/id-editor/languages/" rel="nofollow">transifex for iD</a> has <code class="notranslate">pt</code> and <code class="notranslate">pt_BR</code></li>
<li><a href="https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale">rails-i18n</a> also has <code class="notranslate">pt</code> and <code class="notranslate">pt-BR</code>.</li>
</ul>
<p dir="auto">So perhaps a better solution is to change the translatewiki export to:</p>
<ol dir="auto">
<li>stop the translatewiki export from remapping <code class="notranslate">pt</code> to <code class="notranslate">pt-PT</code>,</li>
<li>allow it to overwrite our old <code class="notranslate">pt.yml</code>,</li>
<li>and then finally remove the <code class="notranslate">pt-PT.yml</code> file instead.</li>
</ol>
<p dir="auto">Any thoughts?</p>

<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/3670">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNVKHTJCPMNLACFUJLV357EZANCNFSM6AAAAAAQBQWL4I">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLKRDJ4DYX5VROFVPDTV357EZA5CNFSM6AAAAAAQBQWL4KWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHFB2VGXM.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/3670</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/3670",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3670",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>