WeblateOrg / WeblateOrg/weblate
Support Weblate Flags in Gettext Files via Extracted Comments
- Dominant language
- Python
- Stars
- 6.1k
- Forks
- 1.4k
- Avg merge
- 9h 53m
- Merged PRs (30d)
- 395
Description
### 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).
```po
#.
#. 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](https://docs.weblate.org/en/latest/admin/checks.html) 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](https://docs.weblate.org/en/latest/admin/checks.html).
### Describe the solution you would like
We suggest supporting storage and synchronisation of [weblate-flags](https://docs.weblate.org/en/latest/admin/checks.html) within gettext's extracted comments, in a similar vain to the [non-standard weblate-flags attribute supported for XLIFF](https://docs.weblate.org/en/latest/formats/xliff.html#xliff-flags).
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:
```po
#.
#. 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](https://docs.weblate.org/en/latest/admin/checks.html) 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_
Contributor guide
Assessment
This issue has not been assessed yet.