'Handle Notification Bidirectional Body Text in the Correct Way

I have a notification service that sends a notification to the client according to its language. The notification body language can be either Arabic or English. It also may have some words in the opposite language. Let's say that we have a notification template for each language that takes parameters:

English Template

${Client_Name} added ${Points_Num} good points for ${Another_Clinet_Name} because : done work ${Work_Name}

Arabic Template

أضاف ${Client_Name} نقاط جيدة لـ ${Another_Client_Name} مقابل إتمام ${Work_Name}

When we have a case where we will send an English notification but the parameters will be in Arabic, it will look like this:

السيد فلان added 5 good points for فلان آخر because: done work عمل معين

the received notification body will be misdirection image_link

I tried with Unicode Characters to solve this issue:

1: Inject \u200f before each Arabic word.

2: Inject \u061c before each Arabic word.

3: Check the first word in the text and inject \u061c before it if it's Arabic.

Is there an official or approved method to handle such an issue?

client-side: Mobile App (Flutter)

server-side: NodeJs & Firebase



Solution 1:[1]

Use \u200f right-to-left mark (RLM) to indicate RTL text-direction.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Zeitler