Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New xgettext method to i18n module #13900

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bruchar1
Copy link
Member

@bruchar1 bruchar1 commented Nov 12, 2024

This method call xgettext to extract translatable
string from source files into a .pot translation template.

It differs from a plain CustomTarget in three ways:

  • It accepts build targets as sources, and automatically resolves source
    files from those build targets;
  • It detects command lines that are too long, and writes, at config
    time, the list of source files into a text file to be consumed by the
    xgettext command;
  • It detects dependencies between pot extraction targets, based on the
    dependencies between source targets.

This does the specific thing I need for my project, that I was trying to implement in a more generic way in #12272 and #11822.

@bruchar1 bruchar1 requested a review from jpakkane as a code owner November 12, 2024 13:45
@bruchar1 bruchar1 force-pushed the i18nextract branch 4 times, most recently from 9ebc09e to 4f5283b Compare November 12, 2024 16:23
This was referenced Nov 14, 2024
docs/markdown/i18n-module.md Outdated Show resolved Hide resolved
docs/markdown/i18n-module.md Outdated Show resolved Hide resolved
@bruchar1 bruchar1 force-pushed the i18nextract branch 2 times, most recently from b35d6b7 to 9347ef2 Compare December 6, 2024 16:51
mesonbuild/modules/i18n.py Fixed Show fixed Hide fixed
@bruchar1 bruchar1 changed the title New pot_extrator method to i18n module New find_xgettext method to i18n module Dec 6, 2024
mesonbuild/modules/i18n.py Outdated Show resolved Hide resolved
mesonbuild/modules/i18n.py Outdated Show resolved Hide resolved
mesonbuild/modules/i18n.py Outdated Show resolved Hide resolved
mesonbuild/modules/i18n.py Outdated Show resolved Hide resolved
docs/markdown/i18n-module.md Outdated Show resolved Hide resolved
docs/markdown/i18n-module.md Outdated Show resolved Hide resolved
docs/markdown/snippets/i18n_extract.md Outdated Show resolved Hide resolved
@eli-schwartz
Copy link
Member

Since the underlying goal as I understand it is essentially "i18n.gettext() is not suitable for my use case because it depends on POTFILES but I would like to calculate the list from meson.build", it feels a bit like a more appropriate solution here could be to teach i18n.gettext() to take an optional override of files to extract from (and e.g. resolve build targets by recursing into their source filelist, if desirable) -- and then generate a POTFILES for you, basically.

@bonzini
Copy link
Collaborator

bonzini commented Dec 10, 2024

and then generate a POTFILES for you, basically.

I understood that he also wants to generate multiple .pot files, so that would not be a single POTFILES.

@bruchar1 bruchar1 force-pushed the i18nextract branch 2 times, most recently from 0fc8368 to 98a0fd7 Compare December 19, 2024 21:24
@bruchar1 bruchar1 changed the title New find_xgettext method to i18n module New xgettext method to i18n module Dec 20, 2024
@bonzini bonzini added this to the 1.8 milestone Jan 10, 2025
@bruchar1 bruchar1 force-pushed the i18nextract branch 2 times, most recently from cd32835 to e9596e6 Compare January 27, 2025 15:39
@bruchar1 bruchar1 requested review from dcbaker and bonzini January 27, 2025 19:24
This method call xgettext to extract translatable
string from source files into a .pot translation template.

It differs from a plain CustomTarget in three ways:
- It accepts build targets as sources, and automatically resolves source
  files from those build targets;
- It detects command lines that are too long, and writes, at config
  time, the list of source files into a text file to be consumed by the
  xgettext command;
- It detects dependencies between pot extraction targets, based on the
  dependencies between source targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants