الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

convert GUI in java to Arabic

بدأه محمد1991 في 1 أغسطس 2012 · 7 رد · 959 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

لدي برنامج جافا عملت جميع الواجهات باللغة الانجليزية

وطلب مني عمل تبديل بين اللغات بحيث يمكن عرض الواجهات باللغتين

هل اقوم بذلك بشكل يدوي لكل واجة لجميع المكونات التي عليها ؟؟

ام يمكن عمل المطلوب من خلال كود او شي اخر ؟

#2

السلام عليكم

نعم يمكنك ذالك بستخدام Properties

طالع هذا الموضوع

/index.php?showtopic=203863

#3
                


   public void setText(){
    	if("rtl".equals(MyResourceBundle.getValue("dir"))){
    		this.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		jMenuBar1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		file.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		edit.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		label.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    	}else{
    		this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    		jMenuBar1.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    		file.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    		edit.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    		label.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    	}
    	label.setText(MyResourceBundle.getValue("myName", MyResourceBundle.getValue("othman"), MyResourceBundle.getValue("aleyaf") ));
    	file.setText(MyResourceBundle.getValue("file"));
        newItem.setText(MyResourceBundle.getValue("new"));
        closeItem.setText(MyResourceBundle.getValue("close"));
        edit.setText(MyResourceBundle.getValue("edit"));
        cutItem.setText(MyResourceBundle.getValue("cut"));
        change.setText(MyResourceBundle.getValue("change"));
    }

هنا احول لغة كل مكون ولكن لدي ما يقارب ال 40 interface داخل برنامجي هل ساحولها بهذه الطريقة ؟

#4
محمد1991 كتب:

هنا احول لغة كل مكون ولكن لدي ما يقارب ال 40 interface داخل برنامجي هل ساحولها بهذه الطريقة ؟

بالنسبه لهذه المكونات او تحويل اتجاهها

    		this.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		jMenuBar1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		file.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		edit.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    		label.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

يمكنك تحويلهم جميعا باستخدام هذا السطر

applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

والعكس صحيح

applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

اما بالنسبه للمكونات على سبيل المثال

     	newItem.setText(MyResourceBundle.getValue("new"));

لا أجد لها حلا غير ذلك انك تقوم بكتابه كل واحد على حدى لان كل قيمه بتختلف طبعا من مكون لأخر

شوف الفيديو دا

اتمنى انه يساعدك ان شاء الله

بالتوفيق ان شاء الله

Software Developer
Mahmoudkelany.com


 

#5
Mahmoud Kelany كتب:

يمكنك تحويلهم جميعا باستخدام هذا السطر

applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

والعكس صحيح

applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

السلام عليكم

لقد انشات frame بسيط في lable and menu و 2 button

الاولى تفعل

applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

و الثانية

applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

لكن لم يشتغلو

هناك من يقول ان هذه الدالة حسب نظام التشغيل

انا عندى windows7

تم تعديل هذه المشاركة بواسطة sahraoui dhelim في 2 أغسطس 2012 في 22:46

#6
sahraoui dhelim كتب:

السلام عليكم

لقد انشات frame بسيط في lable and menu و 2 button

الاولى تفعل

applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

و الثانية

applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

لكن لم يشتغلو

هناك من يقول ان هذه الدالة حسب نظام التشغيل

انا عندى windows7

لا مشكله بها فهى تعمل بشكل جيد ولا تعتمد على نظام التشغيل

لكن استدعى هذا السطر بعدها

SwingUtilities.updateComponentTreeUI(this);

Software Developer
Mahmoudkelany.com


 

#7
Mahmoud Kelany كتب:

لا مشكله بها فهى تعمل بشكل جيد ولا تعتمد على نظام التشغيل

لكن استدعى هذا السطر بعدها

SwingUtilities.updateComponentTreeUI(this);

صحيح

اشتغلة تمام

لكنك لم تذكرها في الفيديو

هو انت بتراجع من ورانا؟

#8
sahraoui dhelim كتب:

صحيح

اشتغلة تمام

لكنك لم تذكرها في الفيديو

هو انت بتراجع من ورانا؟

طب الحمدلله

لا مش كدا , بس اكيد عندك فيه حاجه فالـ Update

ما انا شرحت المثال فالفيديو وشغال تمام

قد تكون مستخدم اشياء اخرى جعلت التحديثات لا تعمل

Software Developer
Mahmoudkelany.com


 

مواضيع مشابهة