diff --git a/gitinspector/gitinspector.py b/gitinspector/gitinspector.py index 199fa92..2263b31 100755 --- a/gitinspector/gitinspector.py +++ b/gitinspector/gitinspector.py @@ -59,6 +59,8 @@ def __init__(self): self.useweeks = False def output(self): + localization.check_compatibility(version.__version__) + if not self.localize_output: localization.disable() diff --git a/gitinspector/localization.py b/gitinspector/localization.py index 7bec0a3..6dc8969 100644 --- a/gitinspector/localization.py +++ b/gitinspector/localization.py @@ -28,6 +28,7 @@ import gettext import locale import os +import re import sys import time @@ -74,6 +75,16 @@ def init(): __installed__ = True __translation__.install(True) +def check_compatibility(version): + if isinstance(__translation__, gettext.GNUTranslations): + header_pattern = re.compile ("^([^:\n]+): *(.*?) *$", re.MULTILINE) + header_entries = dict(header_pattern.findall(_(""))) + + if (header_entries["Project-Id-Version"] != "gitinspector {0}".format(version)): + print("WARNING: The translation for your system locale is not up to date with the current gitinspector " + "version. The current maintainer of this locale is {0}.".format(header_entries["Last-Translator"]), + file=sys.stderr) + def get_date(): if __enabled__ and isinstance(__translation__, gettext.GNUTranslations): date = time.strftime("%x")