Neutral language for pmg

Mar 3, 2023
11
6
8
Hi Folks

One piece of push back we got with our user acceptance testing was the use of "whitelist" and "blacklist". It was a fairly simple fix of creating /usr/share/pmg-i18n/pmg-lang-en.js to override the defaults. In case anyone else has need:

JavaScript:
__proxmox_i18n_msgcat__ = {
    "1336346898": ["Allowlist"],
    "314166508" : ["Blocklist"],
    "646797339" : ["User Allowlist"],
    "926364573" : ["User Blocklist"],
    "966201948" : ["Use Auto-Allowlists"]
};

function fnv31a(text) {
    var len = text.length;
    var hval = 0x811c9dc5;
    for (var i = 0; i < len; i++) {
        var c = text.charCodeAt(i);
        hval ^= c;
        hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
    }
    hval &= 0x7fffffff;
    return hval;
}

function gettext(buf) {
    var digest = fnv31a(buf);
    var data = __proxmox_i18n_msgcat__[digest];
    if (!data) {
        return buf;
    }
    return data[0] || buf;
}

What I don't know yet is how this will survive an update/upgrade, ie will the message IDs change ...?

Cheers
Toby
 
Thanks for raising this issue - we already have an bug-report for it:
https://bugzilla.proxmox.com/show_bug.cgi?id=3755

and now that SpamAssassin 4.0 is out and the terms it uses are decided (Welcomelist and Blocklist - to keep acronyms WL and BL consistent) - we'll try to address it soon
 
  • Like
Reactions: pvps1
We upgraded to 8.0.6 yesterday, and now have (Welcome|Block)list in the pmg UI, however the daily report still uses the old language, fixed with:
Code:
root@purgatory 11:18 [templates]: diff -c /var/lib/pmg/templates/spamreport-verbose.tt.orig /var/lib/pmg/templates/spamreport-verbose.tt
*** /var/lib/pmg/templates/spamreport-verbose.tt.orig    2023-03-29 11:55:24.939706577 +0100
--- /var/lib/pmg/templates/spamreport-verbose.tt    2023-08-03 16:15:20.499974259 +0100
***************
*** 40,47 ****
        <td><a style='cursor:pointer;' href='[% item.href | url %]'><b>[% item.subject %]</b></a></td>
        <td align=right nowrap>
          <div style='font-size:xx-small;'>
!           <a href='[% item.href | url %]&action=whitelist'>Whitelist</a>&nbsp;
!           <a href='[% item.href | url %]&action=blacklist'>Blacklist</a>&nbsp;
            <a href='[% item.href | url %]&action=deliver'>Deliver</a>&nbsp;
            <a href='[% item.href | url %]&action=delete'>Delete</a>
          </div>
--- 40,47 ----
        <td><a style='cursor:pointer;' href='[% item.href | url %]'><b>[% item.subject %]</b></a></td>
        <td align=right nowrap>
          <div style='font-size:xx-small;'>
!           <a href='[% item.href | url %]&action=whitelist'>Welcomelist</a>&nbsp;
!           <a href='[% item.href | url %]&action=blacklist'>Blocklist</a>&nbsp;
            <a href='[% item.href | url %]&action=deliver'>Deliver</a>&nbsp;
            <a href='[% item.href | url %]&action=delete'>Delete</a>
          </div>
 
  • Like
Reactions: KatyComputer
  • Like
Reactions: KatyComputer