Include line numbers for strings like from i18n/en.yaml when extracting #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now KDE website strings that come from i18n/en.yaml always end up with 0 as the line number. For example, this is an excerpt from documentation-develop-kde-org's PO template output:
It turns out it's possible to augment PyYAML to include the line number information as a part of the output. By subclassing str to add just one property, other things treat it as a normal string while the extraction process can copy the line number to the POT file.
This PR also includes the key in i18n/en.yaml as context, as I find it actually useful when translating.
After this patch, the output for the same file becomes:
with the line numbers pointing to the right place (such as i18n/en.yaml:9) and the key being included as context.