0

I am developing android app to send pre-defined sms in urdu. I successfully send in english but I need to know that how can i write urdu string in C#

I know a way to convert each urdu character UTF_8 to string, e.g.

char aleph ;
char ra;
char dal;
char wao;
string word;
aleph = '\u0627';
ra = '\u0631';
dal = '\u062F';
wao = '\u0648';
word = aleph.ToString() + ra.ToString()+dal.ToString()+ wao.ToString();

As described Here But its a very hectic way, is there another way around?

Or is there a way to translate English string to Urdu in C#?

Umar Farooq
  • 241
  • 2
  • 10
  • Android and C#? your question need some more explanation – Abubakar Aug 05 '18 at 14:01
  • i am developing using xamarin with visual studio using c# – Umar Farooq Aug 05 '18 at 14:02
  • In C#, you can put all the UTF_8 characters in one string: string s="\u0627\u0631\u0046"; – Jean-Claude Colette Aug 05 '18 at 15:20
  • C# strings can contain Urdu without any need for encoding or translation. `var s = "ہیلو"`. Note that any string in any language can be displayed left-aligned or right-aligned, is that what you are trying to do? Please explain what your goal is, not just what you are doing. – Dour High Arch Aug 05 '18 at 16:18
  • you can use to translate the english string using google translator to Urdu use api of google translator or another way as you think better. following link may help asked before here https://stackoverflow.com/questions/2246017/using-google-translate-in-c-sharp – Arslan Ali Aug 05 '18 at 19:33
  • @DourHighArch i have mentioned in my question that i am developing android app to send pre-defined sms in urdu, how can i right align urdu? – Umar Farooq Aug 06 '18 at 09:41
  • @Jean-ClaudeColette it helps out but how can i align the text to right because urdu starts from right to left – Umar Farooq Aug 06 '18 at 09:42

1 Answers1

0

Umar, salaams

As already stated, just set the string to the Urdu text you need.

But if what you are asking is about how to display an Urdu keyboard for text entry you have to change the device's culture.

Here is a link on the subject:https://forums.xamarin.com/discussion/9764/how-to-set-a-global-cultureinfo-for-an-app

scroll down to the answer about how to do this for Android.

Ibrahim Malluf
  • 657
  • 4
  • 6