Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

Add Arabic Language & Enhancements to UI/UX (#507)

Kareem Adel766b5164b89b
diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts
index 47b9e6e7..21588b8f 100644
--- a/src/i18n/i18n.ts
+++ b/src/i18n/i18n.ts
@@ -22,6 +22,7 @@ import { te, teMetadata } from './locales/te';
import { bn, bnMetadata } from './locales/bn';
import { gu, guMetadata } from './locales/gu';
import { vi, viMetadata } from './locales/vi';
+import { ar, arMetadata } from './locales/ar';
export const languages: LanguageMetadata[] = [
enMetadata,
@@ -44,6 +45,7 @@ export const languages: LanguageMetadata[] = [
bnMetadata,
guMetadata,
viMetadata,
+ arMetadata,
];
const resources = {
@@ -67,6 +69,7 @@ const resources = {
bn,
gu,
vi,
+ ar,
};
i18n.use(LanguageDetector)
diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts
new file mode 100644
index 00000000..67629bfb
--- /dev/null
+++ b/src/i18n/locales/ar.ts
@@ -0,0 +1,404 @@
+import type { LanguageMetadata, LanguageTranslation } from '../types';
+
+export const ar: LanguageTranslation = {
+ translation: {
+ menu: {
+ file: {
+ file: 'ملف',
+ new: 'جديد',
+ open: 'فتح',
+ save: 'حفظ',
+ import_database: 'استيراد قاعدة بيانات',
+ export_sql: 'تصدير SQL',
+ export_as: 'تصدير كـ',
+ delete_diagram: 'حذف المخطط',
+ exit: 'خروج',
+ },
+ edit: {
+ edit: 'تحرير',
+ undo: 'تراجع',
+ redo: 'إعادة',
+ clear: 'مسح',
+ },
+ view: {
+ view: 'عرض',
+ show_sidebar: 'إظهار الشريط الجانبي',
+ hide_sidebar: 'إخفاء الشريط الجانبي',
+ hide_cardinality: 'إخفاء تفاصيل العلاقات',
+ show_cardinality: 'إظهار تفاصيل العلاقات',
+ zoom_on_scroll: 'التكبير عند التمرير',
+ theme: 'المظهر',
+ show_dependencies: 'إظهار الاعتمادات',
+ hide_dependencies: 'إخفاء الاعتمادات',
+ },
+ share: {
+ share: 'مشاركة',
+ export_diagram: 'تصدير المخطط',
+ import_diagram: 'استيراد المخطط',
+ },
+ help: {
+ help: 'مساعدة',
+ visit_website: 'زيارة CHARTDB.IO',
+ join_discord: 'الانضمام إلى ديسكورد',
+ schedule_a_call: 'تواصل معنا!',
+ },
+ },
+
+ delete_diagram_alert: {
+ title: 'حذف المخطط',
+ description:
+ 'هذا الإجراء لا يمكن التراجع عنه. سيتم حذف المخطط بشكل دائم.',
+ cancel: 'إلغاء',
+ delete: 'حذف',
+ },
+
+ clear_diagram_alert: {
+ title: 'Clear Diagram',
+ description:
+ 'هذا الإجراء لا يمكن التراجع عنه. سيتم مسح جميع البيانات في المخطط بشكل دائم.',
+ cancel: 'إلغاء',
+ clear: 'مسح',
+ },
+
+ reorder_diagram_alert: {
+ title: 'ترتيب المخطط',
+ description:
+ 'هذا الإجراء سيقوم بترتيب الجداول في المخطط بشكل تلقائي. هل تريد المتابعة؟',
+ reorder: 'ترتيب',
+ cancel: 'إلغاء',
+ },
+
+ multiple_schemas_alert: {
+ title: 'Multiple Schemas (نظم متعددة)',
+ description:
+ '{{schemasCount}} النظم في هذا المخطط. تعرض حالياً: {{formattedSchemas}}.',
+ dont_show_again: 'لا تظهره مجدداً',
+ change_schema: 'تغيير النظام',
+ none: 'لا شيء',
+ },
+
+ copy_to_clipboard_toast: {
+ unsupported: {
+ title: 'فشل النسخ',
+ description: 'النسخ إلى الحافظة غير مدعوم في هذا المتصفح.',
+ },
+ failed: {
+ title: 'فشل النسخ',
+ description: 'حدث خطأ أثناء النسخ. حاول مجدداً',
+ },
+ },
+
+ theme: {
+ system: 'النظام',
+ light: 'فاتح',
+ dark: 'داكن',
+ },
+
+ zoom: {
+ on: 'تشغيل',
+ off: 'إيقاف',
+ },
+
+ last_saved: 'آخر حفظ',
+ saved: 'تم الحفظ',
+ loading_diagram: 'جاري تحميل المخطط...',
+ deselect_all: 'إلغاء تحديد الكل',
+ select_all: 'تحديد الكل',
+ clear: 'مسح',
+ show_more: 'عرض المزيد',
+ show_less: 'عرض أقل',
+ copy_to_clipboard: 'نسخ إلى الحافظة',
+ copied: 'تم النسخ',
+
+ side_panel: {
+ schema: 'النظام(Schema):',
+ filter_by_schema: 'تصفية حسب النظام...',
+ search_schema: 'البحث عن النظام...',
+ no_schemas_found: 'لم يتم العثور على نظم',
+ view_all_options: 'عرض جميع الخيارات...',
+ tables_section: {
+ tables: 'الجداول',
+ add_table: 'إضافة جدول',
+ filter: 'تصفية',
+ collapse: 'طي الكل',
+
+ table: {
+ fields: 'الحقول',
+ nullable: 'Nullable?',
+ primary_key: 'Primary Key',
+ indexes: 'Indexes',
+ comments: 'تعليقات',
+ no_comments: 'لا توجد تعليقات',
+ add_field: 'إضافة حقل',
+ add_index: 'إضافة Index',
+ index_select_fields: 'حدد الحقول',
+ no_types_found: 'لا يوجد أنواع',
+ field_name: 'الإسم',
+ field_type: 'النوع',
+ field_actions: {
+ title: 'Field Attributes',
+ unique: 'Unique',
+ comments: 'تعليقات',
+ no_comments: 'لا يوجد تعليقات',
+ delete_field: 'حذف الحقل',
+ },
+ index_actions: {
+ title: 'Index Attributes',
+ name: 'الإسم',
+ unique: 'Unique',
+ delete_index: 'حذف Index',
+ },
+ table_actions: {
+ title: 'إجراءات الجدول',
+ change_schema: 'تغيير النظام',
+ add_field: 'إضافة حقل',
+ add_index: 'إضافة Index',
+ duplicate_table: 'نسخ الجدول',
+ delete_table: 'حذف الجدول',
+ },
+ },
+ empty_state: {
+ title: 'لا توجد جداول',
+ description: 'إنشاء جدول للبدء',
+ },
+ },
+ relationships_section: {
+ relationships: 'العلاقات',
+ filter: 'تصفية',
+ add_relationship: 'إضافة علاقة',
+ collapse: 'طي الكل',
+ relationship: {
+ primary: 'الجدول الأساسي',
+ foreign: 'الجدول المرتبط',
+ cardinality: 'تفاصيل العلاقة',
+ delete_relationship: 'حذف',
+ relationship_actions: {
+ title: 'إجراءات',
+ delete_relationship: 'حذف',
+ },
+ },
+ empty_state: {
+ title: 'لا توجد علاقات',
+ description: 'إنشاء علاقة للبدء',
+ },
+ },
+ dependencies_section: {
+ dependencies: 'الاعتمادات',
+ filter: 'تصفية',
+ collapse: 'طي الكل',
+ dependency: {
+ table: 'الجدول',
+ dependent_table: 'عرض الاعتمادات',
+ delete_dependency: 'حذف',
+ dependency_actions: {
+ title: 'إجراءات',
+ delete_dependency: 'حذف',
+ },
+ },
+ empty_state: {
+ title: 'لا توجد اعتمادات',
+ description: 'إنشاء اعتماد للبدء',
+ },
+ },
+ },
+
+ toolbar: {
+ zoom_in: 'تكبير',
+ zoom_out: 'تصغير',
+ save: 'حفظ',
+ show_all: 'عرض الكل',
+ undo: 'تراجع',
+ redo: 'إعادة',
+ reorder_diagram: 'ترتيب المخطط',
+ highlight_overlapping_tables: 'تسليط الضوء على الجداول المتداخلة',
+ },
+
+ new_diagram_dialog: {
+ database_selection: {
+ title: 'ما هو نوع قاعدة البيانات الخاصة بك؟',
+ description:
+ 'تتمتع كل قاعدة بيانات بمميزاتها وقدراتها الفريدة.',
+ check_examples_long: 'ألقي نظرة على الأمثلة',
+ check_examples_short: 'أمثلة',
+ },
+
+ import_database: {
+ title: 'إسترد قاعدة بياناتك',
+ database_edition: 'إصدار قاعدة البيانات:',
+ step_1: 'قم بتشغيل البرنامج النصي التالي في قاعدة بياناتك:',
+ step_2: 'إلصق نتيجة البرنامج النصي هنا:',
+ script_results_placeholder: 'نتيجة البرنامج النصي هنا...',
+ ssms_instructions: {
+ button_text: 'تعليمات SSMS',
+ title: 'تعليمات',
+ step_1: 'Go to Tools > Options > Query Results > SQL Server.',
+ step_2: 'If you\'re using "Results to Grid," change the Maximum Characters Retrieved for Non-XML data (set to 9999999).',
+ },
+ instructions_link: 'تحتاج مساعدة؟ شاهد الفيديو',
+ check_script_result: 'تحقق من نتيجة البرنامج النصي',
+ },
+
+ cancel: 'إلغاء',
+ import_from_file: 'استيراد من ملف',
+ back: 'السابق',
+ empty_diagram: 'مخطط فارغ',
+ continue: 'متابعة',
+ import: 'استيراد',
+ },
+
+ open_diagram_dialog: {
+ title: 'فتح مخطط',
+ description: 'اختر مخططًا لفتحه',
+ table_columns: {
+ name: 'الإسم',
+ created_at: 'تاريخ الإنشاء',
+ last_modified: 'آخر تعديل',
+ tables_count: 'عدد الجداول',
+ },
+ cancel: 'إلغاء',
+ open: 'فتح',
+ },
+
+ export_sql_dialog: {
+ title: 'تصدير SQL',
+ description: 'استخرج نظام قاعدة بياناتك إالى كود {{databaseType}}',
+ close: 'إغلاق',
+ loading: {
+ text: 'الذكاء الاصطناعي يقوم بتوليد كود SQL لـ {{databaseType}}...',
+ description: 'هذا قد يستغرق 30 ثانية',
+ },
+ error: {
+ message:
+ 'حدث خطأ أثناء تصدير الكود. يرجى المحاولة مرة أخرى أو <0>التواصل معنا</0>.',
+ description:
+ 'يمكنك استخدام OPENAI_TOKEN الخاص بك , اتطلع على الإرشادات <0>هنا</0>.',
+ },
+ },
+
+ create_relationship_dialog: {
+ title: 'إنشاء علاقة',
+ primary_table: 'الجدول الأساسي',
+ primary_field: 'الحقل الأساسي',
+ referenced_table: 'الجدول المرتبط',
+ referenced_field: 'الحقل المرتبط',
+ primary_table_placeholder: 'حدد الجدول',
+ primary_field_placeholder: 'حدد الحقل',
+ referenced_table_placeholder: 'حدد الجدول',
+ referenced_field_placeholder: 'حدد الحقل',
+ no_tables_found: 'لم يتم العثور على جداول',
+ no_fields_found: 'لم يتم العثور على حقول',
+ create: 'إنشاء',
+ cancel: 'إلغاء',
+ },
+
+ import_database_dialog: {
+ title: 'استيراد إلى المخطط الحالي',
+ override_alert: {
+ title: 'استيراد قاعدة بيانات',
+ content: {
+ alert: 'سيؤدي استيراد هذا المخطط إلى التأثير على الجداول والعلاقات الموجودة.',
+ new_tables:
+ '<bold>{{newTablesNumber}}</bold> جداول جديدة سيتم إضافتها.',
+ new_relationships:
+ '<bold>{{newRelationshipsNumber}}</bold> علاقات جديدة سيتم إنشائها.',
+ tables_override:
+ '<bold>{{tablesOverrideNumber}}</bold> جداول سيتم الكتابة عليها.',
+ proceed: 'هل تريد المتابعة؟',
+ },
+ import: 'استيراد',
+ cancel: 'إلغاء',
+ },
+ },
+
+ export_image_dialog: {
+ title: 'تصدير الصورة',
+ description: 'اختر الدقة لتصدير الصورة:',
+ scale_1x: '1x عادي',
+ scale_2x: '2x (موصى به)',
+ scale_3x: '3x',
+ scale_4x: '4x',
+ cancel: 'إلغاء',
+ export: 'تصدير',
+ },
+
+ new_table_schema_dialog: {
+ title: 'اختر نظاماً (Schema)',
+ description:
+ 'يتم عرض أنظمة (Schemas) متعددة حاليًا. حدد أحدها للجدول الجديد.',
+ cancel: 'إلغاء',
+ confirm: 'اختيار',
+ },
+
+ update_table_schema_dialog: {
+ title: 'تغيير النظام (Schema)',
+ description: 'تحديث نظام (Schema) لجدول: "{{tableName}}"',
+ cancel: 'إلغاء',
+ confirm: 'تغيير',
+ },
+
+ star_us_dialog: {
+ title: 'ساعدنا على التحسين!',
+ description:
+ 'هل ترغب في منحنا نجمة على GitHub؟ كل ما عليك فعله هو نقرة واحدة فقط!',
+ close: 'ليس الآن',
+ confirm: 'بالتأكيد!',
+ },
+ export_diagram_dialog: {
+ title: 'تصدير المخطط',
+ description: 'اختر التنسيق للتصدير:',
+ format_json: 'JSON',
+ cancel: 'إلغاء',
+ export: 'تصدير',
+ error: {
+ title: 'حدث خطأ أثناء التصدير',
+ description:
+ 'حدث خطأ ما. هل تحتاج إلى مساعدة؟ [email protected]',
+ },
+ },
+
+ import_diagram_dialog: {
+ title: 'استيراد المخطط',
+ description: 'قم بلصق JSON المخطط هنا:',
+ cancel: 'إلغاء',
+ import: 'استيراد',
+ error: {
+ title: 'حدث خطأ أثناء الاستيراد',
+ description:
+ 'كود JSON للمخطط غير صالح. من فضلك تحقق من صحته وحاول مرة أخرى. هل تحتاج إلى مساعدة؟ [email protected]',
+ },
+ },
+ relationship_type: {
+ one_to_one: 'One to One',
+ one_to_many: 'One to Many',
+ many_to_one: 'Many to One',
+ many_to_many: 'Many to Many',
+ },
+
+ canvas_context_menu: {
+ new_table: 'جدول جديد',
+ new_relationship: 'علاقة جديدة',
+ },
+
+ table_node_context_menu: {
+ edit_table: 'تعديل الجدول',
+ duplicate_table: 'نسخ الجدول',
+ delete_table: 'حذف الجدول',
+ },
+
+ snap_to_grid_tooltip: 'مغنطة الشبكة (انقر مطولاً على {{key}})',
+
+ tool_tips: {
+ double_click_to_edit: 'انقر نقرًا مزدوجًا للتحرير',
+ },
+
+ language_select: {
+ change_language: 'تغيير اللغة',
+ },
+ },
+};
+
+export const arMetadata: LanguageMetadata = {
+ name: 'Arabic',
+ nativeName: 'العربية',
+ code: 'ar',
+};
diff --git a/src/i18n/locales/zh_CN.ts b/src/i18n/locales/zh_CN.ts
index b8ad1cb0..28486cb7 100644
--- a/src/i18n/locales/zh_CN.ts
+++ b/src/i18n/locales/zh_CN.ts
@@ -394,7 +394,7 @@ export const zh_CN: LanguageTranslation = {
};
export const zh_CNMetadata: LanguageMetadata = {
- name: 'Chinese',
+ name: 'Chinese (Simplified)',
nativeName: '简体中文',
code: 'zh_CN',
};
diff --git a/src/i18n/locales/zh_TW.ts b/src/i18n/locales/zh_TW.ts
index 1553e25a..6c116728 100644
--- a/src/i18n/locales/zh_TW.ts
+++ b/src/i18n/locales/zh_TW.ts
@@ -394,6 +394,6 @@ export const zh_TW: LanguageTranslation = {
export const zh_TWMetadata: LanguageMetadata = {
nativeName: '繁體中文',
- name: 'Traditional Chinese',
+ name: 'Chinese (Traditional)',
code: 'zh_TW',
};
diff --git a/src/pages/editor-page/canvas/table-node/table-node-field.tsx b/src/pages/editor-page/canvas/table-node/table-node-field.tsx
index a0ece741..b1d0dd1d 100644
--- a/src/pages/editor-page/canvas/table-node/table-node-field.tsx
+++ b/src/pages/editor-page/canvas/table-node/table-node-field.tsx
@@ -6,11 +6,15 @@ import {
useUpdateNodeInternals,
} from '@xyflow/react';
import { Button } from '@/components/button/button';
-import { KeyRound, Trash2 } from 'lucide-react';
-
+import { KeyRound, MessageCircleMore, Trash2 } from 'lucide-react';
import type { DBField } from '@/lib/domain/db-field';
import { useChartDB } from '@/hooks/use-chartdb';
import { cn } from '@/lib/utils';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/tooltip/tooltip';
export const LEFT_HANDLE_ID_PREFIX = 'left_rel_';
export const RIGHT_HANDLE_ID_PREFIX = 'right_rel_';
@@ -113,8 +117,27 @@ export const TableNodeField: React.FC<TableNodeFieldProps> = React.memo(
/>
</>
)}
- <div className="block truncate text-left">{field.name}</div>
- <div className="flex max-w-[35%] justify-end gap-2 truncate hover:shrink-0">
+ <div
+ className={cn(
+ 'flex items-center gap-1 truncate text-left',
+ {
+ 'font-semibold': field.primaryKey || field.unique,
+ }
+ )}
+ >
+ <span className="truncate">{field.name}</span>
+ {field.comments ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div className="shrink-0 cursor-pointer text-muted-foreground">
+ <MessageCircleMore size={14} />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>{field.comments}</TooltipContent>
+ </Tooltip>
+ ) : null}
+ </div>
+ <div className="flex max-w-[35%] justify-end gap-1.5 truncate hover:shrink-0">
{field.primaryKey ? (
<div
className={cn(
@@ -128,11 +151,12 @@ export const TableNodeField: React.FC<TableNodeFieldProps> = React.memo(
<div
className={cn(
- 'content-center truncate text-right text-xs text-muted-foreground',
+ 'content-center truncate text-right text-xs text-muted-foreground shrink-0',
!readonly ? 'group-hover:hidden' : ''
)}
>
{field.type.name}
+ {field.nullable ? '?' : ''}
</div>
{readonly ? null : (
<div className="hidden flex-row group-hover:flex">