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

Support Weblate Flags in Gettext Files via Extracted Comments #11655

Open
anubeon opened this issue May 16, 2024 · 3 comments
Open

Support Weblate Flags in Gettext Files via Extracted Comments #11655

anubeon opened this issue May 16, 2024 · 3 comments
Labels
enhancement Adding or requesting a new feature. undecided These features might not be implemented. Can be prioritized by sponsorship.

Comments

@anubeon
Copy link

anubeon commented May 16, 2024

Describe the problem

We use GNU gettext for translating strings for embedded systems, with our programmers providing human-readable cues for things like maximum character length via the extracted comments feature (example below).

#.
#. STARTUP TYPEWRITER TEXT
#. ------------------------------------------------------------------
#. EEPROM BLANK (Maxlen=12)
msgid "BLANK"
msgstr "VIDE"

#. (DO NOT TRANSLATE!)
msgid "EEPROM"
msgstr ""

For our use case, this could potentially be a far more efficient means of setting weblate-flags such as max-length:N than manually setting said flags via Weblate's UI. Presently, however, only certain XML based formats support storage and synchronisation of weblate-flags.

Describe the solution you would like

We suggest supporting storage and synchronisation of weblate-flags within gettext's extracted comments, in a similar vain to the non-standard weblate-flags attribute supported for XLIFF.

As the extracted comments feature of GNU gettext is designed to allow programmers to provide cues to translators, this would seem the ideal means of conveying machine-readable instructions to a translation tool such as Weblate.

Example:

#.
#. STARTUP TYPEWRITER TEXT
#. ------------------------------------------------------------------
#. EEPROM BLANK weblate-flags="max-length:12, priority:50"
msgid "BLANK"
msgstr "VIDE"

#. weblate-flags="read-only"
msgid "EEPROM"
msgstr ""

In the example above, weblate-flags are:

  1. Appended to the end of the extracted comments.
  2. Signified via the keyword/prefix weblate-flags=.
  3. Encapsulated by double quotes.
  4. Comma-delimited.

These would seem like reasonable conventions to follow?

Describe alternatives you have considered

No response

Screenshots

No response

Additional context

No response

@nijel
Copy link
Member

nijel commented May 17, 2024

Weblate does extract flags from Gettext type comments:

#: weblate/addons/forms.py:541
#, python-format
msgid "Could not parse CSS selector: %s"
msgstr "Nepodařilo se zpracovat CSS selektor: %s"

Will get python-format flag. The issue with that is that there is no way to generate custom flags using gettext and I think that gettext tools will complain about unknown flags.

@nijel nijel added enhancement Adding or requesting a new feature. undecided These features might not be implemented. Can be prioritized by sponsorship. labels May 17, 2024
@nijel
Copy link
Member

nijel commented May 17, 2024

It makes sense to support extracting Weblate flags from the comments, but the syntax has to be carefully designed. For example, the flags itself can contain quotes, so using quotes to delimit them doesn't sound like a good idea.

Copy link

This issue has been put aside. It is currently unclear if it will ever be implemented as it seems to cover too narrow of a use case or doesn't seem to fit into Weblate.

Please try to clarify the use case or consider proposing something more generic to make it useful to more users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature. undecided These features might not be implemented. Can be prioritized by sponsorship.
Projects
None yet
Development

No branches or pull requests

2 participants