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

Set POT-Creation-Date in newly generated POT files #87

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

mgeisler
Copy link
Collaborator

The data is added to PO files automatically by msgmerge. This will in turn be used when publishing a translation: it allows us to know which sources goes into a given PO file.

Part of #16.

The data is added to PO files automatically by `msgmerge`. This will
in turn be used when publishing a translation: it allows us to know
which sources goes into a given PO file.

Part of #16.
@mgeisler
Copy link
Collaborator Author

@sakex, I'm thinking we should surface this field in the template engine. That way we can write something like

Published on {{ now() }}, translation current as of {{ pot-creation-date }}.

in the footer of each page.

@sakex
Copy link
Collaborator

sakex commented Sep 24, 2023

Sure, this can be done by adding the variable to the book object at the gettext preprocessor step, then we'll retrieve it from a custom template

mgeisler added a commit to google/comprehensive-rust that referenced this pull request Sep 24, 2023
This updates each PO file to the date when it was last touched:

    for po_file in po/*.po; do
        POT_DATE=$(git log -1 --date=short --format=%ad $po_file)
        sed -i -e 's/"POT-Creation-Date:.*"/"POT-Creation-Date: '$POT_DATE'\\n"/' $po_file
    done

The dates will be updated with `msgmerge` in the future via
google/mdbook-i18n-helpers#87.
mgeisler added a commit to google/comprehensive-rust that referenced this pull request Sep 24, 2023
This updates each PO file to the date when it was last touched:

    for po_file in po/*.po; do
        POT_DATE=$(git log -1 --date=short --format=%ad $po_file)
        sed -i -e 's/"POT-Creation-Date:.*"/"POT-Creation-Date: '$POT_DATE'\\n"/' $po_file
    done

The dates will be updated with `msgmerge` in the future via
google/mdbook-i18n-helpers#87.
@mgeisler mgeisler requested a review from sakex September 25, 2023 06:53
@mgeisler
Copy link
Collaborator Author

Sure, this can be done by adding the variable to the book object at the gettext preprocessor step

Oh, interesting! Can a preprocessor modify the metadata passed onto later preprocessors and renderers? I was thinking it should become a context variable for the template engine.

@sakex
Copy link
Collaborator

sakex commented Sep 25, 2023 via email

@mgeisler mgeisler merged commit b19c24f into main Sep 25, 2023
5 checks passed
@mgeisler mgeisler deleted the pot-creation-date branch September 25, 2023 08:51
mgeisler added a commit to google/comprehensive-rust that referenced this pull request Sep 25, 2023
This updates each PO file to the date when it was last touched:

    for po_file in po/*.po; do
        POT_DATE=$(git log -1 --date=short --format=%ad $po_file)
        sed -i -e 's/"POT-Creation-Date:.*"/"POT-Creation-Date: '$POT_DATE'\\n"/' $po_file
    done

The dates will be updated with `msgmerge` in the future via
google/mdbook-i18n-helpers#87.
mgeisler added a commit to google/comprehensive-rust that referenced this pull request Sep 25, 2023
This updates each PO file to the date when it was last touched:

    for po_file in po/*.po; do
        POT_DATE=$(git log -1 --date=short --format=%ad $po_file)
sed -i -e 's/"POT-Creation-Date:.*"/"POT-Creation-Date:
'$POT_DATE'\\n"/' $po_file
    done

The dates will be updated with `msgmerge` in the future via
google/mdbook-i18n-helpers#87.

The dates here can be adjusted by hand if needed — the starting point
here only serves as a rough anchor to let us freeze the translations
from further updates. So if you know that you ran `msgmerge` most
recently on a given date, please update the file to that date in a later
PR.
@mgeisler
Copy link
Collaborator Author

See google/comprehensive-rust#1243 for the other half of this: updating the the data in POT-Creation-Date when publishing a book.

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.

2 participants