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 custom placeholders for po4a componentes in Weblate #510

Closed
rffontenelle opened this issue Jul 9, 2024 · 5 comments
Closed

Add custom placeholders for po4a componentes in Weblate #510

rffontenelle opened this issue Jul 9, 2024 · 5 comments

Comments

@rffontenelle
Copy link
Contributor

Both 'po4a' and 'po4a-doc' componentes in Weblate have a lot of formatting syntax, references to options and other texts that could easily be mistranslated and cause the resulting software/documentation to be malformatted or broken. Setting placeholder for such occurrences increases the chances of translation consistency for texts that should not be translated (i.e. should be kept as is in the translation).

If the translator do translate the text that was supposed to be kept as the original in English, a translation check error will be displayed. While it can be dismissed, it will bring to the attention of the translation the fact of a wrong translation of these texts.

I was working on matching potencial targets of a custom placeholder expression, and I came up with the following regexp:

For po4a (Settings > Translation flags):

placeholders:r"\w+(::\w+)+":r"\w+_\w+":r"\w+=\w+":r"\-\w \w+":r" \-?-\w+(\-\w+)?":r"\w+\(\d\)":r"B<\-?\-\w+(\-\w+)?>"

For po4a-doc (Settings > Translation flags):

placeholders:r"(L|B)<[\-_\w\(\)\d\$\[\]\<\>=:;\|\.]*>"

Example of occurrences for each regexp for 'po4a':

\w+(::\w+)+
Pod::Man
Locale::Po4a::Man

\w+_\w+
groff_code
no_wrap
po4a_paths

\w+=\w+
debug=onsgmls
mode=after
mode=eof

\-\w \w+
-o exclude_include
-o doctype

\-?-\w+(\-\w+)? (note the one white-space in the beginning!)
--master-charset
--localized-charset

\w+\(\d\)
man(7)
po4a(7)
mdoc(7)

B<\-?\-\w+(\-\w+)?>
B<--blank>
B<--capitalize>

Example of occurrences for each regexp for 'po4a-doc':

(L|B)<[\-_\w\(\)\d\$\[\]\<\>=:;\|\.]*>

Cases:

B<parse_definition_line>
B<paths>
B<--po>
B<po4a->
B<po4a:>
B<po4a-gettextization>
B<PO4A-HEADER:>
B<[po4a_langs]>
B<E<lt>pE<gt>>
L<diff(1)>
L<Locale::Maketext::TPJ13(3pm)|Locale::Maketext::TPJ13(3pm)>
L<Locale::Po4a::AsciiDoc>
L<po4a-build.conf(5)>

po4a-doc might probably have more stuff to match, but this already matches a lot of cases in the docs.

Note: C<> and I<> could have their contents translated, so it would be advised to be make them placeholders.

@mquinson
Copy link
Owner

Hello,

I have no idea of how to do that. Is there a possibility that I grant you the right to do that for the rest of us? Does weblate allow me to give you the needed privileges over the projects?

Thanks,

@rffontenelle
Copy link
Contributor Author

I mentioned above in Settings > translation flags above (with link).

But if you prefer have me set it, just go to https://hosted.weblate.org/projects/po4a/, Manage menu item, Users submenu item and add rafaelff as admin

@mquinson
Copy link
Owner

You're an admin, welcome on board!

@rffontenelle
Copy link
Contributor Author

I set the custom placeholder expressions and it seems to work. I've spotted some false positives and I've worked around them. Looks good as a starting setting.

@mquinson
Copy link
Owner

Excellent, thanks. Maybe you can close this bug once everything works as you'd expect?

Thanks again

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

No branches or pull requests

2 participants