adula 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -18
- package/build/agent/AGENTS.template.md +4 -4
- package/build/agent/capabilities.md +22 -11
- package/build/agent/skills/adula-frontend-design/SKILL.md +1 -1
- package/build/agent/skills/idea-review/SKILL.md +2 -2
- package/build/commands/adula_outbox.d.ts +10 -0
- package/build/commands/adula_outbox.js +11 -0
- package/build/commands/adula_restore_reconcile.d.ts +10 -0
- package/build/commands/adula_restore_reconcile.js +34 -0
- package/build/commands/adula_runtime_health.d.ts +10 -0
- package/build/commands/adula_runtime_health.js +27 -0
- package/build/commands/adula_uploads_prune.d.ts +10 -0
- package/build/commands/adula_uploads_prune.js +16 -0
- package/build/commands/app.d.ts +10 -0
- package/build/commands/app.js +64 -0
- package/build/commands/backup_create.d.ts +11 -0
- package/build/commands/backup_create.js +99 -0
- package/build/commands/backup_restore_files.d.ts +11 -0
- package/build/commands/backup_restore_files.js +44 -0
- package/build/commands/backup_restore_test.d.ts +12 -0
- package/build/commands/backup_restore_test.js +185 -0
- package/build/commands/backup_services.d.ts +31 -0
- package/build/commands/backup_services.js +6 -0
- package/build/commands/backup_verify.d.ts +9 -0
- package/build/commands/backup_verify.js +59 -0
- package/build/commands/backup_verify_snapshot.d.ts +10 -0
- package/build/commands/backup_verify_snapshot.js +37 -0
- package/build/commands/client.d.ts +16 -0
- package/build/commands/client.js +71 -0
- package/build/commands/doctor.js +4 -1
- package/build/commands/install.d.ts +8 -0
- package/build/commands/install.js +63 -45
- package/build/commands/main.d.ts +3 -2
- package/build/commands/main.js +26 -0
- package/build/commands/module_add.js +4 -20
- package/build/commands/resource.d.ts +2 -0
- package/build/commands/resource.js +12 -3
- package/build/commands/resource_migration.d.ts +15 -0
- package/build/commands/resource_migration.js +72 -0
- package/build/commands/resource_snapshot.d.ts +2 -0
- package/build/commands/resource_snapshot.js +3 -0
- package/build/commands/sla_evaluate.d.ts +14 -0
- package/build/commands/sla_evaluate.js +16 -0
- package/build/commands/ui.js +4 -2
- package/build/commands/ui_css.d.ts +9 -0
- package/build/commands/ui_css.js +19 -0
- package/build/commands/upgrade.d.ts +1 -1
- package/build/commands/upgrade.js +1 -1
- package/build/configure.js +1 -1
- package/build/database/migrations/1770000000020_two_factor.d.ts +5 -0
- package/build/database/migrations/1770000000020_two_factor.js +10 -0
- package/build/database/migrations/1770000000041_import_modes.d.ts +5 -0
- package/build/database/migrations/1770000000041_import_modes.js +10 -0
- package/build/database/migrations/1770000000042_sync_jobs.d.ts +5 -0
- package/build/database/migrations/1770000000042_sync_jobs.js +10 -0
- package/build/database/migrations/1770000000043_notification_channels.d.ts +5 -0
- package/build/database/migrations/1770000000043_notification_channels.js +10 -0
- package/build/database/migrations/1770000000044_channel_confirmations.d.ts +5 -0
- package/build/database/migrations/1770000000044_channel_confirmations.js +10 -0
- package/build/database/migrations/1770000000045_import_leases.d.ts +5 -0
- package/build/database/migrations/1770000000045_import_leases.js +10 -0
- package/build/database/migrations/1770000000046_workflow_delegation_sla.d.ts +5 -0
- package/build/database/migrations/1770000000046_workflow_delegation_sla.js +10 -0
- package/build/database/migrations/1770000000049_print_templates.d.ts +5 -0
- package/build/database/migrations/1770000000049_print_templates.js +10 -0
- package/build/index.d.ts +56 -10
- package/build/index.js +34 -6
- package/build/providers/adula_provider.d.ts +2 -0
- package/build/providers/adula_provider.js +7 -0
- package/build/src/admin/contracts.js +1 -1
- package/build/src/admin/controller.d.ts +14 -1
- package/build/src/admin/controller.js +77 -13
- package/build/src/admin/errors.d.ts +32 -0
- package/build/src/admin/errors.js +63 -1
- package/build/src/admin/presentation.d.ts +21 -2
- package/build/src/admin/resource/editor.d.ts +59 -0
- package/build/src/admin/resource/editor.js +323 -0
- package/build/src/admin/resource/export.d.ts +37 -0
- package/build/src/admin/resource/export.js +181 -0
- package/build/src/admin/resource/lifecycle.d.ts +21 -0
- package/build/src/admin/resource/lifecycle.js +91 -0
- package/build/src/admin/resource/query.d.ts +100 -0
- package/build/src/admin/resource/query.js +508 -0
- package/build/src/admin/resource/read.d.ts +106 -0
- package/build/src/admin/resource/read.js +327 -0
- package/build/src/admin/resource/shared.d.ts +77 -0
- package/build/src/admin/resource/shared.js +222 -0
- package/build/src/admin/resource/trash.d.ts +10 -0
- package/build/src/admin/resource/trash.js +56 -0
- package/build/src/admin/resource/write.d.ts +57 -0
- package/build/src/admin/resource/write.js +574 -0
- package/build/src/admin/resource_service.d.ts +66 -193
- package/build/src/admin/resource_service.js +69 -1345
- package/build/src/attachments/attachment_service.d.ts +46 -2
- package/build/src/attachments/attachment_service.js +96 -4
- package/build/src/auth/conditions.d.ts +5 -0
- package/build/src/auth/conditions.js +26 -3
- package/build/src/auth/sql.js +17 -5
- package/build/src/auth/two_factor.d.ts +96 -0
- package/build/src/auth/two_factor.js +259 -0
- package/build/src/collaboration/assignments.d.ts +36 -1
- package/build/src/collaboration/assignments.js +132 -66
- package/build/src/collaboration/record_collaboration.d.ts +2 -3
- package/build/src/collaboration/record_collaboration.js +19 -16
- package/build/src/collaboration/shared.d.ts +16 -0
- package/build/src/collaboration/shared.js +21 -0
- package/build/src/commands/app_scaffold.d.ts +72 -0
- package/build/src/commands/app_scaffold.js +285 -0
- package/build/src/commands/capabilities.js +34 -8
- package/build/src/commands/doctor.d.ts +14 -2
- package/build/src/commands/doctor.js +50 -5
- package/build/src/commands/gap_report.d.ts +1 -1
- package/build/src/commands/gap_report.js +2 -2
- package/build/src/commands/generator.d.ts +37 -1
- package/build/src/commands/generator.js +61 -18
- package/build/src/commands/snapshot.d.ts +10 -13
- package/build/src/commands/snapshot.js +31 -14
- package/build/src/commands/source_markers.d.ts +10 -0
- package/build/src/commands/source_markers.js +29 -0
- package/build/src/core/activity.d.ts +2 -0
- package/build/src/core/activity.js +7 -1
- package/build/src/core/administrators.d.ts +38 -0
- package/build/src/core/administrators.js +129 -0
- package/build/src/core/html_sanitizer.d.ts +20 -0
- package/build/src/core/html_sanitizer.js +261 -0
- package/build/src/core/like.d.ts +5 -0
- package/build/src/core/like.js +5 -0
- package/build/src/core/lookups.d.ts +80 -0
- package/build/src/core/lookups.js +319 -0
- package/build/src/core/message_templates.d.ts +7 -2
- package/build/src/core/message_templates.js +72 -11
- package/build/src/core/module_seed.js +2 -1
- package/build/src/core/notification_channels.d.ts +235 -0
- package/build/src/core/notification_channels.js +660 -0
- package/build/src/core/roles.js +2 -2
- package/build/src/core/saved_views.d.ts +8 -1
- package/build/src/core/saved_views.js +36 -2
- package/build/src/core/sequences.d.ts +32 -0
- package/build/src/core/sequences.js +97 -0
- package/build/src/core/settings.d.ts +5 -0
- package/build/src/core/settings.js +19 -2
- package/build/src/core/template_language.d.ts +61 -0
- package/build/src/core/template_language.js +141 -0
- package/build/src/core/ui_preferences.d.ts +4 -0
- package/build/src/core/ui_preferences.js +4 -1
- package/build/src/core/user_invitations.d.ts +5 -1
- package/build/src/core/user_invitations.js +7 -1
- package/build/src/core/users.js +1 -1
- package/build/src/database/calendar_days.d.ts +19 -0
- package/build/src/database/calendar_days.js +36 -0
- package/build/src/database/schema.d.ts +155 -2
- package/build/src/database/schema.js +531 -59
- package/build/src/database/schema_diff.d.ts +56 -0
- package/build/src/database/schema_diff.js +157 -0
- package/build/src/events/record_mutation.d.ts +2 -1
- package/build/src/events/record_mutation.js +1 -0
- package/build/src/integrations/api_client.d.ts +37 -0
- package/build/src/integrations/api_client.js +552 -0
- package/build/src/integrations/import_adapters.d.ts +37 -0
- package/build/src/integrations/import_adapters.js +35 -0
- package/build/src/integrations/imports.d.ts +118 -16
- package/build/src/integrations/imports.js +406 -73
- package/build/src/integrations/openapi.d.ts +3 -1
- package/build/src/integrations/openapi.js +454 -31
- package/build/src/integrations/outbound.d.ts +51 -0
- package/build/src/integrations/outbound.js +195 -0
- package/build/src/integrations/print.d.ts +21 -1
- package/build/src/integrations/print.js +63 -21
- package/build/src/integrations/print_templates.d.ts +216 -0
- package/build/src/integrations/print_templates.js +1015 -0
- package/build/src/integrations/sync_jobs.d.ts +139 -0
- package/build/src/integrations/sync_jobs.js +416 -0
- package/build/src/integrations/webhooks.d.ts +12 -12
- package/build/src/integrations/webhooks.js +34 -43
- package/build/src/languages/ar.d.ts +11 -0
- package/build/src/languages/ar.js +336 -0
- package/build/src/languages/ar_ui.d.ts +332 -0
- package/build/src/languages/ar_ui.js +333 -0
- package/build/src/languages/catalog.d.ts +66 -0
- package/build/src/languages/catalog.js +152 -0
- package/build/src/languages/en.d.ts +7 -0
- package/build/src/languages/en.js +330 -0
- package/build/src/languages/en_ui.d.ts +3 -0
- package/build/src/languages/en_ui.js +328 -0
- package/build/src/languages/validation.d.ts +26 -0
- package/build/src/languages/validation.js +60 -0
- package/build/src/lists/bulk_actions.d.ts +89 -0
- package/build/src/lists/bulk_actions.js +268 -0
- package/build/src/lists/dashboards.d.ts +96 -0
- package/build/src/lists/dashboards.js +241 -0
- package/build/src/mcp/tools.js +1 -1
- package/build/src/resource/define_resource.d.ts +18 -1
- package/build/src/resource/define_resource.js +205 -18
- package/build/src/resource/definition.d.ts +44 -0
- package/build/src/resource/definition.js +171 -0
- package/build/src/resource/registry.js +15 -4
- package/build/src/resource/types.d.ts +304 -16
- package/build/src/resource/values.d.ts +56 -1
- package/build/src/resource/values.js +237 -5
- package/build/src/services/settings.d.ts +2 -0
- package/build/src/services/settings.js +5 -1
- package/build/src/upgrade/legacy.js +2 -2
- package/build/src/workflows/calendar.d.ts +9 -0
- package/build/src/workflows/calendar.js +44 -0
- package/build/src/workflows/define_workflow.d.ts +48 -3
- package/build/src/workflows/define_workflow.js +57 -13
- package/build/src/workflows/delegations.d.ts +93 -0
- package/build/src/workflows/delegations.js +287 -0
- package/build/src/workflows/engine.d.ts +69 -4
- package/build/src/workflows/engine.js +441 -83
- package/build/src/workflows/sla.d.ts +15 -0
- package/build/src/workflows/sla.js +8 -0
- package/build/stubs/resource_contract.txt +12 -1
- package/package.json +5 -2
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface strings rendered by the reference application and the @adula/ui
|
|
3
|
+
* registry. Components keep their Arabic text and look it up through the
|
|
4
|
+
* `messages` page prop (Arabic text → translation), so the Arabic here must match
|
|
5
|
+
* the component text exactly; a mismatch only means the Arabic is shown.
|
|
6
|
+
*/
|
|
7
|
+
export const arabicInterfaceMessages = {
|
|
8
|
+
'ui.language.title': 'لغة الواجهة',
|
|
9
|
+
'ui.language.description': 'العربية هي لغة النظام الأساسية. اختر لغة أخرى لواجهتك إن أتاحها المسؤول.',
|
|
10
|
+
'ui.language.save': 'حفظ اللغة',
|
|
11
|
+
'ui.record.detailsTitle': 'تفاصيل · {resource}',
|
|
12
|
+
'ui.record.addNamed': 'إضافة {record}',
|
|
13
|
+
'ui.record.editNamed': 'تعديل {record}',
|
|
14
|
+
'ui.record.addTitle': 'إضافة · {resource}',
|
|
15
|
+
'ui.record.editTitle': 'تعديل · {resource}',
|
|
16
|
+
'ui.record.add': 'إضافة سجل',
|
|
17
|
+
'ui.resource.subtitle': 'سجلاتك ومتابعتك اليومية في مكان واحد.',
|
|
18
|
+
'ui.record.formDescription': 'أكمل الحقول المطلوبة ثم احفظ السجل.',
|
|
19
|
+
'ui.record.showDescription': 'راجع التفاصيل المتاحة لك وأكمل عملك.',
|
|
20
|
+
'ui.form.reviewFields': 'راجع الحقول المحددة ثم أعد المحاولة.',
|
|
21
|
+
'ui.form.addedNamed': 'تمت إضافة {record}',
|
|
22
|
+
'ui.form.added': 'تمت إضافة السجل',
|
|
23
|
+
'ui.form.saved': 'تم حفظ التعديلات',
|
|
24
|
+
'ui.form.conflictMessage': 'تغير السجل منذ فتحه. احتفظ بتعديلاتك ثم أعد تحميل الصفحة.',
|
|
25
|
+
'ui.form.saveFailedMessage': 'تعذر الحفظ. راجع البيانات وحاول مجدداً.',
|
|
26
|
+
'ui.form.conflictTitle': 'تعارض في الإصدار',
|
|
27
|
+
'ui.form.saveFailed': 'تعذر الحفظ',
|
|
28
|
+
'ui.common.reload': 'إعادة التحميل',
|
|
29
|
+
'ui.form.details': 'تفاصيل السجل',
|
|
30
|
+
'ui.form.requiredHint': 'الحقول المتاحة بحسب صلاحياتك · الحقول المعلّمة بـ {mark} مطلوبة',
|
|
31
|
+
'ui.form.orgUnit': 'الوحدة التنظيمية',
|
|
32
|
+
'ui.common.cancel': 'إلغاء',
|
|
33
|
+
'ui.form.saving': 'جارٍ الحفظ...',
|
|
34
|
+
'ui.form.save': 'حفظ السجل',
|
|
35
|
+
'ui.validation.required': 'هذا الحقل مطلوب',
|
|
36
|
+
'ui.validation.money': 'أدخل مبلغاً بخانتين عشريتين كحد أقصى',
|
|
37
|
+
'ui.validation.integer': 'أدخل عدداً صحيحاً',
|
|
38
|
+
'ui.validation.json': 'أدخل بيانات JSON صحيحة',
|
|
39
|
+
'ui.validation.datetime': 'أدخل تاريخاً ووقتاً صحيحين',
|
|
40
|
+
'ui.validation.decimal': 'أدخل رقماً عشرياً صحيحاً',
|
|
41
|
+
'ui.validation.decimalScale': 'عدد المنازل العشرية أكثر من المسموح',
|
|
42
|
+
'ui.validation.dateFormat': 'أدخل التاريخ بصيغة سنة-شهر-يوم',
|
|
43
|
+
'ui.validation.gregorianDate': 'التاريخ الميلادي غير صالح',
|
|
44
|
+
'ui.validation.hijriRange': 'اختر تاريخ أم القرى بين عامي 1300 و1600 هـ',
|
|
45
|
+
'ui.validation.hijriDay': 'هذا اليوم غير موجود في تقويم أم القرى',
|
|
46
|
+
'ui.actions.delete': 'حذف السجل',
|
|
47
|
+
'ui.actions.submit': 'اعتماد المستند',
|
|
48
|
+
'ui.actions.cancel': 'إلغاء الاعتماد',
|
|
49
|
+
'ui.actions.amend': 'تعديل بالنسخ',
|
|
50
|
+
'ui.actions.deleteDescription': 'سيُخفى السجل من القوائم ولن يمكن تعديله بعد الحذف.',
|
|
51
|
+
'ui.actions.submitDescription': 'بعد الاعتماد لا يمكن تعديل المستند أو بنوده.',
|
|
52
|
+
'ui.actions.cancelDescription': 'سيُعاد المستند إلى حالة الإلغاء ولن يُحتسب.',
|
|
53
|
+
'ui.actions.amendDescription': 'تُنشأ مسودة جديدة منسوخة من هذا المستند الملغي مع بنوده، ويبقى الأصل كما هو.',
|
|
54
|
+
'ui.actions.deleted': 'تم حذف السجل',
|
|
55
|
+
'ui.actions.submitted': 'تم اعتماد المستند',
|
|
56
|
+
'ui.actions.cancelled': 'تم إلغاء الاعتماد',
|
|
57
|
+
'ui.actions.amended': 'تم تعديل بالنسخ',
|
|
58
|
+
'ui.actions.connectionFailed': 'تعذر الاتصال بالخادم. حاول مجدداً.',
|
|
59
|
+
'ui.actions.conflict': 'تغير السجل منذ فتحه. أعد تحميل الصفحة قبل المتابعة.',
|
|
60
|
+
'ui.actions.failed': 'تعذر تنفيذ الإجراء. تحقق من صلاحياتك وحاول مجدداً.',
|
|
61
|
+
'ui.common.back': 'تراجع',
|
|
62
|
+
'ui.actions.running': 'جارٍ التنفيذ...',
|
|
63
|
+
'ui.common.confirm': 'تأكيد',
|
|
64
|
+
'ui.confirm.title': 'تأكيد الإجراء',
|
|
65
|
+
'ui.confirm.change': 'تأكيد التغيير',
|
|
66
|
+
'ui.pagination.label': 'التنقل بين الصفحات',
|
|
67
|
+
'ui.pagination.previousPage': 'الصفحة السابقة',
|
|
68
|
+
'ui.pagination.previous': 'السابق',
|
|
69
|
+
'ui.pagination.nextPage': 'الصفحة التالية',
|
|
70
|
+
'ui.pagination.next': 'التالي',
|
|
71
|
+
'ui.pagination.more': 'صفحات أخرى',
|
|
72
|
+
'ui.dialog.closeFormTitle': 'إغلاق النموذج؟',
|
|
73
|
+
'ui.dialog.closeFormDescription': 'قد تفقد التغييرات التي لم تحفظها. يمكنك متابعة التحرير أو إغلاق النموذج.',
|
|
74
|
+
'ui.dialog.keepEditing': 'متابعة التحرير',
|
|
75
|
+
'ui.dialog.closeWithoutSaving': 'إغلاق دون حفظ',
|
|
76
|
+
'ui.common.close': 'إغلاق',
|
|
77
|
+
'ui.surface.backToList': 'العودة إلى القائمة',
|
|
78
|
+
'ui.activity.create': 'إنشاء السجل',
|
|
79
|
+
'ui.record.edit': 'تعديل السجل',
|
|
80
|
+
'ui.activity.amend': 'تعديل بعد الاعتماد',
|
|
81
|
+
'ui.activity.assignmentClosed': 'إغلاق مهمة مع السجل',
|
|
82
|
+
'ui.status.submitted': 'معتمد',
|
|
83
|
+
'ui.status.cancelled': 'ملغي',
|
|
84
|
+
'ui.status.draft': 'مسودة',
|
|
85
|
+
'ui.show.print': 'طباعة',
|
|
86
|
+
'ui.show.lines': 'البنود',
|
|
87
|
+
'ui.show.lineCount': '{count} بند',
|
|
88
|
+
'ui.show.linesTruncated': 'تظهر أول 100 بند متاح',
|
|
89
|
+
'ui.show.noLines': 'لا توجد بنود متاحة.',
|
|
90
|
+
'ui.show.activity': 'سجل النشاط',
|
|
91
|
+
'ui.show.activityCount': 'آخر {count} إجراء',
|
|
92
|
+
'ui.show.userNumber': 'مستخدم #{id}',
|
|
93
|
+
'ui.show.activityFields': 'الحقول: {fields}',
|
|
94
|
+
'ui.common.listSeparator': '، ',
|
|
95
|
+
'ui.show.noActivity': 'لا يوجد نشاط مسجل بعد.',
|
|
96
|
+
'ui.common.loadingSection': 'جارٍ تحميل {section}',
|
|
97
|
+
'ui.field.chooseValue': 'اختر قيمة',
|
|
98
|
+
'ui.common.yes': 'نعم',
|
|
99
|
+
'ui.common.no': 'لا',
|
|
100
|
+
'ui.field.entryCalendar': 'تقويم الإدخال: {field}',
|
|
101
|
+
'ui.field.gregorianEntry': 'إدخال ميلادي',
|
|
102
|
+
'ui.field.hijriEntry': 'إدخال هجري',
|
|
103
|
+
'ui.field.calendar': 'التقويم: {field}',
|
|
104
|
+
'ui.field.hijriUmmAlQura': 'هجري · أم القرى',
|
|
105
|
+
'ui.field.gregorianEquivalent': '({date} ميلادي)',
|
|
106
|
+
'ui.field.hijriEquivalent': 'الموافق هجريًا:',
|
|
107
|
+
'ui.field.hijriSuffix': 'هـ',
|
|
108
|
+
'ui.field.time': 'الوقت: {field}',
|
|
109
|
+
'ui.field.formatJson': 'تنسيق JSON',
|
|
110
|
+
'ui.field.uploadFailed': 'تعذر رفع الملف. حاول مجدداً.',
|
|
111
|
+
'ui.field.connectionFailed': 'تعذر الاتصال بالخادم.',
|
|
112
|
+
'ui.field.replace': 'استبدال',
|
|
113
|
+
'ui.field.remove': 'إزالة',
|
|
114
|
+
'ui.field.chooseFile': 'اختيار ملف',
|
|
115
|
+
'ui.field.uploading': 'جارٍ الرفع {progress}%',
|
|
116
|
+
'ui.field.upload': 'رفع {field}',
|
|
117
|
+
'ui.field.optionsFailed': 'تعذر تحميل الخيارات',
|
|
118
|
+
'ui.field.chooseUser': 'اختر مستخدماً',
|
|
119
|
+
'ui.field.chooseRecord': 'اختر سجلاً',
|
|
120
|
+
'ui.field.searchByName': 'ابحث بالاسم',
|
|
121
|
+
'ui.field.searchRelated': 'ابحث في السجلات المرتبطة',
|
|
122
|
+
'ui.field.filterOptions': 'تصفية الخيارات',
|
|
123
|
+
'ui.field.searchIn': 'البحث في {field}',
|
|
124
|
+
'ui.common.searching': 'جارٍ البحث...',
|
|
125
|
+
'ui.field.noMatches': 'لا توجد سجلات مطابقة',
|
|
126
|
+
'ui.field.noSelection': 'بدون اختيار',
|
|
127
|
+
'ui.field.decimalPlaces': 'المنازل العشرية: {scale} على الأكثر',
|
|
128
|
+
'ui.field.noDecimalPlaces': 'عدد صحيح بلا منازل عشرية',
|
|
129
|
+
'ui.field.selectedCount': '{count} محدد',
|
|
130
|
+
'ui.field.chooseRecords': 'اختر سجلاً أو أكثر',
|
|
131
|
+
'ui.field.selectedIn': 'المحدد في {field}',
|
|
132
|
+
'ui.field.removeRecord': 'إزالة {record}',
|
|
133
|
+
'ui.field.required': 'مطلوب',
|
|
134
|
+
'ui.common.loading': 'جارٍ التحميل...',
|
|
135
|
+
'ui.common.more': 'المزيد',
|
|
136
|
+
'ui.inline.empty': 'لا توجد بنود بعد',
|
|
137
|
+
'ui.inline.truncated': 'تظهر أول 100 بند فقط',
|
|
138
|
+
'ui.inline.add': 'إضافة بند',
|
|
139
|
+
'ui.inline.actions': 'الإجراء',
|
|
140
|
+
'ui.inline.row': 'بند {number}',
|
|
141
|
+
'ui.inline.fieldForRow': '{field} للبند {number}',
|
|
142
|
+
'ui.inline.removeRow': 'إزالة البند {number}',
|
|
143
|
+
'ui.inline.undoDelete': 'التراجع عن حذف البند {number}',
|
|
144
|
+
'ui.inline.deleteRow': 'حذف البند {number}',
|
|
145
|
+
'ui.value.bytes': '{size} بايت',
|
|
146
|
+
'ui.value.percent': '٪',
|
|
147
|
+
'ui.value.kilobytes': '{size} ك.ب',
|
|
148
|
+
'ui.value.megabytes': '{size} م.ب',
|
|
149
|
+
'ui.value.attachment': 'مرفق',
|
|
150
|
+
'ui.value.currency': 'ر.س',
|
|
151
|
+
'ui.table.listOf': 'قائمة {resource}',
|
|
152
|
+
'ui.table.recordsOf': 'سجل {resource}',
|
|
153
|
+
'ui.table.shown': '{count} معروض',
|
|
154
|
+
'ui.table.estimate': 'نحو {count} سجل ضمن نطاقك',
|
|
155
|
+
'ui.table.scope': 'حسب نطاق صلاحياتك',
|
|
156
|
+
'ui.table.export': 'تصدير المعروض',
|
|
157
|
+
'ui.table.searchPlaceholder': 'ابحث في السجلات...',
|
|
158
|
+
'ui.table.filter': 'تصفية',
|
|
159
|
+
'ui.table.clearFilters': 'مسح التصفية',
|
|
160
|
+
'ui.table.nextFailed': 'تعذر تحميل السجلات التالية. أعد المحاولة.',
|
|
161
|
+
'ui.table.networkFailed': 'تعذر الاتصال بالخادم. تحقق من الاتصال ثم أعد المحاولة.',
|
|
162
|
+
'ui.table.loadingMore': 'جارٍ تحميل المزيد...',
|
|
163
|
+
'ui.table.loadMore': 'تحميل المزيد',
|
|
164
|
+
'ui.table.end': 'نهاية السجلات',
|
|
165
|
+
'ui.table.actions': 'الإجراءات',
|
|
166
|
+
'ui.table.viewRecord': 'عرض السجل {id}',
|
|
167
|
+
'ui.table.view': 'عرض',
|
|
168
|
+
'ui.table.editRecord': 'تعديل السجل {id}',
|
|
169
|
+
'ui.table.edit': 'تعديل',
|
|
170
|
+
'ui.table.record': 'السجل {id}',
|
|
171
|
+
'ui.table.emptyFiltered': 'غيّر البحث أو التصفية لعرض سجلات أخرى.',
|
|
172
|
+
'ui.table.empty': 'لم تُضف سجلات ضمن نطاقك بعد.',
|
|
173
|
+
'ui.views.saveFailed': 'تعذر حفظ العرض.',
|
|
174
|
+
'ui.views.deleteFailed': 'تعذر حذف العرض.',
|
|
175
|
+
'ui.views.title': 'العروض المحفوظة',
|
|
176
|
+
'ui.views.empty': 'لا عروض بعد',
|
|
177
|
+
'ui.views.shared': 'مشترك',
|
|
178
|
+
'ui.views.delete': 'حذف العرض {name}',
|
|
179
|
+
'ui.views.name': 'اسم العرض',
|
|
180
|
+
'ui.common.save': 'حفظ',
|
|
181
|
+
'ui.views.saveCurrent': 'حفظ العرض الحالي',
|
|
182
|
+
'ui.table.all': 'الكل',
|
|
183
|
+
'ui.table.filterField': 'تصفية {field}',
|
|
184
|
+
'ui.table.pressEnter': 'اضغط Enter للتطبيق',
|
|
185
|
+
'ui.admin.peopleAndPermissions': 'الأشخاص والصلاحيات',
|
|
186
|
+
'ui.admin.users': 'المستخدمون',
|
|
187
|
+
'ui.admin.roles': 'الأدوار والصلاحيات',
|
|
188
|
+
'ui.admin.orgUnits': 'الهيكل التنظيمي',
|
|
189
|
+
'ui.admin.sessions': 'الجلسات',
|
|
190
|
+
'ui.admin.settings': 'الإعدادات',
|
|
191
|
+
'ui.admin.templates': 'قوالب الرسائل',
|
|
192
|
+
'ui.admin.webhooks': 'الربط الخارجي',
|
|
193
|
+
'ui.admin.monitoring': 'المراقبة والتشغيل',
|
|
194
|
+
'ui.admin.jobs': 'تشغيل النظام',
|
|
195
|
+
'ui.admin.workflows': 'تدفقات فاشلة',
|
|
196
|
+
'ui.admin.setup': 'الإعداد الأولي',
|
|
197
|
+
'ui.admin.title': 'الإدارة',
|
|
198
|
+
'ui.admin.alerts': '{count} تنبيه إداري',
|
|
199
|
+
'ui.admin.navigation': 'التنقل الإداري',
|
|
200
|
+
'ui.admin.impersonating': 'أنت تتصفح باسم {name}',
|
|
201
|
+
'ui.admin.stopImpersonating': 'إنهاء الانتحال',
|
|
202
|
+
'ui.workspace.overview': 'نظرة عامة',
|
|
203
|
+
'ui.workspace.myTasks': 'مهامي',
|
|
204
|
+
'ui.workspace.imports': 'الاستيراد',
|
|
205
|
+
'ui.workspace.tagline': 'مساحة أعمالك، بوضوح',
|
|
206
|
+
'ui.workspace.dailyWork': 'العمل اليومي',
|
|
207
|
+
'ui.workspace.mainNavigation': 'التنقل الرئيسي',
|
|
208
|
+
'ui.workspace.open': '{count} مفتوحة',
|
|
209
|
+
'ui.workspace.inviteUser': 'دعوة مستخدم',
|
|
210
|
+
'ui.workspace.title': 'مساحة العمل',
|
|
211
|
+
'ui.workspace.trial': 'بيئة التجربة',
|
|
212
|
+
'ui.workspace.mobileNavigation': 'التنقل على الجوال',
|
|
213
|
+
'ui.errors.notFound': 'الصفحة غير موجودة',
|
|
214
|
+
'ui.errors.serverError': 'حدث خطأ غير متوقع',
|
|
215
|
+
'ui.auth.login': 'تسجيل الدخول',
|
|
216
|
+
'ui.auth.loginDescription': 'أدخل بيانات حسابك للمتابعة إلى مساحة العمل',
|
|
217
|
+
'ui.auth.email': 'البريد الإلكتروني',
|
|
218
|
+
'ui.auth.password': 'كلمة المرور',
|
|
219
|
+
'ui.auth.forgotPassword': 'نسيت كلمة المرور؟',
|
|
220
|
+
'ui.auth.submit': 'دخول',
|
|
221
|
+
'ui.auth.socialProviders': 'الدخول عبر مزوّد خارجي',
|
|
222
|
+
'ui.auth.orContinueWith': 'أو تابع عبر',
|
|
223
|
+
'ui.auth.signInWith': 'الدخول عبر {provider}',
|
|
224
|
+
'ui.auth.noAccount': 'ليس لديك حساب؟',
|
|
225
|
+
'ui.auth.createAccount': 'إنشاء حساب',
|
|
226
|
+
'ui.home.title': 'مساحة العمل · {app}',
|
|
227
|
+
'ui.home.description': 'وحدات أعمالك وإعدادات حسابك في مكان واحد.',
|
|
228
|
+
'ui.home.account': 'حسابي',
|
|
229
|
+
'ui.home.notifications': 'الإشعارات',
|
|
230
|
+
'ui.home.startSetup': 'بدء الإعداد الأولي',
|
|
231
|
+
'ui.home.manageSystem': 'إدارة النظام',
|
|
232
|
+
'ui.home.open': 'فتح {resource}',
|
|
233
|
+
'ui.home.empty': 'ستظهر هنا وحدات العمل المتاحة لحسابك.',
|
|
234
|
+
'ui.list.filterFailed': 'تعذر تطبيق التصفية. راجع القيم ثم أعد المحاولة.',
|
|
235
|
+
'ui.list.exportResults': 'تصدير النتائج',
|
|
236
|
+
'ui.list.exporting': 'جارٍ التصدير...',
|
|
237
|
+
'ui.list.exportFailed': 'تعذر تصدير النتائج. حاول مجدداً.',
|
|
238
|
+
'ui.list.activeFilters': 'التصفية المطبقة',
|
|
239
|
+
'ui.list.removeFilter': 'إزالة تصفية {field}',
|
|
240
|
+
'ui.list.rangeBoth': 'من {from} إلى {to}',
|
|
241
|
+
'ui.list.rangeFrom': 'من {from}',
|
|
242
|
+
'ui.list.rangeTo': 'إلى {to}',
|
|
243
|
+
'ui.list.empty': 'فارغ',
|
|
244
|
+
'ui.list.notEmpty': 'غير فارغ',
|
|
245
|
+
'ui.list.inLimit': 'يمكن اختيار {count} قيمة كحد أقصى.',
|
|
246
|
+
'ui.list.valueOf': 'قيمة {field}',
|
|
247
|
+
'ui.list.emptyValues': 'القيم الفارغة',
|
|
248
|
+
'ui.list.removeFilters': 'إزالة التصفية',
|
|
249
|
+
'ui.list.apply': 'تطبيق',
|
|
250
|
+
'ui.list.invalidValue': 'قيمة غير صالحة',
|
|
251
|
+
'ui.list.from': 'من',
|
|
252
|
+
'ui.list.to': 'إلى',
|
|
253
|
+
'ui.list.boundOf': '{bound} · {field}',
|
|
254
|
+
'ui.list.anyOf': 'أيٌّ من',
|
|
255
|
+
'ui.list.contains': 'يحتوي على',
|
|
256
|
+
'ui.list.unsupportedFilter': 'لا يدعم هذا الحقل هذا النوع من التصفية.',
|
|
257
|
+
'ui.list.searchOptions': 'ابحث في الخيارات',
|
|
258
|
+
'ui.list.noOptions': 'لا توجد خيارات مطابقة',
|
|
259
|
+
'ui.list.typeValue': 'اكتب قيمة ثم اضغط Enter',
|
|
260
|
+
'ui.list.removeValue': 'إزالة {value}',
|
|
261
|
+
'ui.list.selectAll': 'تحديد كل السجلات المعروضة',
|
|
262
|
+
'ui.list.selectRecord': 'تحديد السجل {id}',
|
|
263
|
+
'ui.bulk.title': 'الإجراءات الجماعية',
|
|
264
|
+
'ui.bulk.selected': 'تم تحديد {count}',
|
|
265
|
+
'ui.bulk.clear': 'إلغاء التحديد',
|
|
266
|
+
'ui.bulk.limit': 'يمكن تنفيذ الإجراء على {count} سجل كحد أقصى في كل مرة.',
|
|
267
|
+
'ui.bulk.perRow': 'يُتحقق من صلاحيتك لكل سجل على حدة.',
|
|
268
|
+
'ui.bulk.succeeded': 'نُفذ على {count} سجل',
|
|
269
|
+
'ui.bulk.failed': 'تعذر تنفيذ الإجراء على {count} سجل',
|
|
270
|
+
'ui.bulk.defined': 'سيُنفذ الإجراء «{action}» على {count} سجل محدد.',
|
|
271
|
+
'ui.bulk.delete': 'حذف',
|
|
272
|
+
'ui.bulk.restore': 'استعادة',
|
|
273
|
+
'ui.bulk.submit': 'اعتماد',
|
|
274
|
+
'ui.bulk.cancel': 'إلغاء المستند',
|
|
275
|
+
'ui.bulk.deleteDescription': 'سيُحذف {count} سجل محدد ويُخفى من القوائم.',
|
|
276
|
+
'ui.bulk.restoreDescription': 'سيُستعاد {count} سجل محذوف إلى السجلات النشطة.',
|
|
277
|
+
'ui.bulk.submitDescription': 'سيُعتمد {count} مستند محدد ولن يمكن تعديله بعد الاعتماد.',
|
|
278
|
+
'ui.bulk.cancelDescription': 'سيُلغى اعتماد {count} مستند محدد ولن يُحتسب.',
|
|
279
|
+
'ui.trash.title': 'المحذوفات',
|
|
280
|
+
'ui.trash.titleOf': 'المحذوفات · {resource}',
|
|
281
|
+
'ui.trash.listOf': 'المحذوفات من {resource}',
|
|
282
|
+
'ui.trash.subtitle': 'السجلات المحذوفة ضمن نطاقك؛ استعد ما تحتاجه منها إلى السجلات النشطة.',
|
|
283
|
+
'ui.trash.active': 'السجلات النشطة',
|
|
284
|
+
'ui.trash.empty': 'لا توجد سجلات محذوفة',
|
|
285
|
+
'ui.trash.emptyHint': 'تظهر هنا السجلات المحذوفة ضمن نطاقك لتستعيدها.',
|
|
286
|
+
'ui.trash.restoreRecord': 'استعادة {record}',
|
|
287
|
+
'ui.trash.restoreTitle': 'استعادة السجل',
|
|
288
|
+
'ui.trash.restoreDescription': 'سيعود {record} إلى السجلات النشطة ويظهر في القوائم.',
|
|
289
|
+
'ui.trash.restored': 'تمت استعادة السجل',
|
|
290
|
+
'ui.trash.restoreFailed': 'تعذر استعادة السجل. تحقق من صلاحياتك وحاول مجدداً.',
|
|
291
|
+
'ui.dashboard.scope': 'تُحسب الأرقام ضمن نطاق صلاحياتك',
|
|
292
|
+
'ui.dashboard.switcher': 'لوحات المؤشرات',
|
|
293
|
+
'ui.dashboard.none': 'لا توجد مؤشرات متاحة لك في هذه اللوحة',
|
|
294
|
+
'ui.dashboard.noneHint': 'تظهر المؤشرات التي تسمح صلاحياتك بقراءة سجلاتها.',
|
|
295
|
+
'ui.dashboard.totals': 'المؤشرات الإجمالية',
|
|
296
|
+
'ui.dashboard.grouped': 'المؤشرات حسب الفئة',
|
|
297
|
+
'ui.dashboard.noData': 'لا توجد بيانات ضمن نطاقك',
|
|
298
|
+
'ui.dashboard.noValue': 'بلا قيمة',
|
|
299
|
+
'ui.dashboard.meter': '{label}: {value}',
|
|
300
|
+
'ui.dashboard.truncated': 'تُعرض الفئات الأعلى قيمة فقط.',
|
|
301
|
+
'ui.dashboard.openRecords': 'فتح سجلات {label}',
|
|
302
|
+
'ui.attachment.preview': 'معاينة',
|
|
303
|
+
'ui.attachment.previewNamed': 'معاينة {name}',
|
|
304
|
+
'ui.attachment.previewDescription': 'معاينة المرفق. يمكنك تنزيله من الزر أدناه.',
|
|
305
|
+
'ui.attachment.download': 'تنزيل',
|
|
306
|
+
'ui.attachment.previewLoading': 'جارٍ تحميل المعاينة…',
|
|
307
|
+
'ui.attachment.previewFailed': 'تعذر تحميل المعاينة. يمكنك تنزيل الملف.',
|
|
308
|
+
'ui.attachment.previewTruncated': 'تعرض المعاينة بداية الملف فقط. نزّل الملف لقراءته كاملًا.',
|
|
309
|
+
'ui.attachment.tooMany': 'يمكن إرفاق {max} ملفات على الأكثر',
|
|
310
|
+
'ui.attachment.moveUp': 'تقديم {name}',
|
|
311
|
+
'ui.attachment.moveDown': 'تأخير {name}',
|
|
312
|
+
'ui.attachment.removeNamed': 'إزالة {name}',
|
|
313
|
+
'ui.attachment.uploadingNamed': 'جارٍ رفع {name} {progress}%',
|
|
314
|
+
'ui.attachment.addFiles': 'إضافة ملفات',
|
|
315
|
+
'ui.attachment.count': '{count} من {max} ملفات',
|
|
316
|
+
'ui.attachment.unknownFile': 'ملف رقم {id}',
|
|
317
|
+
'ui.attachment.added': 'أُضيف الملف {name}',
|
|
318
|
+
'ui.attachment.removed': 'أُزيل الملف {name}',
|
|
319
|
+
'ui.attachment.moved': 'نُقل الملف {name} إلى الموضع {position}',
|
|
320
|
+
// Print templates (ADR 048).
|
|
321
|
+
'ui.print.title': 'طباعة السجل',
|
|
322
|
+
'ui.print.description': 'اختر قالب الطباعة وصيغة المستند.',
|
|
323
|
+
'ui.print.loadFailed': 'تعذر تحميل قوالب الطباعة.',
|
|
324
|
+
'ui.print.retry': 'إعادة المحاولة',
|
|
325
|
+
'ui.print.loading': 'جارٍ تحميل القوالب…',
|
|
326
|
+
'ui.print.template': 'قالب الطباعة',
|
|
327
|
+
'ui.print.format': 'صيغة المستند',
|
|
328
|
+
'ui.print.html': 'صفحة للطباعة',
|
|
329
|
+
'ui.print.pdfUnavailable': 'تحويل PDF غير مفعّل؛ استخدم الطباعة من المتصفح.',
|
|
330
|
+
'ui.print.open': 'فتح للطباعة',
|
|
331
|
+
'ui.activity.printed': 'طباعة السجل بقالب',
|
|
332
|
+
'ui.admin.printTemplates': 'قوالب الطباعة',
|
|
333
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arabic is the base language of every system: its catalog is complete and every
|
|
3
|
+
* other language is an optional layer on top. A missing translation falls back to
|
|
4
|
+
* the Arabic text, never to a key or an empty string.
|
|
5
|
+
*/
|
|
6
|
+
export declare const BASE_LANGUAGE = "ar";
|
|
7
|
+
export type MessageCatalog = Readonly<Record<string, string>>;
|
|
8
|
+
export type MessageParams = Readonly<Record<string, string | number>>;
|
|
9
|
+
export type TextDirection = 'rtl' | 'ltr';
|
|
10
|
+
export type LanguageInfo = {
|
|
11
|
+
code: string;
|
|
12
|
+
name: string;
|
|
13
|
+
dir: TextDirection;
|
|
14
|
+
};
|
|
15
|
+
export type LanguageOptions = {
|
|
16
|
+
name: string;
|
|
17
|
+
dir?: TextDirection;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Adds an optional language. Keys that the Arabic catalog does not define are
|
|
21
|
+
* refused so a typo cannot silently create an untranslatable message; keys the
|
|
22
|
+
* catalog leaves out fall back to Arabic. Registering the same code again merges
|
|
23
|
+
* the catalogs, so an application can extend or override a bundled catalog.
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerLanguage(code: string, catalog: MessageCatalog, options: LanguageOptions): void;
|
|
26
|
+
/** Every registered language, Arabic first. */
|
|
27
|
+
export declare function registeredLanguages(): LanguageInfo[];
|
|
28
|
+
/**
|
|
29
|
+
* The languages users may choose: Arabic always, first, followed by the configured
|
|
30
|
+
* codes that are registered. An unknown configured code is a configuration error.
|
|
31
|
+
*/
|
|
32
|
+
export declare function enabledLanguages(configured?: readonly string[]): LanguageInfo[];
|
|
33
|
+
/** The preferred language when it is enabled, Arabic otherwise. */
|
|
34
|
+
export declare function resolveLanguage(preferred: string | null | undefined, configured?: readonly string[]): string;
|
|
35
|
+
export declare function languageDirection(code: string): TextDirection;
|
|
36
|
+
/**
|
|
37
|
+
* The message for `key` in `language`, falling back to Arabic. `{name}` placeholders
|
|
38
|
+
* are replaced from `params`. Unknown keys are a programming error.
|
|
39
|
+
*/
|
|
40
|
+
export declare function translate(key: string, language?: string, params?: MessageParams): string;
|
|
41
|
+
/**
|
|
42
|
+
* Translates Arabic text that matches a catalog entry exactly; other text is returned
|
|
43
|
+
* unchanged. Lets boundaries (flash messages, error responses) localize text produced
|
|
44
|
+
* by code that predates the catalog while Arabic output stays byte-identical.
|
|
45
|
+
*/
|
|
46
|
+
export declare function localizeText(text: string, language?: string): string;
|
|
47
|
+
/** The catalog key of an Arabic text, when the catalog defines it. */
|
|
48
|
+
export declare function messageKeyOf(text: string): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Arabic text → translation for the keys under `prefix` (the user interface strings
|
|
51
|
+
* by default). Interfaces keep their Arabic text and look it up here; an empty map
|
|
52
|
+
* means "render the Arabic", which is the case for Arabic users.
|
|
53
|
+
*/
|
|
54
|
+
export declare function clientMessages(language: string, prefix?: string): Record<string, string>;
|
|
55
|
+
/** Runs `callback` with `language` as the current language of everything it awaits. */
|
|
56
|
+
export declare function runWithLanguage<T>(language: string, callback: () => T): T;
|
|
57
|
+
/** The language of the current request (see runWithLanguage), Arabic outside one. */
|
|
58
|
+
export declare function currentLanguage(): string;
|
|
59
|
+
/**
|
|
60
|
+
* A resource, field, action, lookup or menu label in `language`: `label.<language>`
|
|
61
|
+
* when the label provides it, `label.ar` otherwise.
|
|
62
|
+
*/
|
|
63
|
+
export declare function labelText(label: {
|
|
64
|
+
ar: string;
|
|
65
|
+
[language: string]: string | undefined;
|
|
66
|
+
}, language?: string): string;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { arabicMessages } from './ar.js';
|
|
3
|
+
/**
|
|
4
|
+
* Arabic is the base language of every system: its catalog is complete and every
|
|
5
|
+
* other language is an optional layer on top. A missing translation falls back to
|
|
6
|
+
* the Arabic text, never to a key or an empty string.
|
|
7
|
+
*/
|
|
8
|
+
export const BASE_LANGUAGE = 'ar';
|
|
9
|
+
const languages = new Map();
|
|
10
|
+
/** clientMessages results by language and prefix; cleared when a catalog changes. */
|
|
11
|
+
const clientCache = new Map();
|
|
12
|
+
const storage = new AsyncLocalStorage();
|
|
13
|
+
/** Arabic text → message key, so text thrown by older code can still be translated. */
|
|
14
|
+
const keysByArabic = new Map();
|
|
15
|
+
for (const [key, text] of Object.entries(arabicMessages))
|
|
16
|
+
if (!keysByArabic.has(text))
|
|
17
|
+
keysByArabic.set(text, key);
|
|
18
|
+
languages.set(BASE_LANGUAGE, {
|
|
19
|
+
code: BASE_LANGUAGE,
|
|
20
|
+
name: 'العربية',
|
|
21
|
+
dir: 'rtl',
|
|
22
|
+
catalog: arabicMessages,
|
|
23
|
+
byArabic: new Map(),
|
|
24
|
+
});
|
|
25
|
+
function assertCode(code) {
|
|
26
|
+
if (!/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/.test(code))
|
|
27
|
+
throw new Error(`Invalid language code: ${code}`);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Adds an optional language. Keys that the Arabic catalog does not define are
|
|
31
|
+
* refused so a typo cannot silently create an untranslatable message; keys the
|
|
32
|
+
* catalog leaves out fall back to Arabic. Registering the same code again merges
|
|
33
|
+
* the catalogs, so an application can extend or override a bundled catalog.
|
|
34
|
+
*/
|
|
35
|
+
export function registerLanguage(code, catalog, options) {
|
|
36
|
+
assertCode(code);
|
|
37
|
+
if (code === BASE_LANGUAGE)
|
|
38
|
+
throw new Error('Arabic is the base language; it cannot be replaced');
|
|
39
|
+
if (!options.name?.trim())
|
|
40
|
+
throw new Error(`Language ${code} needs a display name`);
|
|
41
|
+
for (const [key, text] of Object.entries(catalog)) {
|
|
42
|
+
if (!Object.hasOwn(arabicMessages, key))
|
|
43
|
+
throw new Error(`Language ${code}: unknown message key ${key}`);
|
|
44
|
+
if (typeof text !== 'string' || !text)
|
|
45
|
+
throw new Error(`Language ${code}: empty message ${key}`);
|
|
46
|
+
}
|
|
47
|
+
const previous = languages.get(code);
|
|
48
|
+
clientCache.clear();
|
|
49
|
+
const merged = { ...previous?.catalog, ...catalog };
|
|
50
|
+
const byArabic = new Map();
|
|
51
|
+
for (const [key, text] of Object.entries(merged))
|
|
52
|
+
byArabic.set(arabicMessages[key], text);
|
|
53
|
+
languages.set(code, {
|
|
54
|
+
code,
|
|
55
|
+
name: options.name,
|
|
56
|
+
dir: options.dir ?? 'ltr',
|
|
57
|
+
catalog: Object.freeze(merged),
|
|
58
|
+
byArabic,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** Every registered language, Arabic first. */
|
|
62
|
+
export function registeredLanguages() {
|
|
63
|
+
return [...languages.values()].map(({ code, name, dir }) => ({ code, name, dir }));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The languages users may choose: Arabic always, first, followed by the configured
|
|
67
|
+
* codes that are registered. An unknown configured code is a configuration error.
|
|
68
|
+
*/
|
|
69
|
+
export function enabledLanguages(configured = [BASE_LANGUAGE]) {
|
|
70
|
+
const codes = [BASE_LANGUAGE, ...configured.filter((code) => code !== BASE_LANGUAGE)];
|
|
71
|
+
return [...new Set(codes)].map((code) => {
|
|
72
|
+
const language = languages.get(code);
|
|
73
|
+
if (!language)
|
|
74
|
+
throw new Error(`Language ${code} is enabled but not registered`);
|
|
75
|
+
return { code: language.code, name: language.name, dir: language.dir };
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** The preferred language when it is enabled, Arabic otherwise. */
|
|
79
|
+
export function resolveLanguage(preferred, configured = [BASE_LANGUAGE]) {
|
|
80
|
+
if (!preferred || preferred === BASE_LANGUAGE)
|
|
81
|
+
return BASE_LANGUAGE;
|
|
82
|
+
return configured.includes(preferred) && languages.has(preferred) ? preferred : BASE_LANGUAGE;
|
|
83
|
+
}
|
|
84
|
+
export function languageDirection(code) {
|
|
85
|
+
return languages.get(code)?.dir ?? 'rtl';
|
|
86
|
+
}
|
|
87
|
+
function interpolate(text, params) {
|
|
88
|
+
if (!params)
|
|
89
|
+
return text;
|
|
90
|
+
return text.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The message for `key` in `language`, falling back to Arabic. `{name}` placeholders
|
|
94
|
+
* are replaced from `params`. Unknown keys are a programming error.
|
|
95
|
+
*/
|
|
96
|
+
export function translate(key, language = currentLanguage(), params) {
|
|
97
|
+
const arabic = Object.hasOwn(arabicMessages, key) ? arabicMessages[key] : undefined;
|
|
98
|
+
if (arabic === undefined)
|
|
99
|
+
throw new Error(`Unknown message key: ${key}`);
|
|
100
|
+
const text = language === BASE_LANGUAGE ? arabic : (languages.get(language)?.catalog[key] ?? arabic);
|
|
101
|
+
return interpolate(text, params);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Translates Arabic text that matches a catalog entry exactly; other text is returned
|
|
105
|
+
* unchanged. Lets boundaries (flash messages, error responses) localize text produced
|
|
106
|
+
* by code that predates the catalog while Arabic output stays byte-identical.
|
|
107
|
+
*/
|
|
108
|
+
export function localizeText(text, language = currentLanguage()) {
|
|
109
|
+
if (language === BASE_LANGUAGE)
|
|
110
|
+
return text;
|
|
111
|
+
return languages.get(language)?.byArabic.get(text) ?? text;
|
|
112
|
+
}
|
|
113
|
+
/** The catalog key of an Arabic text, when the catalog defines it. */
|
|
114
|
+
export function messageKeyOf(text) {
|
|
115
|
+
return keysByArabic.get(text);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Arabic text → translation for the keys under `prefix` (the user interface strings
|
|
119
|
+
* by default). Interfaces keep their Arabic text and look it up here; an empty map
|
|
120
|
+
* means "render the Arabic", which is the case for Arabic users.
|
|
121
|
+
*/
|
|
122
|
+
export function clientMessages(language, prefix = 'ui.') {
|
|
123
|
+
if (language === BASE_LANGUAGE)
|
|
124
|
+
return {};
|
|
125
|
+
const cacheKey = `${language}:${prefix}`;
|
|
126
|
+
const cached = clientCache.get(cacheKey);
|
|
127
|
+
if (cached)
|
|
128
|
+
return cached;
|
|
129
|
+
const catalog = languages.get(language)?.catalog ?? {};
|
|
130
|
+
const messages = {};
|
|
131
|
+
for (const [key, text] of Object.entries(catalog))
|
|
132
|
+
if (key.startsWith(prefix))
|
|
133
|
+
messages[arabicMessages[key]] = text;
|
|
134
|
+
// Shared between requests: frozen so no caller can change another request's copy.
|
|
135
|
+
clientCache.set(cacheKey, Object.freeze(messages));
|
|
136
|
+
return messages;
|
|
137
|
+
}
|
|
138
|
+
/** Runs `callback` with `language` as the current language of everything it awaits. */
|
|
139
|
+
export function runWithLanguage(language, callback) {
|
|
140
|
+
return storage.run(languages.has(language) ? language : BASE_LANGUAGE, callback);
|
|
141
|
+
}
|
|
142
|
+
/** The language of the current request (see runWithLanguage), Arabic outside one. */
|
|
143
|
+
export function currentLanguage() {
|
|
144
|
+
return storage.getStore() ?? BASE_LANGUAGE;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A resource, field, action, lookup or menu label in `language`: `label.<language>`
|
|
148
|
+
* when the label provides it, `label.ar` otherwise.
|
|
149
|
+
*/
|
|
150
|
+
export function labelText(label, language = currentLanguage()) {
|
|
151
|
+
return (language !== BASE_LANGUAGE && label[language]) || label.ar;
|
|
152
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one bundled optional catalog: English for the framework's own strings. It does
|
|
3
|
+
* not translate consumer resources; those use `label.en` and fall back to `label.ar`.
|
|
4
|
+
* Register it with `registerLanguage('en', englishMessages, { name: 'English' })` and
|
|
5
|
+
* enable it in the application's languages list.
|
|
6
|
+
*/
|
|
7
|
+
export declare const englishMessages: Readonly<Record<string, string>>;
|