Lazarus

Free Pascal => Beginners => Topic started by: pascal111 on May 11, 2021, 06:11:36 pm

Title: Displaying Arabic on Console
Post by: pascal111 on May 11, 2021, 06:11:36 pm
حاولتُ طباعة عدة عبارات عن طريق writeln على الـ console ولكن لم تظهر إلا علامات إستفهام مكان النّص حيث كانت العبارات المطلوب طباعتها عربيّة فهل الـ console لا يعرض إلى الـ Ascii code فقط؟

google translate:

"I tried to print several expressions using writeln on the console, but only question marks appeared in the place of the text, as the expressions to be typed were in Arabic, so is the console not only displayed in "except" the Ascii code?"

Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes
  10.   { you can add units after this };
  11.  
  12. begin
  13.  
  14.   writeln('هل تقرأ السطر الحالي؟');
  15.   writeln('ماذا تجد؟ كلمات ،وهل تراها جيّداً؟');
  16.   writeln('ماذا تقولُ هذه الكلمات؟ ليس أكثر من الإستفسار عن إذا كنت تقرؤها أم لا ،إنّها الشيء من اللاشيء!');
  17.  
  18.   writeln;
  19.  
  20.   writeln('Do you read the current line?');
  21.   writeln('What do you find? Words, and do you see them well?');
  22.   writeln('What do these words say? It is nothing more than asking if you are reading it or not, it is something out of nothing!');
  23. end.
  24.  
  25.  


(https://i.postimg.cc/N2jwYccg/Screenshot-at-2021-05-11-18-05-50.png) (https://postimg.cc/N2jwYccg)
Title: Re: Displaying Arabic on Console
Post by: marcov on May 11, 2021, 06:23:17 pm
Try putting {$codepage utf8} after the {$mode line.
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 11, 2021, 06:34:13 pm
Try putting {$codepage utf8} after the {$mode line.

للأسف لم يعمل هذا الموجّه ،نتيجة التنفيذ كما هي.

google translate:

"Unfortunately this router "directive" did not work, as a result of implementation "running" as is."
Title: Re: Displaying Arabic on Console
Post by: Martin_fr on May 11, 2021, 06:45:15 pm
(if you are (still) on Linux, then) Try it from a terminal outside the IDE.

Just in case the build in IDE console window has a problem.
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 11, 2021, 07:16:39 pm
(if you are (still) on Linux, then) Try it from a terminal outside the IDE.

Just in case the build in IDE console window has a problem.

مازلتُ على الـ Linux فليس لديّ نسخة Windows مُرخّصة للإستخدام الشخصي.

قُمتُ بعمل compile للبرنامج فحاولتُ تشغيل ملفه التنفيذي مُتوقّعاً أن يعمل على الـ Terminal ولكنّني لم أرى أيّ أثرٍ ﻷيّ تنفيذ ولم تُفتح نافذة الـ Terminal أصلاً ،ثمّ ظننتُ أنّكـ تقصد مُحاولة تنفيذ ذلكـ عن طريق مُترجم fpc على الـ Terminal فنفّذت الأوامر التالية ولكن النتيجة كما هو موضّح أدناه:

google translate:

"I'm still on Linux as I do not have a licensed copy of Windows for personal use.

I "made a" compile the program and tried to run its executable file expecting it to work on the terminal, but I did not see any trace "effect" of any execution and the terminal window did not open at all, then I thought that you intended to try to implement run it via the fpc compiler on the terminal, so I executed the following commands, but the result is as shown Below:"

Code: Bash  [Select][+][-]
  1. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common$ fpc ./project1.lpr
  2. Free Pascal Compiler version 3.2.0 [2020/07/07] for x86_64
  3. Copyright (c) 1993-2020 by Florian Klaempfl and others
  4. Target OS: Linux for x86-64
  5. Compiling ./project1.lpr
  6. Fatal: Cannot open file "project1.lpr"
  7. Fatal: Compilation aborted
  8. Error: /usr/bin/ppcx64 returned an error exitcode
  9. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common$
  10.  
  11.  
Title: Re: Displaying Arabic on Console
Post by: Martin_fr on May 11, 2021, 07:54:47 pm
You can compile in the IDE.

After compile (if there was no error) you open a Terminal, and change into the project folder.

The exe may either be
./project
or
./lib/x86-64/project
or similar
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 11, 2021, 08:31:51 pm
You can compile in the IDE.

After compile (if there was no error) you open a Terminal, and change into the project folder.

The exe may either be
./project
or
./lib/x86-64/project
or similar

فهمتُ ما تعنيه ،إنّكـ تعني أن يتم تنفيذ البرنامج على الـ Terminal بعد فتح الـ  Terminal أي أن يكون التنفيذ من خلاله وليس كما كُنتُ أظنّ أنّ الـ Terminal سينفتح تلقائيّاً عند النقر على أيقونة البرنامج المُترجم أو التنفيذي.

أودّ التنبيه كذلكـ أنّني في محاولتي التي ذكرتها في الـ post السّابق قد أحدثتُ خطأً إذ لمّا حاولت ترجمة البرنامج بـ fpc لم أكن وصلت بعد إلى مُجلّد البرنامج الصحيح بل كنتُ خارجاً في المُجلّد الذي قبله. عُموماً صححتُ تجربتي وقُمتُ بتنفيذ تعليماتكـ والبرنامج قد عمل بالفعل على الـ Terminal ولكن مازالت مُشكلة عرض النّص العربي قائمة فلم تظهر بعد الحروف العربيّة ومازالت علامات الإستفهام تظهر بالنيابة عنها.

google translate:

"I understood what you mean, you mean that the program is executed on the terminal after opening the terminal, meaning that the execution is through it and not as I had thought that the terminal would open automatically when clicking on the compiler "compiled" or executable program icon.

I would also like to warn "mention" that in my attempt that I mentioned in the previous post, I made an error as when I tried to compile the program with fpc, I did not yet reach the correct program directory, but I was out in the previous folder. In general, I corrected my experience "try" and implemented "ran" your instructions, and the program has already worked on the terminal, but the problem of displaying the Arabic text is still present, and it did not appear after "yet" the Arabic letters, but the question marks still appear on its behalf "instead of it"."

Code: Bash  [Select][+][-]
  1. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 8$ fpc ./project1.lpr
  2. Free Pascal Compiler version 3.2.0 [2020/07/07] for x86_64
  3. Copyright (c) 1993-2020 by Florian Klaempfl and others
  4. Target OS: Linux for x86-64
  5. Compiling ./project1.lpr
  6. project1.lpr(9,3) Fatal: Can't find unit Interfaces used by project1
  7. Fatal: Compilation aborted
  8. Error: /usr/bin/ppcx64 returned an error exitcode
  9. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 8$ dir
  10. backup  project1      project1.lpi  project1.lps  unit1.lfm
  11. lib     project1.ico  project1.lpr  project1.res  unit1.pas
  12. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 8$ ./project1
  13.  
  14. (project1:11015): GLib-GIO-CRITICAL **: 20:18:30.475: g_dbus_proxy_new: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
  15. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 8$ cd..
  16. cd..: command not found
  17. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 8$ cd ../
  18. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common$ dir
  19. Project\ 1  Project\ 3  Project\ 5  Project\ 7  Project\ 9
  20. Project\ 2  Project\ 4  Project\ 6  Project\ 8  Projects\ description
  21. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common$ cd Project\ 9
  22. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 9$ dir
  23. lib  project1  project1.lpi  project1.lpr  project1.lps
  24. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 9$ fpc ./project1.lpr
  25. Free Pascal Compiler version 3.2.0 [2020/07/07] for x86_64
  26. Copyright (c) 1993-2020 by Florian Klaempfl and others
  27. Target OS: Linux for x86-64
  28. Compiling ./project1.lpr
  29. Linking project1
  30. 25 lines compiled, 0.4 sec
  31. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 9$ dir
  32. lib  project1  project1.lpi  project1.lpr  project1.lps  project1.o
  33. pascal@pascal-Lenovo-ideapad-330-15AST:~/Computer/Lazarus/Lazarus Projects/Studying Projects/Common/Project 9$ ./project1
  34. ?? ???? ????? ???????
  35. ???? ???? ????? ???? ????? ???????
  36. ???? ????? ??? ???????? ??? ???? ?? ????????? ?? ??? ??? ?????? ?? ?? ?????? ????? ?? ???????!
  37.  
  38. Do you read the current line?
  39. What do you find? Words, and do you see them well?
  40. What do these words say? It is nothing more than asking if you are reading it or not, it is something out of nothing!
  41.  
  42.  
Title: Re: Displaying Arabic on Console
Post by: engkin on May 11, 2021, 10:58:30 pm
Can you check if the number of question marks matches the number of letters in each word?

If they match, I suggest the problem is in the font.
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 11, 2021, 11:10:50 pm
Can you check if the number of question marks matches the number of letters in each word?

If they match, I suggest the problem is in the font.

لقد قُمتُ بعد علامات الإستفهام بعد تغيير العبارات لعبارة أقصر ليكون حلّكـ عمليّاً فكانت علامات الإستفهام على نفس عدد حروف العبارة. أظنّ كما قلتَ أنّ المشكلة في الخط ولكن كيف يُمكن تغيير الخط أو ضبطه هنا؟


google translate:

"I followed "counted" the question marks after changing the phrases for a shorter phrase to make your solution practical, so the question marks were the same number of letters of the sentence "word". I think, as you said, the problem is in the line "font", but how can "I change or adjust" the font be changed or set here?"

Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4. {$codepage utf8}
  5.  
  6. uses
  7.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  8.   cthreads,
  9.   {$ENDIF}{$ENDIF}
  10.   Classes
  11.   { you can add units after this };
  12.  
  13. begin
  14.  
  15.   {writeln('هل تقرأ السطر الحالي؟');
  16.   writeln('ماذا تجد؟ كلمات ،وهل تراها جيّداً؟');
  17.   writeln('ماذا تقولُ هذه الكلمات؟ ليس أكثر من الإستفسار عن إذا كنت تقرؤها أم لا ،إنّها الشيء من اللاشيء!');
  18.  
  19.   writeln;
  20.  
  21.   writeln('Do you read the current line?');
  22.   writeln('What do you find? Words, and do you see them well?');
  23.   writeln('What do these words say? It is nothing more than asking if you are reading it or not, it is something out of nothing!');}
  24.  
  25.   writeln('مرحبا');
  26. end.
  27.  
  28.  
  29.  


(https://i.postimg.cc/v17M42jk/Screenshot-at-2021-05-11-23-05-27.png) (https://postimg.cc/v17M42jk)
Title: Re: Displaying Arabic on Console
Post by: engkin on May 11, 2021, 11:39:45 pm
I am a Windows user, don't know how to do that on Linux.
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 11, 2021, 11:50:10 pm
I am a Windows user, don't know how to do that on Linux.

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

هل تستوعب ما قلتُ أم الترجمة غير واضحة ولو كتبتها لكـ بالإنجليزيّة فهل ستقول أنّ إنجليزيتي غير مفهومة؟

google translate:

"However, you know the suggestion of counting letters in "of" Arabic words that are not separated by letters and have accent marks that do not appear well on their letters, commas, punctuation marks, and spaces.

Do you understand what I said, or the translation is not clear, and if I wrote it for you in English, would you say that my English is not understood?"
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 12:07:24 am
I do understand your replies. First you confirmed the match between the number of letters and the corresponding question marks. Next you asked how to change the font. My previous reply was to admit to the fact that I do not know how to change the font used in terminal/console window on Linux. Hopefully a more knowledgeable member will point out the way to change the font.
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 12:20:16 am
I do understand your replies. First you confirmed the match between the number of letters and the corresponding question marks. Next you asked how to change the font. My previous reply was to admit to the fact that I do not know how to change the font used in terminal/console window on Linux. Hopefully a more knowledgeable member will point out the way to change the font.


معكـ حق فيبدو أنّ لغتكـ الأصليّة ليست الإنجليزيّة النقيّة ﻷنّ الرجل الإنجليزي يتفهّم العربيّة الخام.

العربيّة النقيّة غامضة مثل الإنجليزيّة النقيّة.

عموماً إفترضتُ أنّهُ لمّا إقترحتَ إقتراحكـَ أنّ في جُعبتكـ الحل كذلكـ إنْ صدقكـ ظنّكـ وكانت المشكلة هي في نوع الخط ﻷنّكـ ما كُنت لتعرض إقتراحاً كهذا لو لم تكن تعلم الحل في الخطوة التالية لصدق الأمر المُحتمل.

google translate:

"You are right, it seems that your native language is not pure English, because the Englishman understands raw Arabic.

Pure Arabic is as ambiguous as pure English.

In general, I assumed that when you suggested your suggestion that you also have a solution in your pocket, if you "your thought" believed you "became true", and the problem was in the type of line "font", because you would not have presented such a proposal "suggestion" if you had not known the solution in the next step, "of" the possible matter would be validated."
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 12:48:01 am
Usually a problem similar to yours is going to be caused by one of two possible reasons:
1-Wrong code page.
2-A font that does not include the correct glyphs.

This is logical and not related to the OS, Windows or Linux.

The same way you assumed I have the solution, I also assumed you know how to change the font, or at least to look it up and learn how to do that.
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 12:57:39 am
Which distribution of Linux are you using?
I just did a quick search and changing the font seems fairly easy.
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 12:59:28 am
Usually a problem similar to yours is going to be caused by one of two possible reasons:
1-Wrong code page.
2-A font that does not include the correct glyphs.

This is logical and not related to the OS, Windows or Linux.

The same way you assumed I have the solution, I also assumed you know how to change the font, or at least to look it up and learn how to do that.

بغض النّظر عمّا حدث فالآن تكلّمت كلاماً به فن ،لا بأس ،إنسى ما حدث ،سوف أبحث عن حل لتغيير الخط في بيئة Lazarus وسأنتظر كذلكـ مُساهمة أحد الأعضاء في ذلكـ وإن لم أصل إلى نتيجة فيُمكنني تناسي موضوع هذه الصفحة الإلكترونيّة فلن يكون تأثير نقصه مُعضلاً غير أنّنا لو عرفنا الحل فسيكون ذلكـ إضافة جيّدة.

google translate:

"Regardless of what happened, now I "You" have spoken a words about it, "have" art, it is okay, forget what happened, I will look for a solution to change the line "font" in the Lazarus environment and I will wait as well - the contribution of one of the members in that. "and if I didn't reach to a result I can forget the topic of this electronic page for its minus won't affect much" "but" If we knew the solution, that would be a good plus."
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 01:01:22 am
Which distribution of Linux are you using?
I just did a quick search and changing the font seems fairly easy.

Linux Mint
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 01:12:57 am
When.it comes to programming, there is no sensitivity. If I say something wrong, I don't mind getting corrected. It could seem harsh or not that polite, but it is not. The point is to pass information to the second party.

In your previous reply you said:
Quote
I will look for a solution to change the line "font" in the Lazarus environment

In a terminal/console application, Lazarus has nothing to do with the font. It is a Linux setting. This is unlike GUI applications where you can control the font.

The summary here, use search terms like "linux change terminal font"
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 01:16:13 am
Which distribution of Linux are you using?
I just did a quick search and changing the font seems fairly easy.

Linux Mint

Would it be possible to try this:
 https://forums.linuxmint.com/viewtopic.php?t=184660
Title: Re: Displaying Arabic on Console
Post by: Gustavo 'Gus' Carreno on May 12, 2021, 08:25:59 am
Hey all,

Most of the console/terminal/command line applications in Linux use a Monospaced Font.
تستخدم معظم تطبيقات سطر الأوامر / الوحدة الطرفية / الأوامر في Linux الخط أحادي المسافة.

This may be problematic if the Arabic symbols cannot be represented in a Monospaced Font.
قد يكون هذا مشكلة إذا كان لا يمكن تمثيل الرموز العربية في خط أحادي المسافة.

The Arabic written language is full of ligatures that could pose issues when applied to a Monospaced Font.
تمتلئ اللغة العربية المكتوبة بالأحرف المركبة التي يمكن أن تثير مشاكل عند تطبيقها على خط أحادي المسافة.

Also the Right To Left doesn't help...
كما أن اليمين إلى اليسار لا يساعد ...

But if the Lazarus TSynEdit is able to display the Arabic, then there's hope, since the editor is also using a Monospaced font.
ولكن إذا كان Lazarus TSynEdit قادرًا على عرض اللغة العربية ، فهناك أمل ، لأن المحرر يستخدم أيضًا خطًا أحادي المسافة.

@Pascal111: Can I ask you if you could report back with 2 things?:
هل يمكنني أن أسألك عما إذا كان بإمكانك الإبلاغ عن شيئين؟

Many thanks !!

Cheers,
Gus

PS: I hope the Google Translate didn't offend Pascal111 with it's interpretation of the English and the technical!!
ملاحظة: آمل ألا تسيء ترجمة Google إلى Pascal111 بتفسيرها للغة الإنجليزية والتقنية !!
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 02:16:43 pm
When.it comes to programming, there is no sensitivity. If I say something wrong, I don't mind getting corrected. It could seem harsh or not that polite, but it is not. The point is to pass information to the second party.

ليس من قسوةٍ كما تفضّلت في تصويب الغير للشخص في تعليم البرمجة إن كان الشخص مُخطأً ﻷنّ هذا يخدم تعليم هذا الفن والعلم الراقي الحديث ويؤدّي إلى نشره للإرتقاء بالعقول والأذواق ولكنّ الأهم النيّة التعليميّة ألّا تكون مُضلّلة ومُسببة للعجز.

google translate:

"There is no cruelty as I "you" preferred "granted" in correcting others for the person in teaching programming if the person is wrong, because this serves the teaching of this modern art and science and leads to spreading it to raise minds and tastes, but the most important "is that the " educational intention is not to be misleading and incapacitating."

In your previous reply you said:
Quote
I will look for a solution to change the line "font" in the Lazarus environment

In a terminal/console application, Lazarus has nothing to do with the font. It is a Linux setting. This is unlike GUI applications where you can control the font.

The summary here, use search terms like "linux change terminal font"

أرى الأمر الآن ،ليس الأمر من إختصاص بيئة Lazarus.

google translate:

"Now I see it, it's not in Lazarus' environment."

Which distribution of Linux are you using?
I just did a quick search and changing the font seems fairly easy.

Linux Mint

Would it be possible to try this:
 https://forums.linuxmint.com/viewtopic.php?t=184660

إتّبعت الخطوات كما في الرابط الذي زوّدتني به وكان الخط هو Monospace Regular 12.

google translate:

"I followed the steps as in the link you gave me and the font was Monospace Regular 12."
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 05:07:42 pm
Hey all,

Most of the console/terminal/command line applications in Linux use a Monospaced Font.
تستخدم معظم تطبيقات سطر الأوامر / الوحدة الطرفية / الأوامر في Linux الخط أحادي المسافة.

This may be problematic if the Arabic symbols cannot be represented in a Monospaced Font.
قد يكون هذا مشكلة إذا كان لا يمكن تمثيل الرموز العربية في خط أحادي المسافة.

The Arabic written language is full of ligatures that could pose issues when applied to a Monospaced Font.
تمتلئ اللغة العربية المكتوبة بالأحرف المركبة التي يمكن أن تثير مشاكل عند تطبيقها على خط أحادي المسافة.

Also the Right To Left doesn't help...
كما أن اليمين إلى اليسار لا يساعد ...

ربّما تعني نوع الخط الذي ذكرتُهُ في المشاركة السالفة والذي هو Monospace Regular 12.

google translate:

"Maybe it "you" means the type of font that I mentioned in the previous post which is Monospace Regular 12."

But if the Lazarus TSynEdit is able to display the Arabic, then there's hope, since the editor is also using a Monospaced font.
ولكن إذا كان Lazarus TSynEdit قادرًا على عرض اللغة العربية ، فهناك أمل ، لأن المحرر يستخدم أيضًا خطًا أحادي المسافة.

يبدو أنّ الـ TSynEdit إضافة جيّدة ولكنّني لم أُجرّبها ويبدو أنّها مُتعلّقة بواجهة الإستخدام الرسوميّة وليس ببرامج الـ console.

google translate:

"TSynEdit seems to be a good plugin "addition" but I haven't tried it and it appears to be related to the GUI rather than the console "programs"."

@Pascal111: Can I ask you if you could report back with 2 things?:
هل يمكنني أن أسألك عما إذا كان بإمكانك الإبلاغ عن شيئين؟
  • The font name and size you're using on Lazarus
    اسم الخط وحجمه اللذين تستخدمهما في Lazarus
  • The font name and size that you're using in your console/terminal/command line app.
    اسم الخط وحجمه الذي تستخدمه في تطبيق سطر الأوامر / وحدة التحكم / المحطة / الأوامر.
    You can find it on the Setup or Settings or Configure area.
    يمكنك العثور عليه في منطقة الإعداد أو الإعدادات أو التكوين.

Many thanks !!

Cheers,
Gus


أخبرتكـ أعلاه عن نوع الخط الخاص بالـ Terminal ولكنّني لم أجد أين يُمكن ضبط خيار الخط في بيئة Lazarus.

google translate:

"I told you above about the font type for Terminal, but I couldn't find where to set the font option in the Lazarus environment."


PS: I hope the Google Translate didn't offend Pascal111 with it's interpretation of the English and the technical!!
ملاحظة: آمل ألا تسيء ترجمة Google إلى Pascal111 بتفسيرها للغة الإنجليزية والتقنية !!

لتُترجم من الإنجليزيّة إلى العربيّة فالموضوع أكثر صعوبة من أن تُترجم من العربيّة إلى الإنجليزيّة بسبب التراكيب العربيّة المتنوعة ومُرونة اللغة العربيّة وبالتالي ستكون العبارات المُترجمة من الإنجليزيّة إلى العربيّة عن طريق الإعتماد على google translate مُعجمة ومُفكّكة التراكيب والمنطق وليس لها دلالة أو معنى sense. لا ألومكـ فالعربيّة أصعب لغة يُمكن تعلّمها. لن تحتاج إستخدام ميزة من اليمين إلى اليسار فقط لتضبط النّص العربي بل ستحتاج إلى ميزة "RTL".

google translate:

"To be translated from English to Arabic, the topic is more difficult than to translate from Arabic into English due to the diverse Arabic structures and the flexibility of the Arabic language. Therefore, the phrases translated from English into Arabic by relying on google translate will be lexical "not clear nor understood and not belong to the Arabic language nature", disassembled "in" structures and logic, and have no meaning or meaning "sense". I don't blame you, Arabic is the hardest language to learn. You will not need to use the right-to-left feature only to control the Arabic text, but you will need the "RTL" feature."
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 06:20:28 pm
"Monospace Regular" is not a font name according to this Linux Mint fourm post:
https://forums.linuxmint.com/viewtopic.php?t=259621


Title: Re: Displaying Arabic on Console
Post by: winni on May 12, 2021, 06:56:50 pm
Hi!

Here is the monospaced Arabic typeface Kawkab:


https://github.com/aiaf/kawkab-mono (https://github.com/aiaf/kawkab-mono)

Winni
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 08:15:32 pm
Hi!

Here is the monospaced Arabic typeface Kawkab:


https://github.com/aiaf/kawkab-mono (https://github.com/aiaf/kawkab-mono)

Winni

Thanks!
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 12, 2021, 08:21:06 pm
"Monospace Regular" is not a font name according to this Linux Mint fourm post:
https://forums.linuxmint.com/viewtopic.php?t=259621

لن تُصدّق!
إكتشفتُ شيئاً ،المُشكلة ليست من الـ Terminal فلقد نصّبت Terminal آخر بعد البحث يُدعّم العربيّة والـ RTL وأظهر الحروف العربيّة لنصٍ كتبته ولكن تنفيذ برنامج الـ Lazarus الذي كتبته في أوّل مشاركةٍ في هذ الموضوع حروفه العربيّة لا تظهر إلا كعلامات إستفهام  ،إذاً المُشكلة ليست من الـ Terminal ،العيب في البرنامج نفسه!

google translate:

"you will not believe!
I discovered something, the problem is not from "in" the terminal, so I installed another terminal after searching that supports Arabic and RTL and showed the Arabic letters for a text I wrote, but the implementation "running" of the Lazarus program that I wrote in the first post on this topic, the Arabic letters only appear as question marks, so the problem is not from "in" the Terminal , The defect in the program itself!"


(https://i.postimg.cc/9r697HjL/Screenshot-at-2021-05-12-20-14-06.png) (https://postimg.cc/9r697HjL)
Title: Re: Displaying Arabic on Console
Post by: engkin on May 12, 2021, 09:20:32 pm
Yes, I agree, your last picture points to a problem in the program itself.
Title: Re: Displaying Arabic on Console
Post by: tetrastes on May 12, 2021, 10:24:30 pm
"you will not believe!
I discovered something, the problem is not from "in" the terminal, so I installed another terminal after searching that supports Arabic and RTL and showed the Arabic letters for a text I wrote, but the implementation "running" of the Lazarus program that I wrote in the first post on this topic, the Arabic letters only appear as question marks, so the problem is not from "in" the Terminal , The defect in the program itself!"


(https://i.postimg.cc/9r697HjL/Screenshot-at-2021-05-12-20-14-06.png) (https://postimg.cc/9r697HjL)

No, defect is not in program. See attachment, this is the output of your first program.

What is the output of "locale" command on your system? It seems that your locale is not UTF-8.
Title: Re: Displaying Arabic on Console
Post by: marcov on May 12, 2021, 10:26:41 pm
Yes, I agree, your last picture points to a problem in the program itself.

As Tetrastes already hints, if the locale is an non unicode locale that supports arabic this might happen.

A possible workaround is adding clocale to the uses clause.
Title: Re: Displaying Arabic on Console
Post by: tetrastes on May 12, 2021, 10:57:16 pm
Very strange. I added
Code: Pascal  [Select][+][-]
  1. {$codepage utf8}
to your first code, and the output was question marks instead of arabic letters.
Is this bug in fpc? (I have 3.2.0 linux x86_64)
Title: Re: Displaying Arabic on Console
Post by: marcov on May 12, 2021, 11:15:59 pm
Easiest to debug a particular setup is to see what bytes are sent to the console using strace.
Title: Re: Displaying Arabic on Console
Post by: tetrastes on May 13, 2021, 12:13:37 am
Very strange. I added
Code: Pascal  [Select][+][-]
  1. {$codepage utf8}
to your first code, and the output was question marks instead of arabic letters.
Is this bug in fpc? (I have 3.2.0 linux x86_64)
After searching documentation https://wiki.lazarus.freepascal.org/Unicode_Support_in_Lazarus I found that it is not a bug  :) :
Quote
What happens when I use $codepage utf8?
FPC has very limited UTF-8 support. In fact, FPC only supports storing literals as either "default" encoded 8-bit strings or widestrings. So any non default codepage is converted to widestring, even if it is the system codepage. For example most Linux/Mac/BSD use UTF-8 as system codepage. Passing -Fcutf8 to the compiler will store the string literal as widestring.

At run time the widestring literal is converted. When you assign the literal to an AnsiString the widestring literal is converted using the widestringmanager to the system encoding. The default widestringmanager under Unix simply converts the widechars to chars, destroying any non ASCII character. You must use a widestringmanager like the unit cwstring to get correct conversion. Unit LazUTF8 does that.


So it is better not to use $codepage directive at all.
Title: Re: Displaying Arabic on Console
Post by: Gustavo 'Gus' Carreno on May 13, 2021, 07:44:35 am
Hey Pascal111,

First of all I'm sorry that I used Google Translate to murder Arabic :) I'll never do it again, promise  :-[
Second of all I want to apologise because I'm not gonna quote reply to your post. I got a bit lost.

Ok, so after reading that Pascal111 doesn't know where is the Lazarus font for the Editor, and my need to know what font I'm using on MY gnome-terminal I screenshotted the included images.

The first image is the Default Profile of gnome-terminal where you can find(to my utter surprise) that the font is NOT, I repeat NOT Monospace Regular 12. It only BECOMES that if you tick the Custom Font check box close to it.

This means that you'll have to find out what is the default Ubuntu system font for the gnome-terminal another way. One I haven't found yet.

The second image is where you, Pascal111, can find the font that Lazarus uses in it's TSynEdit component.
You go to Tools->Options and then click on (1)Display and on (2)Default editor font you can see that I've changed mine to Fira Code.

And BTW, Pascall111, when I mentioned TSynEdit it was in the context of that component being the one that Lazarus depends for it's editor.

All this to go nowhere I suppose since I can't help any further without finding what is the system font that gnome-terminal uses and then compare it with the one that TSynEdit is using on Lazarus.

I'll probably report back once I find out where to assess what the default Monospace font is for gnome-terminal.

Cheers,
Gus
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 13, 2021, 12:40:45 pm
Hey Pascal111,

First of all I'm sorry that I used Google Translate to murder Arabic :) I'll never do it again, promise  :-[
Second of all I want to apologise because I'm not gonna quote reply to your post. I got a bit lost.

أنت رجل حُر ،كُنتُ أعني أن تكون الترجمة مفهومة ولذا أظنّ أن الترجمة الأنسب هي بترجمة عبارة عبارة.

google translate:

"You are a free man, I meant that the translation was "to be" understandable and so I think the most appropriate translation is to translate the phrase "by" phrase."

Ok, so after reading that Pascal111 doesn't know where is the Lazarus font for the Editor, and my need to know what font I'm using on MY gnome-terminal I screenshotted the included images.

The first image is the Default Profile of gnome-terminal where you can find(to my utter surprise) that the font is NOT, I repeat NOT Monospace Regular 12. It only BECOMES that if you tick the Custom Font check box close to it.

This means that you'll have to find out what is the default Ubuntu system font for the gnome-terminal another way. One I haven't found yet.

The second image is where you, Pascal111, can find the font that Lazarus uses in it's TSynEdit component.
You go to Tools->Options and then click on (1)Display and on (2)Default editor font you can see that I've changed mine to Fira Code.

And BTW, Pascall111, when I mentioned TSynEdit it was in the context of that component being the one that Lazarus depends for it's editor.

All this to go nowhere I suppose since I can't help any further without finding what is the system font that gnome-terminal uses and then compare it with the one that TSynEdit is using on Lazarus.

I'll probably report back once I find out where to assess what the default Monospace font is for gnome-terminal.

Cheers,
Gus

لقد حللتُ مُشكلة الـ Terminal حيث أزلتُ مُوجّه {$codepage utf8}  فظهرت الحروف العربيّة على الـ Terminal إلّا أنّها مُفكّكة وتحتاج إلى ميزة RTL فنفّذت نفس البرنامج على Terminal آخر يُدعّم العربيّة بميزة الـ RTL فظهرت الكلمة مُنسّقة وكذلكـ تتبعتُ الخطوات التي أشرتَ إليها لمعرفة نوع الخط في بيئة Lazarus وأحضرت الخط وهو Courier New ومع هذه المشاركة صور توضيحيّة لما حدث.

google translate:

"I solved the Terminal problem where I removed the {$ codepage utf8} directive, so the Arabic letters appeared on the Terminal, but they are disjointed and need the RTL feature "So I used another terminal with RTL feature". "I followed your steps to know font of" Lazarus environment and brought in the font which is Courier New and with this post illustrations "images" of what happened."

(https://i.postimg.cc/Z92z0K1q/Screenshot-at-2021-05-13-12-19-27.png) (https://postimg.cc/Z92z0K1q)

(https://i.postimg.cc/jwhVcQDD/Screenshot-at-2021-05-13-12-28-02.png) (https://postimg.cc/jwhVcQDD)
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 13, 2021, 12:47:57 pm
Very strange. I added
Code: Pascal  [Select][+][-]
  1. {$codepage utf8}
to your first code, and the output was question marks instead of arabic letters.
Is this bug in fpc? (I have 3.2.0 linux x86_64)
After searching documentation https://wiki.lazarus.freepascal.org/Unicode_Support_in_Lazarus I found that it is not a bug  :) :
Quote
What happens when I use $codepage utf8?
FPC has very limited UTF-8 support. In fact, FPC only supports storing literals as either "default" encoded 8-bit strings or widestrings. So any non default codepage is converted to widestring, even if it is the system codepage. For example most Linux/Mac/BSD use UTF-8 as system codepage. Passing -Fcutf8 to the compiler will store the string literal as widestring.

At run time the widestring literal is converted. When you assign the literal to an AnsiString the widestring literal is converted using the widestringmanager to the system encoding. The default widestringmanager under Unix simply converts the widechars to chars, destroying any non ASCII character. You must use a widestringmanager like the unit cwstring to get correct conversion. Unit LazUTF8 does that.


So it is better not to use $codepage directive at all.

كلامكـ صحيح ،لقد فعلتها وظهرت الحروف العربيّة على الـ Terminal ولكن ليس على الـ console الخاص بالـ debug في بيئة Lazarus.

google translate:

"You're right, I did it and the Arabic letters appeared on the terminal but not on the debug console in Lazarus environment."

(https://i.postimg.cc/jwhVcQDD/Screenshot-at-2021-05-13-12-28-02.png) (https://postimg.cc/jwhVcQDD)
Title: Re: Displaying Arabic on Console
Post by: pascal111 on May 13, 2021, 12:52:55 pm
Easiest to debug a particular setup is to see what bytes are sent to the console using strace.

أظنّ أنّ هذا أبعد من معرفتي.

google translate:

"I think this is beyond my knowledge."
TinyPortal © 2005-2018