<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Improving support for plurals in localisations]]></title><description><![CDATA[<p dir="auto">Quick update re: localisation... according to Transifex, we began our translations <strong>over 12 years ago</strong> <img src="https://bbs.spacc.eu.org/new/assets/plugins/nodebb-plugin-emoji/emoji/twemoji2/1f60e.png?v=88a2f1f2287" class="not-responsive emoji emoji-twemoji2 emoji--sunglasses" style="height:23px;width:auto;vertical-align:middle" title=":sunglasses:" alt="😎" /> time flies!</p>
<p dir="auto"><img src="https://community.nodebb.org/assets/uploads/files/1793212282733-f697c609-b7bd-4109-85db-afca8f8de0d4-image.jpeg" alt="image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">In that time, we've migrated maintained our translations through Transifex, which has been kind enough to offer us free hosting as NodeBB is an open-source project.</p>
<p dir="auto">There has always been a bit of a problem with sentences with numbers in them — namely that they can either be <em>singular</em> ("A quick brown fox jumped...") or <em>plural</em> ("Three quick brown foxes jumped...")</p>
<p dir="auto"><strong>tl;dr</strong> — NodeBB now supports localisations with proper plural forms directly in our Transifex project interface. No more <code>(s)</code> hacks at the end of words!</p>
<p dir="auto">This gets even <em>more</em> complicated because different languages have different sentence structures for countable items. While English is relatively simple (one, or "more"), Russian has different terms/handling for "one", "few", "many", and "other".</p>
<p dir="auto"><em>N.B. "other" is Transifex' term for a fallback/generic catch-all... maybe it means "more than many"?</em></p>
<hr />
<p dir="auto">Up 'til now we hacked around this by appending the string <code>(s)</code> to the end of singular forms:</p>
<p dir="auto">&gt; You have %1 post(s) left to read.</p>
<p dir="auto">&gt; There are 5 fox(es) in your henhouse.</p>
<p dir="auto">&gt; Please stack <a href="https://youtu.be/QWzYaZDK6Is?t=92" target="_blank" rel="noopener noreferrer nofollow ugc">these ten box(en)</a> in the warehouse.</p>
<p dir="auto">This was admittedly a stopgap measure, but we've made the changes to our translator library to properly handle the plural forms that Transifex supports. From the Transifex interface, these strings will look like this:</p>
<p dir="auto"><img src="https://community.nodebb.org/assets/uploads/files/1793213140124-fb5b59cf-ac1b-4431-89af-6c89d5984304-image.jpeg" alt="image.jpeg" class=" img-fluid img-markdown" /></p>
<p dir="auto">The "1" and "other" buttons at the top right will allow you to switch between forms, finally allowing you to construct plural forms for NodeBB strings.</p>
<p dir="auto">Happy Translating!</p>


<div class="row"><div class="col-12"><p><a href="https://community.nodebb.org/assets/uploads/files/1793212282733-f697c609-b7bd-4109-85db-afca8f8de0d4-image.jpeg" rel="nofollow ugc">https://community.nodebb.org/assets/uploads/files/1793212282733-f697c609-b7bd-4109-85db-afca8f8de0d4-image.jpeg</a></p><p><a href="https://community.nodebb.org/assets/uploads/files/1793213140124-fb5b59cf-ac1b-4431-89af-6c89d5984304-image.jpeg" rel="nofollow ugc">https://community.nodebb.org/assets/uploads/files/1793213140124-fb5b59cf-ac1b-4431-89af-6c89d5984304-image.jpeg</a></p></div></div>]]></description><link>https://bbs.spacc.eu.org/new/topic/acc1f01a-d69e-4616-88df-abecc5b5fe62/improving-support-for-plurals-in-localisations</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 04:32:59 GMT</lastBuildDate><atom:link href="https://bbs.spacc.eu.org/new/topic/acc1f01a-d69e-4616-88df-abecc5b5fe62.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 Oct 2026 18:46:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Improving support for plurals in localisations on Fri, 30 Oct 2026 15:04:23 GMT]]></title><description><![CDATA[<p dir="auto"><strong>For Developers</strong></p>
<p dir="auto">There's no requirement to support pluralized strings in your templates — they are <strong>opt-in</strong>, but they are fairly easy to support.</p>
<p dir="auto">Where you would normally write a translation string like so:</p>
<pre><code class="language-json">{
  ...
  "foo": "%1 bar(s)"
  ...
}
</code></pre>
<p dir="auto">You will instead put in an <a href="https://help.transifex.com/en/articles/6220806-json-with-icu-plurals" target="_blank" rel="noopener noreferrer nofollow ugc">"ICU Plural" string</a> that looks like this:</p>
<pre><code class="language-json">{
  ...
  "foo": "{count, plural, one {{count} bar} other {{count} bars}}"
  ...
}
</code></pre>
<p dir="auto">Comma separated:</p>
<ul>
<li><code>count</code> is the variable substitution you'll use in the latter half of the string</li>
<li><code>plural</code> is hardcoded, it's always <code>plural</code></li>
<li>Then the forms:
<ul>
<li><code>one</code> denotes the singular form in the proceeding braces</li>
<li><code>other</code> denotes the plural form (in English) in the next set of braces</li>
</ul>
</li>
</ul>
]]></description><link>https://bbs.spacc.eu.org/new/post/https://community.nodebb.org/post/108271</link><guid isPermaLink="true">https://bbs.spacc.eu.org/new/post/https://community.nodebb.org/post/108271</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Fri, 30 Oct 2026 15:04:23 GMT</pubDate></item><item><title><![CDATA[Reply to Improving support for plurals in localisations on Fri, 30 Oct 2026 15:02:59 GMT]]></title><description><![CDATA[<p><span><a href="/user/julian%40community.nodebb.org">@<span>julian</span></a></span> Thanks for fixing this!</p>]]></description><link>https://bbs.spacc.eu.org/new/post/https://mastodon.scot/users/gunchleoc/statuses/117530465382347805</link><guid isPermaLink="true">https://bbs.spacc.eu.org/new/post/https://mastodon.scot/users/gunchleoc/statuses/117530465382347805</guid><dc:creator><![CDATA[gunchleoc@mastodon.scot]]></dc:creator><pubDate>Fri, 30 Oct 2026 15:02:59 GMT</pubDate></item><item><title><![CDATA[Reply to Improving support for plurals in localisations on Fri, 30 Oct 2026 14:59:00 GMT]]></title><description><![CDATA[<p dir="auto"><strong>For translators</strong></p>
<p dir="auto">This means that any <em>converted</em> strings have lost their existing translations. You will need to manually go in and translate them again (plus their plural variants), or rescue the existing translation from the history.</p>
<p dir="auto"><em>However</em>, note that for plural strings, there is a new placeholder <code>{count}</code> to be used in addition to the <code>%1</code>, <code>%2</code>, etc. that we already use. We use <code>{count}</code> for simplicity, but it could be named anything.</p>
]]></description><link>https://bbs.spacc.eu.org/new/post/https://community.nodebb.org/post/108270</link><guid isPermaLink="true">https://bbs.spacc.eu.org/new/post/https://community.nodebb.org/post/108270</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Fri, 30 Oct 2026 14:59:00 GMT</pubDate></item></channel></rss>