Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/modules/bl_i18n_utils/utils_rtl.py
| Show All 22 Lines | |||||
| # Preprocess right-to-left languages. | # Preprocess right-to-left languages. | ||||
| # You can use it either standalone, or through import_po_from_branches or | # You can use it either standalone, or through import_po_from_branches or | ||||
| # update_trunk. | # update_trunk. | ||||
| # | # | ||||
| # Notes: This has been tested on Linux, not 100% it will work nicely on | # Notes: This has been tested on Linux, not 100% it will work nicely on | ||||
| # Windows or OsX. | # Windows or OsX. | ||||
| # This uses ctypes, as there is no py3 binding for fribidi currently. | # This uses ctypes, as there is no py3 binding for fribidi currently. | ||||
| # This implies you only need the compiled C library to run it. | # This implies you only need the compiled C library to run it. | ||||
| # Finally, note that it handles some formating/escape codes (like | # Finally, note that it handles some formatting/escape codes (like | ||||
| # \", %s, %x12, %.4f, etc.), protecting them from ugly (evil) fribidi, | # \", %s, %x12, %.4f, etc.), protecting them from ugly (evil) fribidi, | ||||
| # which seems completely unaware of such things (as unicode is...). | # which seems completely unaware of such things (as unicode is...). | ||||
| import sys | import sys | ||||
| import ctypes | import ctypes | ||||
| import re | import re | ||||
| Show All 34 Lines | |||||
| MENU_DETECT_REGEX = re.compile("%x\\d+\\|") | MENU_DETECT_REGEX = re.compile("%x\\d+\\|") | ||||
| ##### Kernel processing funcs. ##### | ##### Kernel processing funcs. ##### | ||||
| def protect_format_seq(msg): | def protect_format_seq(msg): | ||||
| """ | """ | ||||
| Find some specific escaping/formating sequences (like \", %s, etc., | Find some specific escaping/formatting sequences (like \", %s, etc., | ||||
| and protect them from any modification! | and protect them from any modification! | ||||
| """ | """ | ||||
| # LRM = "\u200E" | # LRM = "\u200E" | ||||
| # RLM = "\u200F" | # RLM = "\u200F" | ||||
| LRE = "\u202A" | LRE = "\u202A" | ||||
| RLE = "\u202B" | RLE = "\u202B" | ||||
| PDF = "\u202C" | PDF = "\u202C" | ||||
| LRO = "\u202D" | LRO = "\u202D" | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||