I said I would look into it, so I finally took me a little time tonight. Here is a reasonably simple solution that I came up with, to enable the translation of the "Last Seen:" label.
EDIT: I also took the opportunity to resolve the same issue with the "Type:" labels, as that string was also defined in the CSS. It should be noted that both of the translated strings already exist in the localized language files. But they were never actually used before, since there was no mechanism for handling localization of strings defined in the CSS files!
First, I commented out
ALL of the sections (
there are 8 or 9 of these) in the 'style.css' that were setting the "content" and "font-style" properties on the "Last Seen" fiels. Additionally, I did the same for
ALL the sections (
I think there were 3) targeting the "Type" fields. Below are examples of such sections:
Code: Select all
/* body table#itemtable tr td:first-child + td + td + td + td:before{
content: "Last Seen: ";
font-style: italic;
} */
/* body table#itemtable tr td:first-child + td + td + td + td:before{
content: "Type: ";
font-style: italic;
} */
Then I introduced the following lines at the very beginning of a js that was loaded when a page was initialized. For my little Proof-Of-Concept here, I did it in 'DashboardController.js', but maybe it should go into one of the more generic JavaScripts instead, to assure that it will be used on all pages:
Code: Select all
var langLastSeen='"' + ($.t("Last Seen")) + ': ";';
var langTypeText='"' + ($.t("Type")) + ': ";';
document.styleSheets[0].insertRule('td#lastupdate::before { content: ' + langLastSeen + '; font-style: italic;}', 0);
document.styleSheets[0].insertRule('td#type::before { content: ' + langTypeText + '; font-style: italic;}', 0);
Just a short note: Over the years, I have written in more than 20 different programming/scripting languages, but
javascript is definitely NOT one of my favorites, so the code might appear a bit primitive. Especially the awkward way I pad on the required quotes to the local variable strings, but it works. Please see it mainly as a Proof-Of-Concept and feel free to do whatever tweaking you deem necessary!
And please also be aware that I have not verified if these modifications possibly might have some other unforeseen implications!
/P-G