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

[جافا Eclipse] تحويل العربية إلى إنجليزية

بدأه Salah Bkheet في 18 ديسمبر 2008 · 5 رد · 2,241 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

الحمد لله رب العالمين و الصلاة و السلام على أشرف الأنبياء و المرسلين

أخواني وأخواتي الأعضاء المحترمين. أم بعد..

لقد حلمة بتعريب ألعاب الكنسل منذ صغري وحاولت شتى الطرق إلى تعريب أكبر كم من الألعاب للشعب العربي لكي نظهر للعالم بأننا نستحق أن نستمتع.

بالعلم أنني أدرس الهندسة المدنية, في أخر سنة. حاولت تعلم لغة الجافا لكي أصل إلى برمجة برنامج يساعدني في تعريب الألعاب.

س\ج:

1- لماذا تريد أن تصنع هذا البرنامج ؟

السبب هو أنني إذا إستخدمة الطريقة التقليدية فسوف يستغرق تعريب لعبة واحده بسيطه إلى شهرين على الأقل متواصلة.

كيف؟

أولاً يتم إختراق اللعبة و أستخراج خارطة الاحرف كتالي:

post-178538-1229547544_thumb.jpg

ثانياً يتم رسم الأحرف العربية كتالية:

post-178538-1229547611_thumb.png

وعند كتابتي لكلمة عربية مثلاً :

قصة بطل

أستبدل الأحرف العربية بالإنجليزية المرادف لها بالعربية مثالاً:

WPB ]NU

وخارطة الأحرف هي كتالي:


B = ب
C = ت
D = ث
E = ج
F = ح
G = خ
H = د
I = ذ
J = ر
K = ز
L = س
M = ش
N = ص
O = ض
P = ط
Q = ظ
R = ع
S = غ
T = ف
U = ق
V = ك
W = ل
X = م
Y = ن
Z = ه
a = و
b = ي
c = ـهـ
d = بـ
e = تـ
f = ثـ
g = جـ
h = حـ
i = خـ
j = سـ
k = شـ
l = صـ
m = ضـ
n = عـ
o = غـ
p = فـ
q = قـ
r = كـ
s = لـ
t = مـ
u = نـ
v = هـ
w = يـ
x = ـا
y = ـلـ
z = ـغـ
" = ـعـ
& = ـه
@ = ـي
, = ـج
$ = ـح
* = ـخ
_ = ـع
; = ـغ
[ = ا
] = ة
A = أ

ماهي المشكلة التي واجهتني في البرنامج الذي صنعتة؟

المشكلة هي بسيطه للخبراء في هذا المجال لقد حاولت و كنت متردداً في إنشاء موضوع للمساعده ولكن أحسست بالتعب من كثرة المحاولات ولاجدوه المشكله هي

صنعة برنامج يحول اللغة الإنجليزية إلى اللغة العربية كما موضح بالجدول التالي:

للعلم الصيغ مثالاً

u0628

مأخوذا من الموقع التالي:

http://en.wikipedia.org/wiki/Arabic_alphabet


\u0628 = B // ب
\u062A = C // ت
\u062B = D // ث
\u062C = E // ج
\u062D = F // ح
\u062E = G // خ
\u062F = H // د
\u0630 = I // ذ
\u0631 = J // ر
\u0632 = K // ز
\u0633 = L // س
\u0634 = M // ش
\u0635 = N // ص
\u0636 = O // ض
\u0637 = P // ط
\u0638 = Q // ظ
\u0639 = R // ع
\u063A = S // غ
\u0641 = T // ف
\u0642 = U // ق
\u0643 = V // ك
\u0644 = W // ل
\u0645 = X // م
\u0646 = Y // ن
\u0647 = Z // ه
\u0648 = a // و
\u064A = b // ي
\uFEEC = c // ـهـ
\uFE91 = d // بـ
\uFE97 = e // تـ
\uFE9B = f // ثـ
\uFE9F = g // جـ
\uFEA3 = h // حـ
\uFEA7 = i // خـ
\uFEB3 = j // سـ
\uFEB7 = k // شـ
\uFEBB = l // صـ
\uFEBF = m // ضـ
\uFECB = n // عـ
\uFECF = o // غـ
\uFED3 = p // فـ
\uFED7 = q // قـ
\uFEDB = r // كـ
\uFEDF = s // لـ
\uFEE3 = t // مـ
\uFEE7 = u // نـ
\uFEEB = v // هـ
\uFEF3 = w // يـ
\uFE8E = x // ـا
\uFEE0 = y // ـلـ
\uFED0 = z // ـغـ
\uFECC = " // ـعـ
\uFEEA = & // ـه
\uFEF2 = @ // ـي
\uFE9E = , // ـج
\uFEA2 = $ // ـح
\uFEA6 = * // ـخ
\uFECA = _ // ـع
\uFECE =; // ـغ
\u0627 = [ // ا
\u0629 = ] // ة
\u0623 = A // أ

وكود الذي صنعتة هو كتالي و المشكلة موضحة بالاصفل:

  1.  
  2. package run
  3.  
  4. import java.io.BufferedReader
  5. import java.io.IOException
  6. import java.io.InputStreamReader
  7.  
  8. /**
  9. * This package holds a collection fo tools for translating english to arabic characters
  10. * this tool is still in the beta phase!
  11. *
  12. * @author Salah bkheet
  13. */
  14. public class Boot {
  15. private static String input = null
  16. // set up communication with the console (next two lines)
  17. private static InputStreamReader isr = new InputStreamReader(System.in)
  18. private static BufferedReader stdin = new BufferedReader(isr)
  19.  
  20. private static HelpCodeHandler charTranslater = new HelpCodeHandler()
  21.  
  22.  
  23.  
  24. public static void main(String[] args) {
  25.  
  26. char[] inputAsChars = null
  27. char[] inputReverseAsChars = null
  28. char[] translatedAsChars = null
  29. char[] translatedReverseAsChars = null
  30.  
  31.  
  32.  
  33. try{
  34. ///////////CONDITION_FOR_WHILE_LOOP//////////
  35. boolean continuePrompting = true
  36.  
  37. /////////////////START_WHILE/////////////////
  38. while (continuePrompting){
  39. // the main menu will be displayed
  40. printMainMenu()
  41.  
  42. // check on the user input
  43. if(input.equals("1")){
  44. // set the correct translation table
  45. charTranslater.setPropertyFile("charListEN.properties")
  46.  
  47. // condition for inner while loop
  48. boolean isDone = false
  49. // while loop to stay "inside" the tool
  50. while (!isDone) {
  51. System.out.println("Please enter the text to be translated: (or type "abc123" to quit)")
  52.  
  53. String UserInput_ = stdin.readLine()
  54.  
  55. if (UserInput_.equals("abc123")) {
  56. isDone = true
  57. } else {
  58. // the transformation process
  59.  
  60. // the input in Chars
  61. inputAsChars = UserInput_.toCharArray()
  62. // reversing the input and copying into new Array
  63. inputReverseAsChars = reverseArray(inputAsChars)
  64.  
  65. // printing the English Reversed Array
  66. System.out.print("The English RtoL:tt")
  67. System.out.println(inputReverseAsChars)
  68.  
  69. // translating the input to arabic
  70. translatedAsChars = translateArray(inputAsChars)
  71.  
  72. // printing the Arabic Array
  73. System.out.print("The Arabic LtoR:tt")
  74. System.out.println(translatedAsChars)
  75.  
  76. // reversing the arabic version
  77. translatedReverseAsChars = reverseArray(translatedAsChars)
  78.  
  79. // printing the Arabic Reversed Array
  80. System.out.print("The Arabic RtoL:tt")
  81. System.out.println(translatedReverseAsChars)
  82.  
  83.  
  84. } // end check on "quit" command
  85.  
  86.  
  87. } // end inner while
  88.  
  89.  
  90.  
  91. // المشكلة تبداء هنا
  92. } else if (input.equals("2")){
  93. // set the correct translation table
  94. charTranslater.setPropertyFile("charListAR.properties")
  95.  
  96.  
  97. // condition for inner while loop
  98. boolean isDone = false
  99. // while loop to stay "inside" the tool
  100. while (!isDone) {
  101. System.out.println("Please enter the text to be translated: (or type "abc123" to quit)")
  102.  
  103. String UserInput_ = stdin.readLine()
  104.  
  105. if (UserInput_.equals("abc123")) {
  106. isDone = true
  107. } else {
  108. // the transformation process
  109.  
  110. // the input in Chars
  111. inputAsChars = UserInput_.toCharArray()
  112. // reversing the input and copying into new Array
  113. inputReverseAsChars = reverseArray(inputAsChars)
  114.  
  115. // printing the Arabic Reversed Array
  116. System.out.print("The Arabic LtoR:tt")
  117. System.out.println(inputReverseAsChars)
  118.  
  119. // translating the input to arabic
  120. translatedAsChars = translateArray(inputAsChars)
  121.  
  122. // printing the English Array
  123. System.out.print("The English RtoL:tt")
  124. System.out.println(translatedAsChars)
  125.  
  126. // reversing the English version
  127. translatedReverseAsChars = reverseArray(translatedAsChars)
  128.  
  129. // printing the English Reversed Array
  130. System.out.print("The English LtoR:tt")
  131. System.out.println(translatedReverseAsChars)
  132.  
  133.  
  134. } // end check on "quit" command
  135.  
  136.  
  137.  
  138. //المشكلة تنتهي هنا
  139.  
  140. } // end inner while
  141.  
  142. } else if (input.equals("3")){
  143. System.out.println("Thank you and Goodbye! Salah")
  144. continuePrompting = false
  145. } else {
  146. System.out.println("Please select a valid option.")
  147. } // end checking on user input
  148. } // end while
  149. // terminate program
  150. System.exit(0)
  151.  
  152. } catch (IOException UserInputException){
  153. System.out.println("An unexpected error occured during the execution of the program.n")
  154. UserInputException.printStackTrace()
  155. } // end try-catch
  156. } // end main()
  157.  
  158.  
  159.  
  160. /**
  161. * method: printMainMenu:
  162. * This methods is responsible for displaying the main menu to the user on the command
  163. * line. It can throw an IOException as it is using the Buffered Reader and the InputStreamReade
    r.
  164. * This is ok as it will only be used inside a try-catch statement.
  165. *
  166. * @throws IOException
  167. */
  168. private static void printMainMenu() throws IOException {
  169. System.out.println("######### Translate_Tool ####################")
  170. System.out.println("1. English to Arabic - Type 1 and enter.")
  171. System.out.println("2. Arabic to English - Type 2 and enter.")
  172. System.out.println("3. Quit - Type 3 and enter.")
  173. System.out.println("######### by Salah bkheet ©2008 ###########")
  174.  
  175. input = stdin.readLine()
  176. } // end printMainMenu()
  177.  
  178.  
  179. /**
  180. * method: reverseArray:
  181. * This methods is responsible for reversing the passed Array
  182. *
  183. * @param inputAsChars_ The original array
  184. * @return inputReverseAsChars
  185. */
  186. private static char[] reverseArray(char[] inputAsChars_) {
  187. // compute length of input
  188. int length = inputAsChars_.length
  189.  
  190. // create the reversedInputArray
  191. char[] inputReverseAsChars = new char[length]
  192.  
  193. // last index for loop
  194. int lastIndex = length - 1
  195.  
  196. // reversing the input
  197. for (int i = 0 i < length i++, lastIndex--){
  198.  
  199. inputReverseAsChars[lastIndex] = inputAsChars_
  200.  
  201. } // end for - swapping items
  202.  
  203. return inputReverseAsChars
  204.  
  205. } // end reverseArray()
  206.  
  207. /**
  208. * method: translateArray:
  209. * This methods is responsible for transforming the English Characters to Arabic ones
  210. * based on a Properties File created by Salah bkheet
  211. *
  212. * @param orignal_ The original English Version
  213. * @return arabicAsChars
  214. */
  215. private static char[] translateArray(char[] original_) {
  216.  
  217. // compute length of input
  218. int length = original_.length
  219.  
  220. // create the arabicVersionArray
  221. char[] arabicAsChars = new char[length]
  222.  
  223.  
  224. // translating the Array
  225. for (int i = 0 i < length i++){
  226.  
  227. // char to string
  228. String temp = Character.toString(original_)
  229. // transform to arabic
  230. temp = charTranslater.getMessage(temp)
  231. // string to char
  232. arabicAsChars = temp.charAt(0)
  233.  
  234. } // end for
  235.  
  236. return arabicAsChars
  237.  
  238. } // end translateArray()
  239.  
  240. }
  241.  
  242.  
  243.  

المشكلة أن عند أشتباك الأحرف مثالً كلمة : الله

يجب أن تكون هاكذا: [ssZ

وليس هاكذا: [WWZ

المشكلة أنه البرنامج يقراء الأحرف العربية ولايقراء الأحرف المتشابكه على سبيل المثال إذا كتبنا كلمة نعم سوف يقراء ن ع م لكن بالأصل يجب أن يقراء نـ ـعـ م

يا أخوتي إذا أحببتم أن أرفع المصدر المفتوح الرجاء أخبروني.

وإذا كان هناك تقصير في الشرح الرجاء من أخوتي السؤال لكي أوضح أكثر

وشكراً

تم تعديل هذه المشاركة بواسطة Salah Bkheet في 18 ديسمبر 2008 في 01:13

"Anyone who has never made a mistake has never tried anything new."

Albert Einstein

#2

بصراحة أفضل أن ترفع المصدر المفتوح

لكي يكون أسهل في تعقب المشكلة

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

#3

شكراً أخي علاء على الرد متأسف على الرد البطيء

تفضل في المرفق الـOpen Source

يفضل أستخدام Eclipse

عند تشغيل البرنامج أضغط رقم 2 لكي يتم تحويل من عربي إلى إنجليزي و هنا يكمن الخطأ

كما وضحة في الرد السابق أنه إذا تم شبك الحوار الأحرف الصغيرة الإنجليزية لاتظهر.

وأرجو من الأخوه الأعزاء أن لا يترددو في طرح أي سؤال , أستفسار

ملاحظة في الملف المرفق حول إمتداد الملف من .rar إلى .jar

شكراً

TransAR_Project_v0.1.rar

صلاح

"Anyone who has never made a mistake has never tried anything new."

Albert Einstein

#4

أعذرني على التأخير الحاصل

لكن لا حيلة لي تجاه هذا الأمر

مشكلة الكهرباء لدينا في غزة تجعل الوضع صعب بالنسبة لي

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

#5

لاتوجد أي مشكلة أخي العزيز علاء, وربك هو العالم مافي القلوب. أتمنا لك التوفيق

أتمني أن نحاول معناً على حل هذه المشكلة

تحياتي

صلاح

"Anyone who has never made a mistake has never tried anything new."

Albert Einstein

#6

رفع الموضوع .. المشكلة مستمره

"Anyone who has never made a mistake has never tried anything new."

Albert Einstein

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