diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-16 21:57:34 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-16 22:02:44 +0200 |
commit | e864237f1a4f9dff3a199e42c5dd4fd5661a261c (patch) | |
tree | 564c78b4b3bd10ff310fb947087fd3274caa12bc | |
parent | ea9a6672e0f338de263f205a3bf4b140f25b8308 (diff) |
i18n: Fix extract.py support for new TTRC
Also make compatible with Python 3.
-rw-r--r-- | core/ustring.h | 8 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/translations/Makefile | 2 | ||||
-rwxr-xr-x | editor/translations/extract.py | 8 |
4 files changed, 10 insertions, 10 deletions
diff --git a/core/ustring.h b/core/ustring.h index be6300ac5b..5b9be9f27c 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -415,16 +415,16 @@ _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) { //gets parsed String TTR(const String &); -//use for c strings -#define TTRC(m_value) m_value +//use for C strings +#define TTRC(m_value) (m_value) //use to avoid parsing (for use later with C strings) #define TTRGET(m_value) TTR(m_value) #else -#define TTR(m_val) (String()) -#define TTRCDEF(m_value) (m_value) +#define TTR(m_value) (String()) #define TTRC(m_value) (m_value) +#define TTRGET(m_value) (m_value) #endif diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 79c312b7b1..372e5c7d05 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6385,7 +6385,7 @@ EditorNode::EditorNode() { execute_outputs = memnew(RichTextLabel); execute_output_dialog = memnew(AcceptDialog); execute_output_dialog->add_child(execute_outputs); - execute_output_dialog->set_title(TTR("")); + execute_output_dialog->set_title(""); gui_base->add_child(execute_output_dialog); EditorFileSystem::get_singleton()->connect("sources_changed", this, "_sources_changed"); diff --git a/editor/translations/Makefile b/editor/translations/Makefile index 4f5d9f165f..1843114f06 100644 --- a/editor/translations/Makefile +++ b/editor/translations/Makefile @@ -7,7 +7,7 @@ LANGS = $(POFILES:%.po=%) all: update merge update: - @cd ../..; python2 editor/translations/extract.py + @cd ../..; python3 editor/translations/extract.py merge: @for po in $(POFILES); do \ diff --git a/editor/translations/extract.py b/editor/translations/extract.py index 2075bd5f3c..70eb15da62 100755 --- a/editor/translations/extract.py +++ b/editor/translations/extract.py @@ -60,7 +60,7 @@ def process_file(f, fname): lc = 1 while (l): - patterns = ['RTR(\"', 'TTR(\"','TTRC(\"'] + patterns = ['RTR(\"', 'TTR(\"', 'TTRC(\"'] idx = 0 pos = 0 while (pos >= 0): @@ -70,7 +70,7 @@ def process_file(f, fname): idx += 1 pos = 0 continue - pos += 5 + pos += len(patterns[idx]) msg = "" while (pos < len(l) and (l[pos] != '"' or l[pos - 1] == '\\')): @@ -101,10 +101,10 @@ def process_file(f, fname): print("Updating the editor.pot template...") for fname in matches: - with open(fname, "rb") as f: + with open(fname, "r") as f: process_file(f, fname) -with open("editor.pot", "wb") as f: +with open("editor.pot", "w") as f: f.write(main_po) if (os.name == "posix"): |