Combining left and right languages ​​with right to left (Arabic, etc.)

I need to process some language files. Most of them are in languages ​​from left to right, but some of them are in languages ​​from right to left. Handling problematic languages ​​with problematic ones.

I read the variable localizedStringfrom the file.

If I print it, it reads correctly (the first line in the attached figure). However, when I run this line:

    outputString = '"' + stringKey + '" = "' + localizedString + '";\n'

Arabic text fails (second line).

enter image description here

I can’t even insert it here properly, after inserting it fail.

How can I automatically maintain the correct order without knowing the language in advance?

I think I could do what I explained in this SO answer , but that would break languages ​​from left to right. I am looking for an automatic way to do this regardless of language.

Note. I am using Python 2.7.6

+4
source share
1 answer

IMO, you could just simply concatenate them.

Let the display problem with the editing itself. You may need to convert it to .doc or .odt if you want to use it in a desktop environment. Or just recompile vim with + rightleft options. However, a language file processing program can be simple and elegant.

+2
source

All Articles