<p></p>
<p dir="auto">The actual code is <a href="https://github.com/openstreetmap/openstreetmap-website/blob/master/lib/locale.rb">https://github.com/openstreetmap/openstreetmap-website/blob/master/lib/locale.rb</a> but trying to understand it is not for the faint hearted ;-)</p>
<p dir="auto">It will never try and add components though - there is actually data for that in CLDR but I don't really want to get into that and it's unnecessary here.</p>
<p dir="auto">What <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gravitystorm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gravitystorm">@gravitystorm</a> proposes will work just fine and is what I would do - it's also equivalent to your algorithm in it's effects if I'm understanding things correctly.</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#issuecomment-1233864686">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPCPAW5YH7WXLYS2NLV4BLTDANCNFSM6AAAAAAQBQWL4I">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLPZODCZUX4VGP6XNPTV4BLTDA5CNFSM6AAAAAAQBQWL4KWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSJRND64.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/1233864686</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#issuecomment-1233864686",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3670#issuecomment-1233864686",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>