Make the gettext functions accept a localedir of type Traversable

In ZipApp, since files within the application cannot be read directly through traditional file APIs, it is necessary to use importlib.resources.files to read them.

importlib.resources.files returns a Traversable object, which is not supported by gettext.

Furthermore, before implementing support for this method, support for Path objects could be implemented first, since Traversable shares many similarities with Path and the code can be reused.

I don’t have any personal experience with the gettext functions, but I imagine that a PR would be appreciated. Unless someone asks on the PR for a community discussion, I don’t think it’s necessary to discuss here first.

2 Likes