From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 6636B1FF164
	for <inbox@lore.proxmox.com>; Fri,  8 Nov 2024 14:05:10 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 2258DDCC8;
	Fri,  8 Nov 2024 14:05:10 +0100 (CET)
Date: Fri, 8 Nov 2024 14:04:36 +0100
From: Christoph Heiss <c.heiss@proxmox.com>
To: Timothy Nicholson <t.nicholson@proxmox.com>
Message-ID: <pxgkoys6mpqbcnd4evrdin2md6ftmqblk5epzb2f3ceqgxw5wm@jiukqzqneuti>
References: <20241108125254.147646-1-t.nicholson@proxmox.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20241108125254.147646-1-t.nicholson@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.030 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH widget-toolkit] fix #5836: ui: translate
 systemd states in ServiceView
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On Fri, Nov 08, 2024 at 01:52:54PM +0100, Timothy Nicholson wrote:
> [..]
> diff --git a/src/Utils.js b/src/Utils.js
> index 7dd034a..23b0db5 100644
> --- a/src/Utils.js
> +++ b/src/Utils.js
> @@ -305,6 +305,17 @@ utilities: {
>  	return Ext.htmlEncode(username);
>      },
>
> +    renderSystemdStatus: function(status) {
> +	switch (status) {
> +	    case 'masked':
> +		return gettext('disabled');

Masked services are not the same as disabled, they have an important
difference in meaning, IMHO.

A *disabled* service does not start automatically on boot, but can still
be manually started using e.g. `systemctl start <name>.service`.
A *masked* service cannot even be started manually, so even stricter
than disabled.

> +	    case 'not-found':
> +		return gettext('not installed');
> +	    default:
> +		return gettext(status);

gettext() doesn't work that way, it needs the message as literal, as it
just extracts the given string in the argument.
See also proxmox-i18n/jsgettext.pl on how it works exactly.

So you'd need to switch-case each state individually (unfortunately).

> [..]
> @@ -203,6 +197,10 @@ Ext.define('Proxmox.node.ServiceView', {
>  		    sortable: true,
>  		    hidden: !Ext.Array.contains(['PVEAuthCookie', 'PBSAuthCookie'], Proxmox?.Setup?.auth_cookie_name),
>  		    dataIndex: 'unit-state',
> +		    renderer: (value, meta, rec) => {
> +			const unitState = rec.get('unit-state');
> +			return gettext(unitState);

Same as above.



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel