centralnicgroup-opensource/rtldev-middleware-whmcs

Extend Translation Support for DNSSEC Template

DennisSkov opened this issue · 4 comments

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? 🙂

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.

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.

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.

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!