feat(i18n): add full Arabic (ar) translation
Adds a complete Arabic locale (2759 keys, full parity with en) and wires it into routing, RTL direction detection, message loading, the language switcher, and flag icons alongside the existing he/fa RTL locales.
This commit is contained in:
@@ -274,6 +274,18 @@ const skCross =
|
||||
" 7.22 49.54 7.11-.62-20.5-6.6-46.33-6.6-46.33s12.3.96 17.22.96c4.92 0" +
|
||||
" 17.21-.96 17.21-.96s-5.97 25.83-6.6 46.33c12.18.1 29.72-.49 49.55-7.11" +
|
||||
" 0 0-.62 8.3-.62 17.98 0 9.67.62 17.98.62 17.98-19.86-6.64-37.42-7.22-49.6-7.12v32.37";
|
||||
/** Arabic – Pan-Arab colours (black/white/green horizontal, red hoist triangle) */
|
||||
export function FlagArab(props: FlagProps) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 4" width={W} height={H} className={flagClass} {...props}>
|
||||
<rect width="6" height="4" fill="#fff" />
|
||||
<rect width="6" height="1.33" fill="#000" />
|
||||
<rect y="2.67" width="6" height="1.33" fill="#007A3D" />
|
||||
<polygon points="0,0 2.4,2 0,4" fill="#CE1126" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
const skHills =
|
||||
"M270 329.1c-24.87 0-38.19 34.46-38.19 34.46s-7.4-16.34-27.68-16.34" +
|
||||
"c-13.73 0-23.82 12.2-30.25 23.5 24.97 39.7 64.8 64.2 96.11 79.28" +
|
||||
@@ -319,4 +331,5 @@ export const flagComponents: Record<string, (props: FlagProps) => ReactElement>
|
||||
zh: FlagCN,
|
||||
fa: FlagIR,
|
||||
he: FlagIL,
|
||||
ar: FlagArab,
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ import { flagComponents } from './flag-icons';
|
||||
|
||||
const languages = [
|
||||
{ value: 'auto', label: 'Auto' },
|
||||
{ value: 'ar', label: 'العربية' },
|
||||
{ value: 'cs', label: 'Česky' },
|
||||
{ value: 'sk', label: 'Slovenčina' },
|
||||
{ value: 'da', label: 'Dansk' },
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// RTL locales: Hebrew (he) and Persian/Farsi (fa). Everything else is LTR.
|
||||
const rtlLocales = new Set(['he', 'fa']);
|
||||
// RTL locales: Arabic (ar), Hebrew (he), and Persian/Farsi (fa). Everything else is LTR.
|
||||
const rtlLocales = new Set(['ar', 'he', 'fa']);
|
||||
|
||||
export function getLocaleDirection(locale: string): 'ltr' | 'rtl' {
|
||||
return rtlLocales.has(locale) ? 'rtl' : 'ltr';
|
||||
|
||||
@@ -33,6 +33,9 @@ export default getRequestConfig(async ({ requestLocale }) => {
|
||||
// Use static imports for better compatibility
|
||||
let messages;
|
||||
switch (locale) {
|
||||
case 'ar':
|
||||
messages = (await import('../locales/ar/common.json')).default;
|
||||
break;
|
||||
case 'cs':
|
||||
messages = (await import('../locales/cs/common.json')).default;
|
||||
break;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ const localePrefix = (process.env.NEXT_PUBLIC_LOCALE_PREFIX ?? 'never') as
|
||||
| 'always'
|
||||
| 'as-needed';
|
||||
|
||||
const SUPPORTED_LOCALES = ['cs', 'da', 'de', 'en', 'es', 'fa', 'fr', 'he', 'hu', 'it', 'ja', 'ko', 'lv', 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', 'tr', 'uk', 'zh'] as const;
|
||||
const SUPPORTED_LOCALES = ['ar', 'cs', 'da', 'de', 'en', 'es', 'fa', 'fr', 'he', 'hu', 'it', 'ja', 'ko', 'lv', 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', 'tr', 'uk', 'zh'] as const;
|
||||
|
||||
// Fallback locale used when the visitor's Accept-Language header does not
|
||||
// match any supported locale (and no NEXT_LOCALE cookie is set yet). Admins
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user