how to display Arabic Numerals instead of English ones in the page?

I'm having a report on which I have both Arabic and English numerals side-by-side and I need to diaply both. is there a way to do this?

Solution

Hi Mohamed,

Have you thought about calling javascript code to translate the numeral? I've found this piece of code that should make the conversion:

function EnglishToArabicNumerals(numberString) {
 var arabicNumers= ['?','?','?','?','?','?','?','?','?','?'];
 return numberString.replace(/[0-9]/g, function(w){
  return arabicNumers[+w];
 });
}

Does it work?

Regards,

António Pereira

Solution

António Pereira wrote:

Hi Mohamed,

Have you thought about calling javascript code to translate the numeral? I've found this piece of code that should make the conversion:

function EnglishToArabicNumerals(numberString) {
 var arabicNumers= ['?','?','?','?','?','?','?','?','?','?'];
 return numberString.replace(/[0-9]/g, function(w){
  return arabicNumers[+w];
 });
}

Does it work?

Regards,

António Pereira

Thank you António

I tried the same idea on a server action and it worked perfectly. thank you for the swift response.

here it is for others references

SyntaxEditor Code Snippet

Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(OriginalText,"0","?"),"9","?"),"8","?"),"7","?"),"6","?"),"5","?"),"4","?"),"3","?"),"2","?"),"1","?")

Hi!


On a past project I had the need to have this and I created a simple C# extension. It support converting to and from Arabic numerals.


Here you have it, in case it fits your needs

João Batista wrote:

Hi!


On a past project I had the need to have this and I created a simple C# extension. It support converting to and from Arabic numerals.


Here you have it, in case it fits your needs

Thank you João, I will give this a try.


Hi ,


Can anyone help me by  sharing sample oml for English number to Arabic number translation ,Because I tried both a which given in the above chat .But It doesn't work for me.


Thanks,

Abinaya

Hi Abinaya,

Did you try the extension (ArabicNumberConvert.xif) João Batista has shared here above in his post?

Regards,

Nordin

Hi Nordin,

 Since I am new to outsystems ,am not aware of xif extension.

Am using OS  studio 11.6.30 version .

I just tried Both a script given above.


Thanks,

Abinaya

Hi Abinaya,

Here’s a little bit of background information first.

An extension (xif file) is a way of extending your OutSystems logic with custom C# code. With the help of OutSystems Integration Studio the custom code is wrapped in an action you can reference from an OutSystems module within Service Studio.

Now, the fastest way for you to try the ArabicNumberConvert extension is to download it from this forum post and save it to your local disk. Then do the following:

1- Login to Service Center (https://environmentname/servicecenter)

2- Go to Factory >> Extensions

3- Click ‘Upload & Publish an Extension’ and upload and publish the ArabicNumberConvert.xif file from your local disk

You will now have it available in your environment

4- Open your module in which you want to use the extension in Service Studio

5- Click ‘Manage Dependencies’ and look for the ArabicNumberConvert extension

6- Select and add the action that does the converting

Now you will have the Convert action (from the extension) available in your OutSystems module and you can implement it in your logic.

Hope this helps!

Regards,

Nordin


Hi Nordin,

Thank you so much for your swift response with this huge information  .
Let me  try this in my application.


Thanks,

Abinaya