Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/markdown/snippets/xgettext-include-private-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## i18n.xgettext recursive option now includes "private" dependencies

Suppose we have:

```
libA.dll -> libB.dll -> libC.dll
```

Here, `libA` links with `libB`, and `libB` links with `libC`, but `libA` does
not link with `libC` directly. So, `libC` is a "private" dependency of `libB`.
If we collect strings to translate using:

```
i18n.xgettext(libC)
i18n.xgettext(libB)
pot_file = i18n.xgettext(libA, recursive: true)
```

Previously, strings from `libC` would not be included in `pot_file`, since
`libC` is not a direct link dependency of `libA`. This has been fixed: when
the `recursive: true` option is used, `xgettext` now recursively includes
translations from all dependencies, including those of dependencies. This is
more logical, as even if `libA` does not directly link with `libC`, it may
still need translated strings from `libC`.
4 changes: 3 additions & 1 deletion mesonbuild/modules/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ def _get_depends(self, sources: T.Iterable[SourcesType]) -> T.Set[build.CustomTa
depends = set()
for source in sources:
if isinstance(source, build.BuildTarget):
for source_id in self._get_source_id(source.get_dependencies()):
dependencies = source.get_dependencies()
for source_id in self._get_source_id(dependencies):
if source_id in self.pot_files:
depends.add(self.pot_files[source_id])
depends.update(self._get_depends(dependencies))
elif isinstance(source, build.CustomTarget):
# Dependency on another extracted pot file
source_id = source.get_id()
Expand Down
Loading