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

add --destlang option to po4a #539

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

Conversation

jnavila
Copy link
Collaborator

@jnavila jnavila commented Nov 3, 2024

This option should allow to transition to po4a from po4a-*, while retaining the same steps in makefiles

This option allows to restrict the processing to specific destination
languages for the translation.

This way, po4a can be invoked only for updated languages and in
parallel for different languages, in order to speed up the process.
@Fat-Zer
Copy link
Contributor

Fat-Zer commented Nov 4, 2024

Good, it's a long due one!

I have some suggestions:

  • to reword the doc string, because as for now it sounds like it only affects update of the PO files. Maybe to something like:

    Generate translated documents and update PO files only for the specified language. This option can be used multiple times.

  • to warn if a language is not present rather than die. And die only if none of the specified languages are present
  • let the test check that it affects PO file update as well
  • maybe to rename the option to --lang-only, so it would be more consistent with --translate-only

@jnavila
Copy link
Collaborator Author

jnavila commented Nov 4, 2024

Good, it's a long due one!

I have some suggestions:

  • to reword the doc string, because as for now it sounds like it only affects update of the PO files. Maybe to something like:

    Generate translated documents and update PO files only for the specified language. This option can be used multiple times.

OK, Just reversing the order:

Update PO files and generate translated documents only for the specified language. This option can be used multiple times.
  • to warn if a language is not present rather than die. And die only if none of the specified languages are present

I'm not fond of being merciful at the begining of the logs, while after, there can be tons of messages about translation levels not reaching the required threshold. In addition, I expect this option to be used once for each invocation (that's how I'm using it for each language in a Makefile), so this would not make a difference for the end users, while making the code slightly more complicated.

Do you have a specific use case in mind?

  • let the test check that it affects PO file update as well

I do not understand this request. Do you mean po file update instead of po file creation?

  • maybe to rename the option to --lang-only, so it would be more consistent with --translate-only

Even if my intention is that the option is used only one time in the command line, it can be used several times, and then, the option cannot be named '--*-only' for this case, because that would imply a unique use.

@Fat-Zer
Copy link
Contributor

Fat-Zer commented Nov 4, 2024

  • let the test check that it affects PO file update as well

I do not understand this request. Do you mean po file update instead of po file creation?

Yes, I meant to just remove the --no-update from the po4a's args in the test and add 2-3 more resulting files.

  • to warn if a language is not present rather than die. And die only if none of the specified languages are present

I'm not fond of being merciful at the begining of the logs, while after, there can be tons of messages about translation levels not reaching the required threshold. In addition, I expect this option to be used once for each invocation (that's how I'm using it for each language in a Makefile), so this would not make a difference for the end users, while making the code slightly more complicated.

Do you have a specific use case in mind?

I was imagining using it for testing and debugging issues (to not wait while po4a will build all the files) and running the same oneliner on several po4a's and in that case it's just a behavior I would have expected. But it's mostly hypothetical, and as well most likely I won't be specified more than once. And I guess the scorched-earth approach is a valid strategy too, so no pressure here.

  • maybe to rename the option to --lang-only, so it would be more consistent with --translate-only

Even if my intention is that the option is used only one time in the command line, it can be used several times, and then, the option cannot be named '--*-only' for this case, because that would imply a unique use.

It's the same thing for --translate-only. I see how it's a bit of a misnomer and I see your point, but as it seems we already agreed, that IRL it won't likely be specified more than once in absolute majority of cases (like the --translate-only), it's kinda OK-ish to call it -only. But I won't insist on this either.

@mquinson
Copy link
Owner

mquinson commented Nov 5, 2024

That's embarrassing because I thought that the main po4a script could already be used as a drop-in replacement. It was even the reason why I stepped into the deprecation of the other scripts... Thanks for taking care of this.

As for the comments of @Fat-Zer, I agree with @jnavila that dying is important when something goes seriously wrong, as people don't read the logs otherwise. An inconsistent argument is something serious to me.

For the parameter names, we could deprecate --translate-only to --no-update or something. It's rather easy to do: just accept both forms, document only the new name, and produce a warning that nobody reads when the old name is used. Having consistent naming schemas is important to me (but it's not part of this PR).

If I think about it, maybe --localized-lang is better than --dest-lang because destis used elsewhere in po4a to change the directory to which we should while we use --localized in po4a-* scripts and --localized-charset in all scripts.

@Fat-Zer
Copy link
Contributor

Fat-Zer commented Nov 5, 2024

For the parameter names, we could deprecate --translate-only to --no-update or something.

--translate-only [file] implies --no-update, but it's intent is to limit which master-documents to translate. It doesn't make sense to anyhow replace it with --no-update. And to rename the option just because of this kinda-of-a misnomer IMHO will bring too few benefits for all the headache it will cause maintainers.

If I think about it, maybe --localized-lang is better than --dest-lang because destis used elsewhere in po4a to change the directory to which we should while we use --localized in po4a-* scripts and --localized-charset in all scripts.

This looks more like "set a lang of the localized file", which doesn't fit here... maybe just "--lang"?

@jnavila
Copy link
Collaborator Author

jnavila commented Nov 5, 2024

Ok, there are already several propositions, so I'll add mine : --target-lang. To me, the --localized-charset option is really attached to the po4a-* utilities where files are managed one by one, whereas here, the option filters out the actions performed by po4a depending on criteria.

@mquinson
Copy link
Owner

mquinson commented Nov 6, 2024

--target-lang seems good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants