'What is the best way to convert text from different direction?

I'm creating an interface that has a list of employees with the names of each one. But in this list I'm going to have random names from all countries. And in the interface there will be two text directions LTR (Left To Right) and RTL (Right To Left).

However, I don't know the names that go into this list of employees as I'm going to take it from the database and insert it into my document and my solution was to insert the names inside each <bdi> element:

<li><bdi>Bernado Silva</bdi></li>
<li><bdi>Lucas Oliveira</bdi></li>
<li><bdi>إبرو</bdi></li>

Thus, if the name is in a right-to-left direction, the browser will treat the text in isolation from the surrounding text. But I wonder, is this right? I care about accessibility and semantics and if the name is LTR, wouldn't it be incorrect to say it's RTL?



Sources

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

Source: Stack Overflow

Solution Source