Developer Guide

How to Add Arabic Language Support to Your ASP.NET Community Site

 ·  by ASP Playground Dev Team  ·  9 min read

📄 Download this guide as PDF Offline reference — How to Add Arabic Language Support to Your ASP.NET Community Site
View PDF

ASP.NET Globalization Architecture

ASP.NET's built-in globalization engine uses resource files (.resx) paired with the Thread.CurrentThread.CurrentUICulture setting to serve translated strings. For Arabic, the culture code is ar (general) or region-specific codes like ar-SA (Saudi Arabia), ar-EG (Egypt), ar-MA (Morocco).

Step 1 — Configure Web.config

Enable globalization support in Web.config:

<system.web>
  <globalization
    culture="auto"
    uiCulture="auto"
    enableClientBasedCulture="true"
    requestEncoding="utf-8"
    responseEncoding="utf-8" />
</system.web>

The auto settings read the browser's Accept-Language header and set the culture automatically. For Arabic visitors, this activates Arabic translations without any manual URL manipulation.

Step 2 — Create Arabic Resource Files

Place Arabic translations in App_GlobalResources/Strings.ar.resx. Key strings for a sports community:

  • LiveNow → مباشر الآن
  • Upcoming → قادمة
  • WatchStream → شاهد البث
  • MatchDiscussion → نقاش المباراة
  • PostComment → أضف تعليقاً

Step 3 — URL Strategy for Arabic Pages

Two common approaches:

  1. Subdirectory: /ar/matches — cleanest for SEO, clear hreflang mapping
  2. Subdomain: ar.yoursite.com — requires separate server configuration

For sports sites, the subdirectory approach is recommended. Add a route in your MVC/WebForms URL routing to strip the language prefix and set the culture:

routes.MapRoute(
  "Arabic", "ar/{controller}/{action}/{id}",
  new { controller = "Home", action = "Index", id = UrlParameter.Optional },
  new { culture = new CultureConstraint("ar") }
);

Step 4 — Database Collation

Ensure your SQL Server database uses a Unicode collation that supports Arabic characters. Arabic_CI_AS is the standard choice for Arabic content — case-insensitive, accent-sensitive. Apply it to the column level for content fields:

ALTER TABLE Posts
ALTER COLUMN Body NVARCHAR(MAX) COLLATE Arabic_CI_AS;

Step 5 — Language Switcher UI

Add a language switcher in your header. When the user selects Arabic, set a cookie and redirect to the Arabic URL variant. This preference persists across sessions without requiring registration.

APG vNext Integration

APG vNext stores forum content as NVARCHAR by default, which supports Arabic without modification. The main work is in the UI translation and RTL layout — both covered in the companion guide: Building Arabic RTL Sports Forums with APG vNext.

For a live implementation serving Arabic sports fans, see the Yalla Shoot streaming app guide.

See it in practice

We applied these techniques to build the Yalla Shoot streaming app guide — a real-world ASP.NET web application serving live sports content.

View Yalla Shoot Technical Guide →