mirror of https://github.com/godotengine/godot
Fixed issue #70617 : generating POT for multiline message
Fixed the issue and now each message's line is suceeded by a \n. Fixes #70614
This commit is contained in:
parent
5674fa04ae
commit
250d648d2a
|
|
@ -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) {
|
void POTGenerator::_write_msgid(Ref<FileAccess> r_file, const String &p_id, bool p_plural) {
|
||||||
// Split \\n and \n.
|
// Split \\n and \n.
|
||||||
Vector<String> temp = p_id.split("\\n");
|
|
||||||
Vector<String> msg_lines;
|
Vector<String> msg_lines;
|
||||||
|
Vector<String> temp = p_id.split("\\n");
|
||||||
for (int i = 0; i < temp.size(); i++) {
|
for (int i = 0; i < temp.size(); i++) {
|
||||||
msg_lines.append_array(temp[i].split("\n"));
|
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) {
|
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 ");
|
r_file->store_string("msgid ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg_lines.size() > 1) {
|
||||||
|
r_file->store_line("\"\"");
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < msg_lines.size(); i++) {
|
for (int i = 0; i < msg_lines.size(); i++) {
|
||||||
r_file->store_line("\"" + msg_lines[i] + "\"");
|
r_file->store_line("\"" + msg_lines[i] + "\"");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue