How to collect strings for i18n from files in different languages with xgettext

StackOverflow https://stackoverflow.com/questions/14145173

  •  12-01-2022
  •  | 
  •  

Question

By default xgettext will guess file type from its extension. However, I have JavaScript files (with .js extension) which it doesn't currently understand. So, I have to specify language manually, Java seems like a good choice. But then, I also have Glade files (XML), which obviously cannot be parsed as Java... When I specify multiple --language options on command line, only the last seems to have any effect.

It seems to be a non-issue for projects with file types understood by xgettext (e.g. C and Glade).

Was it helpful?

Solution

It seems that --join-existing option is what I need. I.e. run xgettext separately for each language with the same output file, only adding --join-existing for each but the first. Note that if output file doesn't have suffix .pot, xgettext will print a (useless) warning about charset.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top