<?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: Architectena</title>
    <description>The latest articles on DEV Community by Architectena (@architectena).</description>
    <link>https://dev.to/architectena</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%2F4253757%2Fa2f67627-22ca-4ae2-a03f-dff91acca445.jpg</url>
      <title>DEV Community: Architectena</title>
      <link>https://dev.to/architectena</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/architectena"/>
    <language>en</language>
    <item>
      <title>Arabic and English in one Django site: four bugs that weren't translation</title>
      <dc:creator>Architectena</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:50:57 +0000</pubDate>
      <link>https://dev.to/architectena/arabic-and-english-in-one-django-site-four-bugs-that-werent-translation-3481</link>
      <guid>https://dev.to/architectena/arabic-and-english-in-one-django-site-four-bugs-that-werent-translation-3481</guid>
      <description>&lt;p&gt;I'm an architect, and I built &lt;a href="https://architectena.com" rel="noopener noreferrer"&gt;Architectena&lt;/a&gt;, a professional site for architects (portfolio, CV, architecture-only jobs, office pages and a studio workspace) that runs fully in Arabic and English. It's Django 5.2 on PostgreSQL, with Celery for background work.&lt;/p&gt;

&lt;p&gt;Translating the interface was the easy part. These four problems were not in any translation file, and each one looked fine until it didn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The year 2026 rendered as "2,026"
&lt;/h2&gt;

&lt;p&gt;With &lt;code&gt;USE_THOUSAND_SEPARATOR = True&lt;/code&gt;, Django groups &lt;strong&gt;every&lt;/strong&gt; integer a template renders. It can't tell a quantity from an identifier. A project year came out as &lt;code&gt;2,026&lt;/code&gt;, and the same rule turns &lt;code&gt;{{ obj.id }}&lt;/code&gt; into &lt;code&gt;1,234&lt;/code&gt; inside form values and URLs.&lt;/p&gt;

&lt;p&gt;We searched the templates and found 323 places that render an identifier. 214 of them would actually break: 189 form values that would submit &lt;code&gt;1,234&lt;/code&gt; and fail validation, and 25 links that would 404. None had broken yet only because no table had passed 1,000 rows. A year was simply the first integer to cross the line.&lt;/p&gt;

&lt;p&gt;The fix was one setting, not 214 &lt;code&gt;|unlocalize&lt;/code&gt; filters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# settings&lt;/span&gt;
&lt;span class="no"&gt;USE_THOUSAND_SEPARATOR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grouping isn't lost where you want it: &lt;code&gt;{{ n|intcomma }}&lt;/code&gt; forces grouping, so follower counts still read &lt;code&gt;1,234&lt;/code&gt;. Use it on quantities, never on ids or years. A per-template filter would also have missed every template written later, which is how the year sites drifted in the first place.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The second catalogue
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.po&lt;/code&gt; catalogue looked perfect: 13,031 entries, zero untranslated, zero fuzzy. But Arabic pages still showed English filter bars.&lt;/p&gt;

&lt;p&gt;The gap was the &lt;em&gt;other&lt;/em&gt; catalogue: the &lt;code&gt;name_ar&lt;/code&gt; columns on vocabulary models (skills, specialties, office fields, job fields). 164 of 309 values were blank. Nothing rendered empty, because every model's &lt;code&gt;display_name()&lt;/code&gt; fell back to English. So the symptom wasn't a missing string. It was an Arabic page with English chips on it, which reads as a site that was localised by somebody who stopped halfway.&lt;/p&gt;

&lt;p&gt;Two lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Audit data, not just strings.&lt;/strong&gt; A catalogue checker can't see database columns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One mapping for shared terms.&lt;/strong&gt; "Landscape architecture" appears as an office field, a specialty &lt;em&gt;and&lt;/em&gt; a job field. Two Arabic spellings of one term is how a filter bar starts looking machine-made, so all three tables read from one English→Arabic module.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One deliberate exception: brand software stays Latin. An Arabic CV says AutoCAD, not a transliteration, so those rows keep an empty Arabic name and fall through to English on purpose. The module names them explicitly, so the next coverage report doesn't file it as a bug.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Arabic number formats are a separate setting
&lt;/h2&gt;

&lt;p&gt;Django looks up &lt;code&gt;{module}.{lang}.formats&lt;/code&gt; for locale formatting. A project-level override lets Arabic pages group numbers the way the house style wants without touching English:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;FORMAT_MODULE_PATH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"locale_formats"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# locale_formats/ar/formats.py&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small, but it's the difference between numbers that look right in a right-to-left sentence and numbers that look pasted in.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. "No AI training" without delisting yourself from search
&lt;/h2&gt;

&lt;p&gt;The site promises users that their work is not training data. A promise is just a sentence unless something enforces it, so &lt;code&gt;robots.txt&lt;/code&gt; is generated from one Python list of AI-training user agents (GPTBot, ClaudeBot, Google-Extended, Applebot-Extended, CCBot and others).&lt;/p&gt;

&lt;p&gt;Two details matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A crawler that finds its own name obeys only that group&lt;/strong&gt; and ignores &lt;code&gt;User-agent: *&lt;/code&gt; entirely. So every agent gets its own full block, not an addition to the shared one:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="no"&gt;AI_TRAINING_AGENTS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"\nUser-agent: {agent}\nDisallow: /\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The search halves are different bots.&lt;/strong&gt; &lt;code&gt;Googlebot&lt;/code&gt; is not &lt;code&gt;Google-Extended&lt;/code&gt;, &lt;code&gt;Applebot&lt;/code&gt; is not &lt;code&gt;Applebot-Extended&lt;/code&gt;, &lt;code&gt;OAI-SearchBot&lt;/code&gt; is not &lt;code&gt;GPTBot&lt;/code&gt;. Block the wrong one and you quietly delist yourself while claiming to protect users. A second list of search agents exists only so a test can assert the two lists never overlap.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The public promise page and &lt;code&gt;robots.txt&lt;/code&gt; read the same list, so they can't drift apart: a name added to the promise is refused in the same commit, and a test fails if it isn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern behind all four
&lt;/h2&gt;

&lt;p&gt;Every one of these passed a normal check: the catalogue was complete, the pages rendered, robots.txt existed. What caught them was asking what the user actually sees in the second language, and then writing a guard test so it can't come back.&lt;/p&gt;

&lt;p&gt;If you're building something bilingual, especially right-to-left, I'd love to hear which of these you've hit, or what I've missed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Architectena is free for individual architects, at &lt;a href="https://architectena.com" rel="noopener noreferrer"&gt;architectena.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>i18n</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
