https://git.schokokeks.org/derivepassphrase.git/tree/2aa16e5903369994e0df761a1061f007e945f596Recent commits to derivepassphrase.git (2aa16e5903369994e0df761a1061f007e945f596)2025-01-01T00:17:28+01:00tag:gitlist.org,2012:commit/2aa16e5903369994e0df761a1061f007e945f596Merge topic branch 'i18n-l10n-infrastructure' into master2025-01-01T00:17:28+01:00Marco Riccisoftware@the13thletter.info
<pre>* t/i18n-l10n-infrastructure:
Add a changelog entry for the new i18n/l10n infrastructure
Fix coverage
Reimplement `--help` and `--version` options in a translatable way
Replace strings in `derivepassphrase export vault` with translatable ones
Force logging calls in error callback to be uninterpolated
Provide a function to reload translations for derivepassphrase
Add a writer function for derivepassphrase's .po template
Fix some translation typos and inconsistent translation comments
Update the CLI to use the translatable strings
Add more translatable strings and serialization machinery
Extract translatable log messages into separate module
Add an actual derivepassphrase-vault(1) manpage, plus better manpage contents
Make the mutually exclusive options helper function print the correct parameter name
Add small fixes to changelog, docstrings and variable names
</pre>
tag:gitlist.org,2012:commit/a254e71ee699f479fa70264f7d1a8110cb4777f5Add a changelog entry for the new i18n/l10n infrastructure2025-01-01T00:17:17+01:00Marco Riccisoftware@the13thletter.info
<pre></pre>
tag:gitlist.org,2012:commit/220d71df817f2662308efab15e98f138fd6dde18Fix coverage2024-12-31T23:58:59+01:00Marco Riccisoftware@the13thletter.info
<pre>Exclude further machinery from coverage that isn't meant to be tested.
</pre>
tag:gitlist.org,2012:commit/f6e66845b1b4c889aae2f7833678eed2e49c5ae6Reimplement `--help` and `--version` options in a translatable way2024-12-31T22:30:36+01:00Marco Riccisoftware@the13thletter.info
<pre>Reimplement the machinery for displaying help texts and version
information, supporting translatable strings. Besides the one-line help
texts for the `--help` and `--version` options, the version information
text is a translatable string itself, in case the name and version
number should be rearranged, or prefixed or suffixed, or whatever.
</pre>
tag:gitlist.org,2012:commit/b225fb3b9cf104a042d810a2b82cd484cc7d5f33Replace strings in `derivepassphrase export vault` with translatable ones2024-12-31T22:18:29+01:00Marco Riccisoftware@the13thletter.info
<pre>Apparently, we overlooked this in
59d73c8320650a6bcb77eed759c694949d350cdb.
</pre>
tag:gitlist.org,2012:commit/0e31ed481bf84684233c909ae8f559c360386fb1Force logging calls in error callback to be uninterpolated2024-12-31T22:08:02+01:00Marco Riccisoftware@the13thletter.info
<pre>Remove the `args` argument to the error callback and to the underlying
`logging` function, forcing logger to skip log message interpolation in
any case.
</pre>
tag:gitlist.org,2012:commit/73f1128336d79d6f1ee0d8d783d58d6c6d629cc3Provide a function to reload translations for derivepassphrase2024-12-31T18:40:01+01:00Marco Riccisoftware@the13thletter.info
<pre></pre>
tag:gitlist.org,2012:commit/357468984efebf66365a5dfac75010d7120e42ceAdd a writer function for derivepassphrase's .po template2024-12-31T16:03:01+01:00Marco Riccisoftware@the13thletter.info
<pre>To be used together with the gettext toolset.
Many things are hard-coded.
</pre>
tag:gitlist.org,2012:commit/dc3b7bab8ee8b59e7a1d60315b59e296dce51f2eFix some translation typos and inconsistent translation comments2024-12-31T16:03:01+01:00Marco Riccisoftware@the13thletter.info
<pre></pre>
tag:gitlist.org,2012:commit/59d73c8320650a6bcb77eed759c694949d350cdbUpdate the CLI to use the translatable strings2024-12-30T23:45:01+01:00Marco Riccisoftware@the13thletter.info
<pre>We implement the translations in a deferred manner, via objects that
stringify to their correct translation. Since `click` 8.1, help texts
are (mostly) stored first and processed only when the help page is
emitted. Accordingly, this system can be adapted to support our
translatable strings: we need only ensure the help text is stringified
just before it is formatted and emitted. This in turn can be achieved
by reimplementing the help page assembly and formatting in a custom
`click.Command` class, as has already been done to implement help/option
group support. Once this is in place, it remains to exchange all inline
help texts with the corresponding translatable string, and adapt the
tests to the new messages.
While most of the changes are straightforward, some subtleties remain.
First, the help texts are now supplied as (separately translatable)
paragraphs to the `click.command` decorator, instead of being extracted
from the respective function docstring. The docstrings in return have
been shortened down.
Second, since the new capabilities are implemented via custom
`click.Command`, `click.MultiCommand` and `click.Option` subclasses,
every option and command must derive from one of these classes. This
necessitates the creation of an empty `StandardOption` class for options
without an option group, and making `_DefaultToVaultGroup` a subclass of
`CommandWithHelpGroups`.
Third, since the `click.Option` class actually processes its help text
eagerly, the subclass must hide the (non-string) help text from the
`click.Option` constructor and later restore it.
Finally, while the tests currently pass as before, they now implicitly
rely on *not* loading any translations. Furthermore, there is no
mechanism in place with which to isolate the translation system from the
user's environment for testing purposes, nor is there a (controlled)
mechanism to test `derivepassphrase` under a different language. Once
there are actual translations, future commits will need to establish
such a missing mechanism for translation loading/switching/forcing.
</pre>