<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vinclora</title>
    <description>The latest articles on DEV Community by Vinclora (@vinclora).</description>
    <link>https://dev.to/vinclora</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4210455%2F684e9aa8-36e3-474a-a82f-0ed1ee69e64f.png</url>
      <title>DEV Community: Vinclora</title>
      <link>https://dev.to/vinclora</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinclora"/>
    <language>en</language>
    <item>
      <title>Shipping a client portal in 23 languages: what we learned</title>
      <dc:creator>Vinclora</dc:creator>
      <pubDate>Fri, 27 Nov 2026 22:26:03 +0000</pubDate>
      <link>https://dev.to/vinclora/shipping-a-client-portal-in-23-languages-what-we-learned-2bp9</link>
      <guid>https://dev.to/vinclora/shipping-a-client-portal-in-23-languages-what-we-learned-2bp9</guid>
      <description>&lt;p&gt;ClientsPlace is a client portal for service businesses: proposals, contracts with e-signature, invoices paid online, files and messages. The frontend is Angular, the backend is .NET, and the interface ships in 23 languages, three of them right-to-left (Arabic, Hebrew and Urdu).&lt;/p&gt;

&lt;p&gt;We didn't plan for 23 languages at the start. The translation README in our repo still describes two, English and Arabic. Here is what changed as the language count went up, and what we would tell a team at the start of the same road.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. One folder per area, one file per locale
&lt;/h2&gt;

&lt;p&gt;Translations live in feature folders (&lt;code&gt;auth/&lt;/code&gt;, &lt;code&gt;invoices/&lt;/code&gt;, &lt;code&gt;portal/&lt;/code&gt;, &lt;code&gt;settings/&lt;/code&gt; and so on). Each folder has one file per locale: &lt;code&gt;en.ts&lt;/code&gt;, &lt;code&gt;ar.ts&lt;/code&gt;, &lt;code&gt;ur.ts&lt;/code&gt;, &lt;code&gt;zh-TW.ts&lt;/code&gt;. These are TypeScript modules exporting flat key/value maps, not JSON. So a missing import or a typo in an export name fails the build, where with JSON it would fail quietly at runtime.&lt;/p&gt;

&lt;p&gt;A generator script then writes one module per locale that imports every area for that locale, in the same spread order as the main index. Nobody edits those files by hand. The header says so.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Load exactly one locale, keep English in memory
&lt;/h2&gt;

&lt;p&gt;Shipping 23 locales in the initial bundle was never an option. Each non-English locale is its own lazy chunk:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;LOCALE_CORE_LOADERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./locales/ar'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;he&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./locales/he'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;ur&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./locales/ur'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// ...one entry per locale&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The import paths have to be static string literals. The bundler can't code-split &lt;code&gt;import('./locales/' + code)&lt;/code&gt;, so the "clever" one-liner would put every locale back into one chunk.&lt;/p&gt;

&lt;p&gt;English stays eager on purpose. Our &lt;code&gt;translate()&lt;/code&gt; is synchronous, because an impure pipe calls it on every change-detection cycle. So a complete map always has to be in memory while another locale loads. When a locale finishes loading, its namespaces are published together in one map update. If the chunk fails to load (the user is offline, or a deploy left a stale chunk), the error is swallowed and English stays on screen. Text never goes blank.&lt;/p&gt;

&lt;p&gt;For server-side rendering it works the other way round: the server registers every locale eagerly, so it never has to wait halfway through a render. A comment on that provider warns that importing it from the browser config would pull every locale back into the initial bundle.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A fallback chain that never shows a raw key
&lt;/h2&gt;

&lt;p&gt;Lookup order in &lt;code&gt;translate()&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The workspace owner's own wording for that string (portal text overrides, per language or for every language)&lt;/li&gt;
&lt;li&gt;The active locale&lt;/li&gt;
&lt;li&gt;English&lt;/li&gt;
&lt;li&gt;The key itself, as a last resort
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;translation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="n"&gt;own&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;maps&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;maps&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;DEFAULT_LANGUAGE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3 is what makes lazy loading safe. Without it, users would see &lt;code&gt;invoices.status.overdue&lt;/code&gt; for a few hundred milliseconds on every page load in 22 languages.&lt;/p&gt;

&lt;p&gt;The downside is that the fallback hides problems. A missing Bengali key shows English, nothing breaks, and nobody notices. So the next layer can't be optional.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Tests that count keys
&lt;/h2&gt;

&lt;p&gt;We have three kinds of checks, and each one catches something the others miss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Completeness:&lt;/strong&gt; every locale has every English key, and no extra keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key count:&lt;/strong&gt; each locale has the same number of keys as English.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime parity:&lt;/strong&gt; the lazy per-locale modules serve exactly the same keys &lt;em&gt;and values&lt;/em&gt; as the eager index. A locale module that silently dropped a whole namespace would pass the first two tests and still ship broken.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is one legitimate exception to "no extra keys": plural forms (more on those below). English only has &lt;code&gt;.one&lt;/code&gt; and &lt;code&gt;.other&lt;/code&gt;, but Arabic, Hebrew, Polish and Russian need &lt;code&gt;zero&lt;/code&gt;, &lt;code&gt;two&lt;/code&gt;, &lt;code&gt;few&lt;/code&gt; or &lt;code&gt;many&lt;/code&gt;. The test lets &lt;code&gt;.few&lt;/code&gt; exist in a locale whenever English defines &lt;code&gt;.other&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A registry test also checks that there are exactly 23 languages, that codes are unique, and that exactly &lt;code&gt;ar&lt;/code&gt;, &lt;code&gt;he&lt;/code&gt; and &lt;code&gt;ur&lt;/code&gt; are marked right-to-left.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Key checks are not translation checks
&lt;/h2&gt;

&lt;p&gt;Our biggest surprise: every key can exist and the translation can still be wrong.&lt;/p&gt;

&lt;p&gt;We translate &lt;strong&gt;one locale per change&lt;/strong&gt;, never in a big parallel batch. When a string's English wording changes, the key already exists in all 23 files. If the update to one locale silently does nothing, every key test stays green while the old wording ships. In our own runs we have seen batch translation jobs report "done" for every locale while most files came back unchanged. We have also seen files come back with broken encoding: Urdu double-encoded into mojibake, Bengali lines turned into &lt;code&gt;????&lt;/code&gt;, and a duplicated key.&lt;/p&gt;

&lt;p&gt;So after every translation change we now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;diff each locale's &lt;strong&gt;values&lt;/strong&gt; against the main branch, not just its keys&lt;/li&gt;
&lt;li&gt;grep for mojibake markers and &lt;code&gt;????&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;check for duplicate keys&lt;/li&gt;
&lt;li&gt;build before committing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also keep a small script that lists values identical to the English text. It skips brand and product words like "PDF", "API" or "Zapier", which legitimately stay the same.&lt;/p&gt;

&lt;p&gt;The newest locales (Bengali, Urdu, Vietnamese) are the ones that get forgotten most often. When we review a translation change, we check those three first.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Plurals: let the platform pick the category
&lt;/h2&gt;

&lt;p&gt;We don't write &lt;code&gt;count === 1 ? ... : ...&lt;/code&gt;. The plural helper asks &lt;code&gt;Intl.PluralRules&lt;/code&gt; for the category and falls back to &lt;code&gt;.other&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;translateCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;I18nService&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PluralRules&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getLanguageCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;selected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${key}.${category}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;selected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;selected&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${key}.other`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our unit test pins the cases that English speakers tend to get wrong: in Arabic, 2 is &lt;code&gt;two&lt;/code&gt;, 3 is &lt;code&gt;few&lt;/code&gt;, 11 is &lt;code&gt;many&lt;/code&gt;. In Russian, 2 is &lt;code&gt;few&lt;/code&gt; and 5 is &lt;code&gt;many&lt;/code&gt;. The fallback to &lt;code&gt;.other&lt;/code&gt; means a locale that hasn't added its extra forms yet still reads acceptably.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Right-to-left: one flag, one place, mostly logical CSS
&lt;/h2&gt;

&lt;p&gt;Each language entry carries an &lt;code&gt;rtl&lt;/code&gt; boolean. When the language changes, the service sets &lt;code&gt;dir&lt;/code&gt; and &lt;code&gt;lang&lt;/code&gt; on &lt;code&gt;and swaps an `rtl`/`ltr` class on&lt;/code&gt;. Components don't decide direction themselves.&lt;/p&gt;

&lt;p&gt;For layout we prefer CSS logical properties (&lt;code&gt;margin-inline-start&lt;/code&gt;, &lt;code&gt;padding-inline-start&lt;/code&gt;, &lt;code&gt;inset-inline-start&lt;/code&gt;). Our stylesheets still contain plenty of physical &lt;code&gt;margin-left&lt;/code&gt; and &lt;code&gt;padding-left&lt;/code&gt; too. Some of those are fine (symmetric spacing, or things that really should not flip), and some are leftovers we fix as RTL testing finds them. Directional icons such as row chevrons get an explicit &lt;code&gt;[dir="rtl"]&lt;/code&gt; rule with &lt;code&gt;transform: scaleX(-1)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A small honest note: the helper that checks for right-to-left still has a doc comment that says "(ar, he)". The code reads the registry, so Urdu works, but the comment dates from before Urdu was added. Comments that list languages go stale faster than code.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Which language wins
&lt;/h2&gt;

&lt;p&gt;On the browser, the order is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A locale prefix in the URL (&lt;code&gt;/es/...&lt;/code&gt;). The server already rendered that page in Spanish, so switching to a cookie's language during hydration would flip the page after paint.&lt;/li&gt;
&lt;li&gt;A language cookie scoped to the parent domain, so a choice made on the marketing site carries over to the app after sign-in (&lt;code&gt;localStorage&lt;/code&gt; is per-origin and would not).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;localStorage&lt;/code&gt;, as the fallback for development and environments without the cookie.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;navigator.language&lt;/code&gt;. A bare &lt;code&gt;pt&lt;/code&gt; maps to &lt;code&gt;pt-PT&lt;/code&gt; and a bare &lt;code&gt;zh&lt;/code&gt; to &lt;code&gt;zh-CN&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the client portal, the client's own language choice is saved on the server per client and per workspace. The notification layer reads that preference when it decides which language to send a client's e-mail in.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. The lists drift
&lt;/h2&gt;

&lt;p&gt;Formatting goes through &lt;code&gt;Intl.DateTimeFormat&lt;/code&gt;, &lt;code&gt;Intl.NumberFormat&lt;/code&gt; (the currency is a parameter, never guessed from the locale) and &lt;code&gt;Intl.RelativeTimeFormat&lt;/code&gt;. A map turns each UI code into a full locale, for example &lt;code&gt;ur&lt;/code&gt; → &lt;code&gt;ur-PK&lt;/code&gt; and &lt;code&gt;bn&lt;/code&gt; → &lt;code&gt;bn-BD&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That map is one more list of languages. So are the frontend registry, the request-locale middleware and the server-side validators that accept a language preference. While writing this post, we found two server-side validators that still carried an older 12-language list while the frontend offered 23, so a client who picked one of the newer languages quietly kept their old one. We fixed it by moving both checks onto one shared list, with a test that walks all 23 codes. The lesson is that every hand-maintained copy of the supported-language list needs a test that compares it with the one real source.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we would do again
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Lazy-load one chunk per locale, with English always in memory as the fallback&lt;/li&gt;
&lt;li&gt;Write tests that compare keys, counts &lt;em&gt;and&lt;/em&gt; runtime values&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;Intl&lt;/code&gt; for plurals and formatting instead of hand-written rules&lt;/li&gt;
&lt;li&gt;Translate one locale per change and review the values, not just a green test run&lt;/li&gt;
&lt;li&gt;Keep one source of truth for supported languages, and test every copy against it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to see the result, the portal is at &lt;a href="https://clientsplace.com" rel="noopener noreferrer"&gt;clientsplace.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
