Skip to content

Support POT generation from command line #10986

Description

@dbnicholson

Describe the project you are working on

A plugin with strings to translate.

Describe the problem or limitation you are having in your project

Currently the only way to regenerate POT files is via the localization editor's POT Generation tab. This is the only part of the gettext localization pipeline that can't be automated.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

If POTGenerator::generate_pot were exposed to GDScript, you could easily write a script that calls generate_pot with your desired POT file location. This would fill the hole where you'd normally use xgettext. After that, the rest of the gettext flow works as normal.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Presuming that the POTGenerator singleton and its generate_pot method were available, you could write a simple SceneTree script like:

extends SceneTree

func _init():
	POTGenerator::generate_pot("po/myproject.pot")
        quit()

Then you could run it like godot --path . --headless --script genpot.gd as part of your translation pipeline.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I don't believe there's any way to manage this from a script since none of the necessary functionality is exposed to GDScript. Without the enhancement, you'd have to use the POT Generation tab in the editor whenever translatable strings change.

Is there a reason why this should be core and not an add-on in the asset library?

Until the core exposes POTGenerator, there's no way to provide this functionality from an add-on.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions