Skip to content

Extract strings from source code with xgettext #3

@armijnhemel

Description

@armijnhemel

Some notes for extracting strings from source code files with xgettext.

I have found the following commandline options to work well for me:

xgettext -a -o - --no-wrap --no-location --omit-header -

This reads the data from standard input, and outputs results on standard output. The standard gettext header is not included (which makes parsing a little bit easier) and file name data is also not included (the "location"), as I am assuming I already know which file I am reading plus I am not interested in the location(s) of the strings in the file (but maybe this is something you want). This also makes parsing things a little bit easier. The --no-wrap parameter is for putting results on a single line, which also makes processing results easier.

Some options that are worth looking at: -L as xgettext tends to only look at file extensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions