-
Notifications
You must be signed in to change notification settings - Fork 25
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
Conversation
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.
18a922b
to
0cdc55b
Compare
@sakex, I'm thinking we should surface this field in the template engine. That way we can write something like
in the footer of each page. |
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 |
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.
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.
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. |
Yes actually, we could just pass time.now from the renderer On Sep 25, 2023 08:56, Martin Geisler ***@***.***> wrote:
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.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
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.
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.
See google/comprehensive-rust#1243 for the other half of this: updating the the data in POT-Creation-Date when publishing a book. |
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.