Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Typing with Default language on edittext

Enthusiast ,
Dec 06, 2021 Dec 06, 2021
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 language
Meaning I want to make the device language Arabic 
when writing inside the Edittext
TOPICS
Actions and scripting , SDK
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 09, 2021 Dec 09, 2021

@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

...
Translate
Adobe
Community Expert ,
Dec 06, 2021 Dec 06, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 06, 2021 Dec 06, 2021

There is a code that writes numbers only in the edittext. I want a code that writes Arabic when writing inside the edittext

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 08, 2021 Dec 08, 2021

@Omar.Fathy , @Zaid Al Hilali

ليس بالامكان السماح بالأحرف العربية فقط في مربع نص التحرير باستخدام اكود الجافا سكربت للفوتوشوب

that it is not possible to allow Arabic characters only in the editing text box

using the javascript code for Photoshop.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2021 Dec 08, 2021

هل بإمكانك رفع صورة للعمل في الفوتوشوب، او هل تستطيع وضع الاستمارة ذاتها لنرى كيف ممكن نساعدك اكثر

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 09, 2021 Dec 09, 2021

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

اريد مثل هذا الكود ولكن يكتب حروف عربى فقط

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();

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2021 Dec 09, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 09, 2021 Dec 09, 2021

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

@Stephen Marsh 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2021 Dec 09, 2021

@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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 09, 2021 Dec 09, 2021

@Stephen Marsh 

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();

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2021 Dec 09, 2021

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

 

https://extendscript.docsforadobe.dev/user-interface-tools/environment.html#environment-keyboard-sta...

 

https://github.com/MarshySwamp/ScriptUI-Prompt-Window-Integer/blob/main/ScriptUI-Prompt-Window-Integ...

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 10, 2021 Dec 10, 2021

Starting regex [ character is one too many / edit your post if you are allowed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 10, 2021 Dec 10, 2021

Kukurykus

I did not understand what you mean..

and how to edit the post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 10, 2021 Dec 10, 2021

You don't have enough posts to be allowed to edit own and correct mistake before ^ character.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 10, 2021 Dec 10, 2021

Kukurykus

what mistake before ^ character ??

The code works with me, it only accepts Arabic letters and numbers

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 10, 2021 Dec 10, 2021

Use it without first second [ character as it is not needed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 10, 2021 Dec 10, 2021

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??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 10, 2021 Dec 10, 2021

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 10, 2021 Dec 10, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 10, 2021 Dec 10, 2021
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 10, 2021 Dec 10, 2021
LATEST

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 07, 2021 Dec 07, 2021

I want to set Operation system language to Arabic when type on edittext .. it is possible or not

quote

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2021 Dec 07, 2021

اخي محمد، ممكن توضحلي عن اي برنامج تتحدث، هل تقصد فوتوشوب على الايباد او على جهاز منضدي مثلاً، كذلك لم أفهم المقصود بسؤالك، فالذي فهمته انك تريد الفوتوشوب يتقبل العربي والانجليزي دونما توجيه بشري

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

مع ذلك انتظر توضيحك

تحياتي

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 07, 2021 Dec 07, 2021

 اخي الكريم انا اتحدث عن برنامج الفوتوشوب علي جهاز كمبيوتر .. 

انا لدي فورم به ايديت تيكست لكتابة اي شي بداخله والمفروض أن هناك اكواد تجعل التكست بوكس يقوم بكتابة ارقام فقط .. انا اريد عند القيام بالكتابة داخل التكست بوكس أن يكتب تلقائيا باللغة العربية دون تدخل مني في تحويل اللغة 

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2021 Dec 08, 2021

اشكرك على التوضيح

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines