Internationalization
I'd previously looked into internationalization systems, mostly from the perspective of a new omwaddon format, and while I haven't received any feedback yet with respect to which system would be better to use (see here), from the perspective of portmod I think it makes the most sense to use Project Fluent, given that it's a quite modern approach to internationalization and supports both python and rust.
Portmod-side
On the side of Portmod, it should be relatively simple. All we really need to do is replace output strings with identifiers and l10n format calls, and move the actual values into .ftl
files in the l10n
Repo-side
On the repository side it's a little more complicated. I think the best idea would be to support both a global l10n directory, and a per-package l10n directory. In addition to manually invoked localization calls within the pybuild, the NAME
and DESC
fields should be localized, as well as longdescription
and all the use flag descriptions in metadata.yaml
(probably with identifiers of the form use-{flagname}
).
Note that the package-specific information such as NAME
, DESC
, and the info in metadata.yaml
would be required to be stored in the per-package l10n
directory, as the identifiers will be the same for all packages.
For category longdescriptions, we could either have a category-level l10n directory, or just use the repo-level one and have identifiers of the form {category}-longdescription
. I would prefer to avoid potentially overlapping identifiers, such as a category longdescription
being used as fallback due to a missing package longdescription
, so it would be better to ban the use of longdescription
outside of package-level l10n
.
Note that, unlike in portmod, and for manual calls to the localization functions within pybuilds, this method would leave the original language values for NAME
, DESC
, etc. which is mostly a matter of convenience, to avoid breaking the repository, and to make the l10n
directory optional. We should include a DEFAULT_LOCALE
variable that can be set in the profiles though to declare what locale is used for this default localization.
I'm also tempted to say that we could localize category and mod names themselves, but I think at the very least it should be left until later, as it would require considerable changes to the system, not to mention creating a disconnect between the repo structure and the package Atoms.