How to make Authentic Theme to work with custom-lang file?

Per discussion on https://www.virtualmin.com/node/31006, I've copied the /usr/libexec/webmin/authentic-theme/lang/en to /usr/libexec/webmin/authentic-theme/custom-lang, edited some strings, however unfortunately couldn't get them reflected on UI even after restarting Webmin. Looking at the following code, where the string "Webmin" is hardcoded in HTML:

<label for="open_webmin">
                <i class="wbm-webmin wbm-sm"></i><span>Webmin</span></label>

or hardcoded "Create Virtual Server" in

<li class="sub_active">
<a target="page" class="navigation_module_trigger" data-href="/virtual-server/domain_form.cgi?generic=1&amp;gparent="><i class="fa fa-fw fa-plus-square-o"></i> <span>Create Virtual Server</span></a>
<span class="current-large"></span></li>

I wonder if Authentic Theme can work with custom-lang files at all?

Status: 
Closed (fixed)

Comments

Two new findings:

  1. Moving the /usr/libexec/webmin/authentic-theme/custom-lang file to /etc/webmin/authentic-theme and restarting Webmin didn't help.

  2. Editing the /usr/libexec/webmin/authentic-theme/lang/en file and replacing left_virtualmin_create=Create Virtual Server with left_virtualmin_create=Create Domain also didn't work.

I know that editing this file directly is not recommended, because the right way is to create custom-lang file to override strings in "en" file, however I just wanted to test as modifying this file directly usually works. This means Authentic Theme doesn't take the presence of language files into account at all.

The custom-lang file can only override strings that aren't hard-coded ... in the perl code, they look like $text{'messagename'}

The real bug here is that authentic theme has hard-coded strings. I'll ask the author about this.

Ilia's picture
Submitted by Ilia on Thu, 01/07/2016 - 04:02

The custom-lang file actually works.

Reading the provided link above (Change "Virtual Server" to "Domain") I tested it as it's written. However, I don't understand what is the point of copying files in the lang directory. It wasn't necessary in my case. All I needed is to create custom-lang file in etc of a module or theme to make things work.

To override Create Virtual Server you would need to put to /etc/webmin/virtual-server/custom-lang the following:

left_generic=Create Domains

The stray variable left_virtualmin_create in my theme will be removed as it does nothing.

The piece of HTML code that you showed will always show a string, as it's processed on the server, thus will always look hardcoded to the browser.

There some hardcoded strings, like Webmin, Virtualmin, Cloudmin and some more.. It will be fixed in the next release.

Ilia's picture
Submitted by Ilia on Thu, 01/07/2016 - 04:07

Jamie, I find this a bit inconvenient. Can you write couple more line of code (if possible by design), so that theme's custom_lang file could contain all possible strings from all modules that a user wants to override.

I realize that there could be collisions, thus using module name would be required. For example, instead of making user to put custom strings to /etc/webmin/virtual-server/custom_lang, the user could put all in the /etc/authentic-theme/custom_lang with the following format:

virtual-server: left_generic=Create Domains

Doing so, will make things organized rather than having separate file in each directory.

The custom_lang file actually works. To override Create Virtual Server you would need to put to /etc/webmin/virtual-server/custom_lang the following: left_generic=Create Domains

I didn't know the /usr/libexec/webmin/virtual-server/lang/en changed a lot since we copied it initially and replaced all the strings we needed to replace:

-rw-r--r-- 1 root root 358155 Jan  7 16:48 custom-lang.new
-rw-r--r-- 1 root root 327599 Jan  7 16:46 custom-lang.old

So copying it from a new and replacing strings worked this time.

Ilya, just so you know the file you referred to should be /etc/webmin/virtual-server/custom-lang and not /etc/webmin/virtual-server/custom_lang.

Reading the provided link above (Change "Virtual Server" to "Domain") I tested it as it's written. However, I don't understand what is the point of copying files in the lang directory. It wasn't necessary in my case. All I needed is to create custom_lang file in etc of a module or theme to make things work.

I really have no idea, that question should be addressed to Jamie as unfortunately there is no detailed documentation on the lgnauge files and we are just following the instructions given to us before on https://www.virtualmin.com/node/31006

The stray variable left_virtualmin_create in my theme will be removed as it does nothing.

What about content of the /usr/libexec/webmin/authentic-theme/lang/en file? Replacing some strings in it doesn't seem to have any effect. It is not clear where should we copy this file to.

There some hardcoded strings, like Webmin, Virtualmin, Cloudmin and some more.. It will be fixed in the next release.

Well, because of exactly this kind of things that are need to be polished we really didn't want to roll out this otherwise excellent theme to the end-users. I understand it will take time to find out this kind of issues and we are ready to heavily start testing the new theme and helping to find out all the nuances, but please try to understand our position as hosting vendor - we run hundreds of Virtualmin servers with customized interfaces and their end-users are now all confused.

Jamie, I find this a bit inconvenient. Can you write couple more line of code (if possible by design), so that theme's custom_lang file could contain all possible strings from all modules that a user wants to override.

Whatever format you, *-min team, choose between yourselves we are ready to accept and follow. But please find some consensus on this kind of things as this kind of ambiguity is effecting us, *-min users.

So it wouldn't work to have a single override file for all modules, as there can be duplicates.

Instead, you need to create an /etc/webmin/MODULE/custom-lang file to override strings for each module.

Guys, could you please point out how to replace all the "Webmin" strings in the attached screenshot block?

Those are module titles, which have to be over-ridden in a different way. You can do this in the Webmin UI, at Webmin -> Webmin Configuration -> Module Titles.

Ilia's picture
Submitted by Ilia on Fri, 01/08/2016 - 07:18

@JamieCameron Jamie, this is why I mentioned the following:

module-name:left_generic=Create Domains

Regards,
Ilia

Ilia's picture
Submitted by Ilia on Sun, 01/10/2016 - 16:26

It's fixed in 17.40. Please upgrade.

Ilia's picture
Submitted by Ilia on Thu, 02/04/2016 - 06:27

Not sure what you mean but if you want not to display the host name, you could do the following by adding it to theme's extensions (CSS):

.session_login form .form-signin-paragraph strong {
    display: none;
}

Not the hostname, but the word "Webmin" itself. I don't know how to make this clearer.

Ilia's picture
Submitted by Ilia on Tue, 02/09/2016 - 01:41

Uupps. I see now. In 17.64 it will be dependent on theme_xhred_titles_wm and theme_xhred_titles_um lang strings as it should have been.

Thanks for reporting.

Ilia's picture
Submitted by Ilia on Tue, 02/09/2016 - 01:42

Assigned: Unassigned »
Status: Active » Closed (fixed)