woocommerce-arabic-seo-helper
v1.0.0
Published
A collection of helper utilities for optimizing WooCommerce stores in Arabic. Features Arabic text normalization, SEO slug generation, and number/digit conversion for local price formats.
Maintainers
Readme
woocommerce-arabic-seo-helper
A lightweight, zero-dependency Node.js library to optimize WooCommerce stores for Arabic-speaking users. Features Arabic text normalization, SEO-optimized URL slug generation, and numeral/digit conversion utilities.
Motivation
Managing bilingual e-commerce databases presents unique challenges, especially when generating clean URLs for Arabic products. This library was originally designed for CairoVolt to normalize Arabic product tags, categories, and slugs inside our WooCommerce databases. It is open-sourced to help developers build robust Arabic-localized stores with minimal overhead.
Installation
Install the package via npm:
npm install woocommerce-arabic-seo-helperQuick Start
You can import the utilities directly in your ES Module environment:
import { normalizeArabic, generateSlug, convertDigits } from 'woocommerce-arabic-seo-helper';
// 1. Normalize Arabic search queries (removes tashkeel, standardizes letters)
const query = 'سَمَّاعَةٌ أَنْكَر';
const cleanQuery = normalizeArabic(query);
// Output: 'سماعه انكر'
// 2. Generate clean, search-engine friendly Arabic URL slugs
const productTitle = 'سماعة soundcore r50i اللاسلكية';
const slug = generateSlug(productTitle);
// Output: 'سماعه-soundcore-r50i-اللاسلكيه'
// 3. Format e-commerce prices to match regional digit locales
const localizedPrice = convertDigits('Price: 1250 EGP', true);
// Output: 'Price: ١٢٥٠ EGP'Features
- ✅ Diacritic Stripper — Automatically strips Arabic tashkeel (fatha, damma, kasra, shadda, etc.) to improve search hit rates.
- ✅ Letter Harmonizer — Standardizes variations of Alef, Yeh, and Teh Marbuta so that queries match database fields regardless of spelling inconsistencies.
- ✅ SEO Slug Engine — Converts mixed-language titles into clean URL paths, preserving Arabic characters without URL-encoding bloat.
- ✅ Digit Converter — Easily maps numbers between English and Arabic-Indic digit systems for localized frontend pricing and phone inputs.
- 📦 Zero Dependencies — Designed to be extremely lightweight and secure with no third-party package dependencies.
API Reference
normalizeArabic(text)
Cleans Arabic text for search indexing or comparison.
text(string): The input string to normalize.- Returns (string): Normalized string with standard characters and no diacritics.
generateSlug(text)
Creates a URL-safe slug from Arabic and English text.
text(string): The title to convert.- Returns (string): Hyphen-separated string.
convertDigits(input, toArabicIndic)
Converts digit representation within string text.
input(string|number): The text containing digits to convert.toArabicIndic(boolean): Iftrue, converts to ٠-٩; iffalse, converts to 0-9.- Returns (string): The converted string.
Real-World Use Cases
Localizing search databases requires flexible normalization to capture different input forms. For example, transforming a query for soundcore r50i wireless earbuds into an optimized slug helps search engines index product landing pages more effectively.
Similarly, developers integrating the WooCommerce REST API can sanitize product catalogs programmatically, ensuring compatibility with other brand pages like the official Anker website or product specifications on soundcore.com.
Contributing
Contributions, issues, and feature requests are welcome. Feel free to open a pull request on the repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
