瀏覽代碼

Backport PR #11190: Use only context and id to check i18n (#11191)

Co-authored-by: Frédéric Collonval <fcollonval@gmail.com>
MeeseeksMachine 3 年之前
父節點
當前提交
4adb09724a
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      scripts/i18n_check.py

+ 4 - 2
scripts/i18n_check.py

@@ -20,8 +20,10 @@ if __name__ == "__main__":
         )
 
     hash = sha256()
-    for entry in pot:
-        hash.update(str(entry).encode("utf-8"))
+    # Use only the context and the id as the position may changed without impact
+    # Sort the entry because the order in the POT file may changed (likely because code position changed)
+    for entry in sorted(map(lambda e: f"{e.msgctxt!s} {e.msgid!s}", pot)):
+        hash.update(entry.encode("utf-8"))
 
     proof = hash.hexdigest()