summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-06 00:10:06 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-06 00:10:06 +0100
commit7bf4753a9b6097828599572d40e08d780459d837 (patch)
tree786cb6006036a1c51d278b52686a772c85380a95
parent1d14c054a12dacdc193b589e4afb0ef319ee2aae (diff)
parent250d648d2aefdbf644275c7d0920473de7189e1b (diff)
Merge pull request #70675 from ZangEldor/pot-generating-fix
Fix generating POT for multiline messages
-rw-r--r--editor/pot_generator.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp
index aa25a16a18..f70a795683 100644
--- a/editor/pot_generator.cpp
+++ b/editor/pot_generator.cpp
@@ -159,14 +159,15 @@ void POTGenerator::_write_to_pot(const String &p_file) {
void POTGenerator::_write_msgid(Ref<FileAccess> r_file, const String &p_id, bool p_plural) {
// Split \\n and \n.
- Vector<String> temp = p_id.split("\\n");
Vector<String> msg_lines;
+ Vector<String> temp = p_id.split("\\n");
for (int i = 0; i < temp.size(); i++) {
msg_lines.append_array(temp[i].split("\n"));
- if (i < temp.size() - 1) {
- // Add \n.
- msg_lines.set(msg_lines.size() - 1, msg_lines[msg_lines.size() - 1] + "\\n");
- }
+ }
+
+ // Add \n.
+ for (int i = 0; i < msg_lines.size() - 1; i++) {
+ msg_lines.set(i, msg_lines[i] + "\\n");
}
if (p_plural) {
@@ -175,6 +176,10 @@ void POTGenerator::_write_msgid(Ref<FileAccess> r_file, const String &p_id, bool
r_file->store_string("msgid ");
}
+ if (msg_lines.size() > 1) {
+ r_file->store_line("\"\"");
+ }
+
for (int i = 0; i < msg_lines.size(); i++) {
r_file->store_line("\"" + msg_lines[i] + "\"");
}