Website Russian Localization Setup
Russian localization is not just text translation. It requires proper handling of grammatical cases and numerals, date and currency formatting according to Russian standards, phone number formatting, and correct character encoding in the database.
Server-side Localization: Laravel
// config/app.php
'locale' => 'ru',
'fallback_locale' => 'en',
'faker_locale' => 'ru_RU',
// resources/lang/ru/validation.php — override validation messages
return [
'required' => 'The field «:attribute» is required.',
'email' => 'The field «:attribute» must contain a valid email address.',
'min' => [
'string' => 'The field «:attribute» must contain at least :min characters.',
],
'unique' => 'The value for field «:attribute» already exists.',
// ...
'attributes' => [
'email' => 'email',
'password' => 'password',
'name' => 'name',
'phone' => 'phone',
],
];
Plural Forms
Russian requires three forms: "1 товар", "2 товара", "5 товаров".
// Helper for plural forms
function plural(int $n, string $one, string $few, string $many): string
{
$abs = abs($n);
$mod10 = $abs % 10;
$mod100 = $abs % 100;
if ($mod100 >= 11 && $mod100 <= 19) return "$n $many";
if ($mod10 === 1) return "$n $one";
if ($mod10 >= 2 && $mod10 <= 4) return "$n $few";
return "$n $many";
}
// Usage
echo plural(1, 'item', 'items', 'items'); // 1 item
echo plural(3, 'item', 'items', 'items'); // 3 items
echo plural(11, 'item', 'items', 'items'); // 11 items
echo plural(21, 'item', 'items', 'items'); // 21 item
Same implementation on the frontend using Intl.PluralRules:
const rules = new Intl.PluralRules('ru')
const forms: Record<string, string> = {
one: 'item',
few: 'items',
many: 'items',
other: 'items',
}
function pluralize(n: number): string {
return `${n} ${forms[rules.select(n)]}`
}
pluralize(1) // "1 item"
pluralize(22) // "22 items"
pluralize(100) // "100 items"
Date and Number Formatting
// Date in Russian
const dateFormatter = new Intl.DateTimeFormat('ru-RU', {
day: 'numeric',
month: 'long',
year: 'numeric',
})
dateFormatter.format(new Date()) // "28 марта 2026 г."
// Numbers only
new Intl.DateTimeFormat('ru-RU').format(new Date()) // "28.03.2026"
// Relative time
const rtf = new Intl.RelativeTimeFormat('ru', { numeric: 'auto' })
rtf.format(-2, 'day') // "2 days ago"
rtf.format(-5, 'day') // "5 days ago"
rtf.format(1, 'hour') // "in 1 hour"
// Currency
new Intl.NumberFormat('ru-RU', {
style: 'currency',
currency: 'RUB',
maximumFractionDigits: 0,
}).format(14990) // "14 990 ₽"
Phone Numbers
// Format Russian phone numbers
function formatRuPhone(value: string): string {
const digits = value.replace(/\D/g, '')
const normalized = digits.startsWith('8') ? '7' + digits.slice(1) : digits
if (normalized.length !== 11 || !normalized.startsWith('7')) return value
return `+7 (${normalized.slice(1, 4)}) ${normalized.slice(4, 7)}-${normalized.slice(7, 9)}-${normalized.slice(9)}`
}
formatRuPhone('89161234567') // "+7 (916) 123-45-67"
Database: Character Encoding
PostgreSQL and MySQL must use UTF-8. Check with:
-- PostgreSQL
SHOW server_encoding; -- UTF8
SHOW client_encoding; -- UTF8
SELECT datcollate FROM pg_database WHERE datname = current_database();
-- ru_RU.UTF-8 or en_US.UTF-8 (both correct for Cyrillic)
-- MySQL
SHOW VARIABLES LIKE 'character_set%';
-- character_set_database: utf8mb4
-- character_set_server: utf8mb4
Laravel .env for MySQL:
DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
Meta-tags and HTML
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="description" content="...">
<!-- Open Graph for social networks -->
<meta property="og:locale" content="ru_RU">
</head>
Timeline
Locale setup, validation translations, formatting — 1 working day.







