Add source lines to file locations on POT generation#111419
Add source lines to file locations on POT generation#111419Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
Mickeon
left a comment
There was a problem hiding this comment.
I wonder if there's a good reason this wasn't done before... Does it genuinely work properly out-of-the-box?
| [gdscript] | ||
| # This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", and comment "test 1 comment". | ||
| ret.append(PackedStringArray(["Test 1", "context", "test 1 plurals", "test 1 comment"])) | ||
| # This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", comment "test 1 comment", and source line "7". |
There was a problem hiding this comment.
Because this comment grew in length, it's not going to be an easy read, not that it was before. This will not look pretty in the built-in and online class reference.
I would suggest removing it, but at the same time, that would be inconsistent with the other comments below, which are... of questionable utility, too.
e663d90 to
3b79d97
Compare
|
@dalexeev Changes made. |
Yeah, I was aware of that myself. I was just wondering why no one thought of adding the extra parameter sooner. |
3b79d97 to
ab80976
Compare
Editor translations can also have source lines, and did in the past. I now remove them because they make the diffs humongous on syncs, so we'd quickly end up with GBs of POT files diffs in the history. I don't know if that would be a problem for text heavy games or Godot apps that would want this to be opt-out. We can wait for users to ask, or they can post-process the generated POT file to strip lines before committing to VCS. |
dalexeev
left a comment
There was a problem hiding this comment.
The implementation looks good to me.
ab80976 to
0de3f8b
Compare
See my recent PR #111074 for the ability to intercept standard parsers (I plan to polish the PR a bit more). With this, users could quite easily implement a parser that would remove line numbers from extracted strings. |
|
Thanks! |

gettext allows not just adding the file path where a string comes from, but also the specific line number. This PR makes so that strings extracted from GDScripts also state the source line, as well as allowing plugins to do the same.