From 471774cb9b92e5c8bffde4bd8fe940fdc1c6bcbb Mon Sep 17 00:00:00 2001
From: Tilly Woodfield <22456167+tillywoodfield@users.noreply.github.com>
Date: Tue, 19 Nov 2024 10:49:53 +0200
Subject: [PATCH] feat: make copyright year dynamic
---
iati_sphinx_theme/__init__.py | 2 ++
iati_sphinx_theme/footer.html | 2 +-
iati_sphinx_theme/locale/es/LC_MESSAGES/sphinx.po | 9 +++++----
iati_sphinx_theme/locale/fr/LC_MESSAGES/sphinx.po | 9 +++++----
iati_sphinx_theme/locale/sphinx.pot | 7 ++++---
5 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/iati_sphinx_theme/__init__.py b/iati_sphinx_theme/__init__.py
index 7b819ac..9747ef3 100644
--- a/iati_sphinx_theme/__init__.py
+++ b/iati_sphinx_theme/__init__.py
@@ -1,5 +1,6 @@
"""A sphinx theme for IATI documentation sites."""
+from datetime import datetime
from os import path
import sphinx.application
@@ -10,6 +11,7 @@ def setup(app: sphinx.application.Sphinx) -> None:
app.config["html_permalinks_icon"] = "#"
app.config["html_favicon"] = "static/favicon-16x16.png"
app.config["html_context"]["language"] = app.config["language"]
+ app.config["html_context"]["current_year"] = datetime.now().year
app.add_js_file("language-switcher.js")
locale_path = path.join(path.abspath(path.dirname(__file__)), "locale")
app.add_message_catalog("sphinx", locale_path)
diff --git a/iati_sphinx_theme/footer.html b/iati_sphinx_theme/footer.html
index 030a53e..ade7d1f 100644
--- a/iati_sphinx_theme/footer.html
+++ b/iati_sphinx_theme/footer.html
@@ -23,7 +23,7 @@
{{ _("Privacy Policy") }}
- {{ _("© Copyright 2024 United Nations Development Programme, on behalf of the IATI Secretariat") }}
+ © {% trans %}Copyright {{ current_year }} United Nations Development Programme, on behalf of the IATI Secretariat{% endtrans %}
diff --git a/iati_sphinx_theme/locale/es/LC_MESSAGES/sphinx.po b/iati_sphinx_theme/locale/es/LC_MESSAGES/sphinx.po
index 111dc27..dce4eb9 100644
--- a/iati_sphinx_theme/locale/es/LC_MESSAGES/sphinx.po
+++ b/iati_sphinx_theme/locale/es/LC_MESSAGES/sphinx.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2024-11-12 16:24+0200\n"
-"PO-Revision-Date: 2024-11-12 16:24+0200\n"
+"POT-Creation-Date: 2024-11-19 10:48+0200\n"
+"PO-Revision-Date: 2024-11-19 10:49+0200\n"
"Last-Translator: FULL NAME \n"
"Language: es\n"
"Language-Team: es \n"
@@ -42,9 +42,10 @@ msgid "Privacy Policy"
msgstr ""
#: iati_sphinx_theme/footer.html:26
+#, python-format
msgid ""
-"© Copyright 2024 United Nations Development Programme, on behalf of the "
-"IATI Secretariat"
+"Copyright %(current_year)s United Nations Development Programme, on "
+"behalf of the IATI Secretariat"
msgstr ""
#: iati_sphinx_theme/header.html:2
diff --git a/iati_sphinx_theme/locale/fr/LC_MESSAGES/sphinx.po b/iati_sphinx_theme/locale/fr/LC_MESSAGES/sphinx.po
index 6feddba..9fcdd88 100644
--- a/iati_sphinx_theme/locale/fr/LC_MESSAGES/sphinx.po
+++ b/iati_sphinx_theme/locale/fr/LC_MESSAGES/sphinx.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2024-11-12 16:24+0200\n"
-"PO-Revision-Date: 2024-11-12 16:24+0200\n"
+"POT-Creation-Date: 2024-11-19 10:48+0200\n"
+"PO-Revision-Date: 2024-11-19 10:49+0200\n"
"Last-Translator: FULL NAME \n"
"Language: fr\n"
"Language-Team: fr \n"
@@ -42,9 +42,10 @@ msgid "Privacy Policy"
msgstr ""
#: iati_sphinx_theme/footer.html:26
+#, python-format
msgid ""
-"© Copyright 2024 United Nations Development Programme, on behalf of the "
-"IATI Secretariat"
+"Copyright %(current_year)s United Nations Development Programme, on "
+"behalf of the IATI Secretariat"
msgstr ""
#: iati_sphinx_theme/header.html:2
diff --git a/iati_sphinx_theme/locale/sphinx.pot b/iati_sphinx_theme/locale/sphinx.pot
index 81317b1..33afe34 100644
--- a/iati_sphinx_theme/locale/sphinx.pot
+++ b/iati_sphinx_theme/locale/sphinx.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2024-11-12 16:24+0200\n"
+"POT-Creation-Date: 2024-11-19 10:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -41,9 +41,10 @@ msgid "Privacy Policy"
msgstr ""
#: iati_sphinx_theme/footer.html:26
+#, python-format
msgid ""
-"© Copyright 2024 United Nations Development Programme, on behalf of the "
-"IATI Secretariat"
+"Copyright %(current_year)s United Nations Development Programme, on "
+"behalf of the IATI Secretariat"
msgstr ""
#: iati_sphinx_theme/header.html:2