Copy link to clipboard
Copied
Hi Everybody ..
I want to make the language when writing in the edittext
to Arabic or English automatically
when writing inside the edittext without converting the languageMeaning I want to make the device language Arabic
when writing inside the Edittext
@Mohamed Hameed wrote:
I don't want a code that deletes numbers
I want a code only when writing inside the edittext that only accepts Arabic letters
I understand, I was commenting on the code that you found that relates to your question.
The key point being that the code in question uses a regular expression based find/replace.
You would need to look into how regular expressions work with Arabic input if using a regular expression, however, this sounds more like an extendscript/scriptUI
...Copy link to clipboard
Copied
The language is controlled by the operation system. That is means that if it is Arabic in your OS (IOS or Windows), the application will write Arabic and the same in any language so you can set your OS language.
Copy link to clipboard
Copied
There is a code that writes numbers only in the edittext. I want a code that writes Arabic when writing inside the edittext
Copy link to clipboard
Copied
ليس بالامكان السماح بالأحرف العربية فقط في مربع نص التحرير باستخدام اكود الجافا سكربت للفوتوشوب
that it is not possible to allow Arabic characters only in the editing text box
using the javascript code for Photoshop.
Copy link to clipboard
Copied
هل بإمكانك رفع صورة للعمل في الفوتوشوب، او هل تستطيع وضع الاستمارة ذاتها لنرى كيف ممكن نساعدك اكثر
Copy link to clipboard
Copied
أنا وجدت هذا الكود يقوم بكتابة ارقام فقط بدون اى حروف ..
اريد مثل هذا الكود ولكن يكتب حروف عربى فقط
I found this code that writes numbers only without any letters..
I want such a code, but it only writes Arabic letters
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,470,170],"+
"test:EditText{bounds:[10,10,360,30] , text:'' ,properties:{multiline:false,noecho:false,readonly:false}},"+
"button1:Button{bounds:[10,40,350,60] , text:'Cancel' }};"
var win = new Window(dlg,'test');
win.center();
win.test.onChanging = function() {
if (this.text.match(/[^\d]/)) {
this.text = this.text.replace(/[^\d]/g, '');
}
}
win.show();
Copy link to clipboard
Copied
That is a regular expression to remove anything that is not a digit:
0-9 or \d
It could also be used with a simple script prompt as well, it is not specific to script UI.
Copy link to clipboard
Copied
Thank you for caring
I don't want a code that deletes numbers
I want a code only when writing inside the edittext that only accepts Arabic letters
Without writing any English letters
Copy link to clipboard
Copied
@Mohamed Hameed wrote:
I don't want a code that deletes numbers
I want a code only when writing inside the edittext that only accepts Arabic letters
I understand, I was commenting on the code that you found that relates to your question.
The key point being that the code in question uses a regular expression based find/replace.
You would need to look into how regular expressions work with Arabic input if using a regular expression, however, this sounds more like an extendscript/scriptUI requirement issue that you would need to research.
Copy link to clipboard
Copied
Thank you very much for helping me
I found the code to do this, which enables me to write in Arabic letters and numbers without English letters
You don't know how happy I am.. It has proven to me that programming is a very beautiful thing
, and thinking about it is more beautiful and beautiful
Thank you again and I wish you continued success
This is the code after modification and it worked perfectly for me
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,470,170],"+
"test:EditText{bounds:[10,10,360,30] , text:'' ,properties:{multiline:false,noecho:false,readonly:false}},"+
"button1:Button{bounds:[10,40,350,60] , text:'Cancel' }};"
var win = new Window(dlg,'test');
win.center();
win.test.onChanging = function() {
this.text = this.text.replace(/[^[\u0600-\u06FF\s0-9\p{N}]/, '');
}
win.show();
Copy link to clipboard
Copied
Thank you, I'm glad that you are happy and that my answer helped you to the desired result. Please mark my answer as correct if this is the case.
P.S. Your earlier code sample used a regular expression to delete everything except digits, which works in both scriptui and system prompts for processing input.
If you are using scriptui (not prompt), there is another option, which is to use a numeric keyboard check to only allow number key input, rejecting anything that is not a digit/number key 0-9.
https://extendscript.docsforadobe.dev/user-interface-tools/scriptui-programming-model.html
Copy link to clipboard
Copied
Starting regex [ character is one too many / edit your post if you are allowed.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You don't have enough posts to be allowed to edit own and correct mistake before ^ character.
Copy link to clipboard
Copied
what mistake before ^ character ??
The code works with me, it only accepts Arabic letters and numbers
Copy link to clipboard
Copied
Use it without first second [ character as it is not needed.
Copy link to clipboard
Copied
Kukurykus I did not understand what you mean ??
But I have a question if it doesn't bother you . Is it possible to convert the device language to Arabic directly when writing inside the edittext or not??
Copy link to clipboard
Copied
Loll, how I have to tell you what I mean if I already tried that 3 times 😕
The [ character after ^ character in your regex code is uneeded, just remove it.
For the question I'll give you only a hint. When you change:
replace(/[^[\u0600-\u06FF\s0-9\p{N}]/, '');
to:
charCodeAt()
each character you type to your text box is going to be changed to its character code.
Copy link to clipboard
Copied
Kukurykus Thank you for your attention and the edit has been made
But forgive me because I am not very well versed in javascript programming ..
I did not understand the part about charCodeAt()
If it is possible to explain with a simple example to understand how the code works
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Actually you don't need to understand charCodeAt(), but if you want then better read docs yourself. That indicates where to update your code to turn typed in character to other. Now when you know it write a code that changes device language to Arabic. What ever way you'll choose is up to you...
Copy link to clipboard
Copied
I want to set Operation system language to Arabic when type on edittext .. it is possible or not
The language is controlled by the operation system. That is means that if it is Arabic in your OS (IOS or Windows), the application will write Arabic and the same in any language so you can set your OS language.
By @Omar.Fathy
Copy link to clipboard
Copied
اخي محمد، ممكن توضحلي عن اي برنامج تتحدث، هل تقصد فوتوشوب على الايباد او على جهاز منضدي مثلاً، كذلك لم أفهم المقصود بسؤالك، فالذي فهمته انك تريد الفوتوشوب يتقبل العربي والانجليزي دونما توجيه بشري
المعروف انه يجب ان تختار اللغة قبل الكتابة داخل حقل النص وهذا ينطبق على كل الاجهزة المحمولة او المنضدية
مع ذلك انتظر توضيحك
تحياتي
Copy link to clipboard
Copied
اخي الكريم انا اتحدث عن برنامج الفوتوشوب علي جهاز كمبيوتر ..
انا لدي فورم به ايديت تيكست لكتابة اي شي بداخله والمفروض أن هناك اكواد تجعل التكست بوكس يقوم بكتابة ارقام فقط .. انا اريد عند القيام بالكتابة داخل التكست بوكس أن يكتب تلقائيا باللغة العربية دون تدخل مني في تحويل اللغة
My dear brother, I am talking about Photoshop on a computer.
I have a form with an EditText to write anything inside, and it is assumed that there are codes that make the textbox write numbers only.. I want when I write inside the textbox to be written automatically in Arabic without my intervention in converting the language
Copy link to clipboard
Copied
اشكرك على التوضيح
بالنسبة للاستمارات فالمفروض ناخذها الى ادوبي اكروبات وليس فوتوشوب وبالفعل هناك بالاكروبات تستطيع ان تجعل كل حقل كتابة بالاستمارة يمتليء بأحرف او ارقام او كلاهما معاً ولكن حتى في هكذا استمارة وفي الاكروبات لايمكنك ان تفرض على الحقل ان يتم ملؤه باللغة العربية او غيرها إلا إذا نويت ان تعين جاڤا سكريبت للحقل يفرض على حقل الكتابة بأي لغة يتم ملؤه
إذا كان فمهي للأمر صحيحاً فأنت بحاجة لطرح الموضوع على منتدى اكروبات وليس هنا في منتدى فوتوشوب
Find more inspiration, events, and resources on the new Adobe Community
Explore Now