Skip to content

feat: add Arabic-first i18n with locale switcher#21

Merged
fahdfady merged 7 commits into
BLEU-IO:masterfrom
abdelrhmanehab10:feat/i18n-arabic-interface
Apr 12, 2026
Merged

feat: add Arabic-first i18n with locale switcher#21
fahdfady merged 7 commits into
BLEU-IO:masterfrom
abdelrhmanehab10:feat/i18n-arabic-interface

Conversation

@abdelrhmanehab10
Copy link
Copy Markdown
Contributor

Summary

Closes #17

This PR adds an Arabic-first internationalization flow for the BLEU website.

What changed

  • added Arabic-first routing:
    • / for Arabic
    • /en/ for English
  • added a language switcher in the navbar
  • translated shared UI copy to Arabic and English
  • generated localized versions of shared pages and blog post routes
  • added RTL support for Arabic UI
  • kept authored blog content unchanged
  • forced post metadata and tags to render LTR for readability on Arabic post pages
  • updated contribute links to point to the localized contributing page instead of GitHub
  • added build-time translation validation and localized build verification

Technical notes

  • uses i18next with split JSON translation files
  • uses shared Eleventy templates for both locales
  • validates translation key parity during build
  • verifies localized output routes during build

How to test

  1. Run npm install
  2. Run npm run build
  3. Run npm run dev
  4. Verify these routes:
    • /
    • /en/
    • /blogs/
    • /en/blogs/
  5. Verify the language switcher maps between equivalent pages
  6. Verify blog cards appear in both Arabic and English listing pages
  7. Verify Arabic pages use RTL UI
  8. Verify blog post metadata and tags remain LTR on Arabic post pages
  9. Verify contribute links open the localized contributing

Scope notes

  • shared UI is translated
  • authored blog content, titles, excerpts, and tags remain as-authored
  • third-party widget UI is only localized where supported

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an Arabic-first internationalization setup for the Eleventy site, with / serving Arabic and /en/ serving English, plus shared translated UI and RTL support.

Changes:

  • Added i18next-based build-time i18n loading + translation parity validation, with per-locale page generation via Eleventy pagination.
  • Updated templates (home, blogs, contributing, layout/components) to use translation keys and locale-aware URLs.
  • Added RTL/LTR styling adjustments, a navbar language switcher, and build verification scripts to ensure localized outputs exist.

Reviewed changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.eleventy.js Initializes i18n globals (t, localeUrl) and validates dictionaries during build.
src/i18n/index.js Loads translation resources, validates parity, and localizes URLs.
src/_data/locales.js Defines supported locales and routing prefixes.
src/index.njk + src/index.11tydata.js Converts home page to localized metadata + localized routing.
src/blogs.njk + src/blogs.11tydata.js Converts blogs listing page to localized metadata + localized routing.
content/blogs/blogs.11tydata.js Generates localized blog post routes for both locales.
src/contributing.njk + src/contributing.11tydata.js Localizes the contributing page and routes.
src/_includes/layouts/base.njk Adds locale-aware <html lang/dir>, localized meta, and hreflang alternates.
src/_includes/layouts/blog.njk Localizes blog UI strings and improves RTL/LTR handling for metadata/tags.
src/_includes/components/* Localizes header/footer/widget/giscus and adds a language switcher.
src/assets/css/input.css Adds RTL support, bidi handling, and language switcher styling; adds Arabic/Latin fonts.
src/assets/js/main.js Adds language switcher navigation + stores locale; keeps tag filtering enhancement.
scripts/check-i18n.js + scripts/verify-localized-build.js Adds translation validation and localized output verification during build.
package.json + package-lock.json Adds i18next dependency and build steps for i18n validation/verification.
src/_data/site.json Removes hardcoded tagline/description in favor of translated equivalents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.njk
Comment thread src/blogs.njk
<a
href="https://github.com/{{ site.repo }}/edit/main/content/blogs/{{ page.fileSlug }}.md"
<a
href="https://github.com/{{ site.repo }}/edit/master/content/blogs/{{ page.fileSlug }}.md"
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Edit on GitHub” link switched from /edit/main/... to /edit/master/.... If the repository default branch is main (as previously assumed), this link will 404. Consider reverting to main or making the branch configurable (e.g., site.defaultBranch).

Suggested change
href="https://github.com/{{ site.repo }}/edit/master/content/blogs/{{ page.fileSlug }}.md"
href="https://github.com/{{ site.repo }}/edit/main/content/blogs/{{ page.fileSlug }}.md"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I validated this against the local git metadata, and master is the current default branch in this repository context.

Local refs show:

  • remotes/origin/HEAD -> origin/master
  • remotes/origin/master
  • remotes/upstream/master

So switching the edit link to master was intentional and matches the branch this repo is currently using. Because of that, I’m not reverting this to main.

Comment thread src/_includes/layouts/blog.njk Outdated
Comment thread src/assets/css/input.css Outdated
Copy link
Copy Markdown
Member

@fahdfady fahdfady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work overall. And the font is really cool!
I just had some comments on the translation itself. We can work on this together and get this merged.

Comment thread src/i18n/ar/home.json Outdated
Comment thread src/i18n/ar/home.json
Comment thread src/i18n/ar/home.json Outdated
Comment thread src/i18n/ar/home.json
Comment thread src/i18n/ar/common.json Outdated
Comment thread src/i18n/ar/blogs.json Outdated
Comment thread src/i18n/ar/blogs.json Outdated
Comment thread src/i18n/en/contributing.json Outdated
Comment thread src/i18n/ar/contributing.json Outdated
Copy link
Copy Markdown
Member

@fahdfady fahdfady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
شكرا @abdelrhmanehab10

@fahdfady fahdfady merged commit 774e186 into BLEU-IO:master Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i18n: Arabic interface for the website

3 participants