centralnicgroup-opensource / rtldev-middleware-whmcs

CentralNic's WHMCS Software Bundle
https://centralnicreseller.com
Other
35 stars 15 forks source link

Extend Translation Support for DNSSEC Template #271

Closed DennisSkov closed 10 months ago

DennisSkov commented 10 months ago

In tpl_ca_dnssec.tpl, the phrase "KEY Records" exists. If I remember correctly, KEY records are not in use anymore and have been replaced by DNSKEY records.

While we're at it: Some strings are hardcoded in the template files. Would it be possible to use translations instead? 🙂

KaiSchwarz-cnic commented 10 months ago

Hey @DennisSkov,

thanks for addressing. Very much appreciated. Basically, yes, we deal with either DNSKEY Records or DS Records - depends on the TLD. Let me dive into adding/extending translation support to that template file and including the review of default texts as well.

I'll keep you in the loop.

KaiSchwarz-cnic commented 10 months ago

Related:

WHMCS ships with built-in translations related to DNSSEC. We'll consider them, but those translations are available only with WHMCS 8.7++ (imho the launch of DNSSEC for the built-in CNR Module).

$_LANG['domainDnsSec']['management'] = "DNSSEC Management";
$_LANG['domainDnsSec']['dsRecords'] = "DS Records";
$_LANG['domainDnsSec']['keyTag'] = "Key Tag";
$_LANG['domainDnsSec']['algorithm'] = "Algorithm";
$_LANG['domainDnsSec']['digestType'] = "Digest Type";
$_LANG['domainDnsSec']['digest'] = "Digest";
$_LANG['domainDnsSec']['keyRecords'] = "KEY Records";
$_LANG['domainDnsSec']['flags'] = "Flags";
$_LANG['domainDnsSec']['protocol'] = "Protocol";
$_LANG['domainDnsSec']['publicKey'] = "Public Key";
$_LANG['domainDnsSec']['publicKeyNoSpace'] = "Public Key should not have any whitespace.";
$_LANG['domainDnsSec']['warning'] = "Caution: Incorrect DNSSEC settings might render your domain unreachable.";

plus the following which is a custom translation (read below):

$_LANG['domainDnsSec']['ttl'] = "TTL";

So, for customers with lower versions, it would mean to add those translations manually. Maybe Lang::trans allows for specifying a default text. Something to check. Sadly WHMCS did not make the explanations available to the columns of interest. So, what is the TTL, Public Key, Digest Type, ... If we can't specify a default text, we might have to clean up those parts of the UI.

DennisSkov commented 10 months ago

I don't think there's any way to set a default string in case the translated string doesn't exist. Another way do to it would be to merge your custom language files with WHMCS'. That way, the translations are available within the $lang variable in all templates. We're doing this for a couple of our own modules and haven't had issues with it.

KaiSchwarz-cnic commented 10 months ago

Yes, right. There's sadly no way for a default text fallback. That would be highly beneficial to theme devs... Anyway, I removed the explanations - people dealing with DNSSEC should know that and we follow WHMCS' example.

Still, let me share an useful approach when it comes to a single translation fallback. Not really that nice, but working:

Here how we did with the TTL Column which isn't included in WHMCS' translations:

{assign "ttlheadlinekey" "domainDnsSec.ttl"}
{assign "ttlheadline" Lang::trans($ttlheadlinekey)}
{if $ttlheadline === $ttlheadlinekey} {assign "ttlheadline" "TTL"} {/if}

It is at least providing the possibility to translate "TTL" differently while probably not of use.

v21.6.3 is released. NOTE: as we use WHMCS' default translations, you'll have to override $_LANG['domainDnsSec']['keyRecords'] using an overrides file. They ship it as "Key Records" and not as "DNSKEY Records" as well. This may change in future releases of WHMCS.

Hope that helps!