I need to process some language files. Most of them are in left-to-right languages, but some are in right-to-left languages. Processing the right-to-left languages ir problematic.
I have read a localizedString
variable from a file.
If I print it reads correctly (first line in the attached picture). However, when I run this line:
outputString = '"' + stringKey + '" = "' + localizedString + '";\n'
The arabic text gets out of order (second line).
I cannot even paste it here properly, upon pasting it gets out of order.
How can I automatically keep the proper order without knowing the language in advance?
I guess I could do what's explained in this SO answer, but that would break left-to-right languages. I'm looking for an automatic way of doing this regardless of the language.
Note: I'm using Python 2.7.6