Permlink Replies: 11 - Pages: 1 - Last Post: 05-Apr-2020 16:48 Last Post By: ctwist
ksmatharu

Posts: 62
Registered: 2-May-2009
Setting the language for album pages - Jupiter
Posted: 04-Apr-2020 21:09
  Click to reply to this thread Reply
I've recently been test-driving the new Microsoft Edge browser and it seems very decent. It has language detection and pops up a message to translate a page if it thinks that the page is in a different language to one's own.

For some reason, Edge has been popping up messages to translate several of my Jupiter slide pages. I think it gets triggered by the place-names of some of my travel photos.

I wasn't able to find a setting in JAlbum or Jupiter to declare the language as English, perhaps I didn't look hard enough, but I was able to use Jupiter's code settings to add the following into the <head> section:

<meta http-equiv="content-language" content="en-gb" />


It works a treat and now Edge doesn't offer to translate my album pages. Thought I might pass this on in case others have a similar problem. Or perhaps for someone to point me to a simpler or more elegant solution :)
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Setting the language for album pages - Jupiter
Posted: 04-Apr-2020 21:15   in response to: ksmatharu in response to: ksmatharu
  Click to reply to this thread Reply
In HTML5, the correct way to specify the language is
<!DOCTYPE html>
<html lang="en">
jGromit

Posts: 6,778
Registered: 31-Jan-2006
Re: Setting the language for album pages - Jupiter
Posted: 04-Apr-2020 22:08   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
Attachment loremipsum.txt (3.5 KB)
I've never bothered with the HTML lang attribute, because it seemed to be geared to screen readers, hardly a concern when you're producing photo albums, and to helping search engines, which don't really need the assist (as long as most of the text on a page is in one language, the search bots will correctly identify it).

If I were to build it into the skins, would it be sufficient to let the user define language on the Advanced > User Variables tab? I'd rather not add more UI clutter for something that few users would ever make use of, especially since it would make for a humongous JComboBox! Or maybe just a simple text field on the skin's Misc tab, into which you can enter whatever you like?

By the way, if you want some amusement, plug the standard lorem ipsum nonsense Latin text into a page (like in the top infotxt), and feed it to Chrome. The offered translation is a wonder to behold. Text attached.
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Setting the language for album pages - Jupiter
Posted: 04-Apr-2020 22:22   in response to: jGromit in response to: jGromit
  Click to reply to this thread Reply
In my skin, I set the language to
Config.getConfig().getInterpretedLanguage()
This assumes that the album's language is the same as the language chosen in the jAlbum preferences.
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Setting the language for album pages - Jupiter
Posted: 04-Apr-2020 22:40   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
Even simpler: set the language to ${language}. This comes from CompiledBase.

Edited by: ctwist on 04-Apr-2020 17:29
jGromit

Posts: 6,778
Registered: 31-Jan-2006
Re: Setting the language for album pages - Jupiter
Posted: 04-Apr-2020 22:52   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
The language variable comes up void for me, unless the user has specified it as a user variable (which is what the documentation says).

I'm not sure I'd want to do the user the "favor" of extracting the config language, anyway. I've seen too many cases in which the user has jAlbum set to one language, but is producing albums in another.
RobM

Posts: 3,126
Registered: 4-Aug-2006
Re: Setting the language for album pages - Jupiter
Posted: 05-Apr-2020 00:01   in response to: jGromit in response to: jGromit
  Click to reply to this thread Reply
jGromit wrote:
I'm not sure I'd want to do the user the "favor" of extracting the config language, anyway. I've seen too many cases in which the user has jAlbum set to one language, but is producing albums in another.
There is also the problem of users writing in two languages, like English and French. Then, I believe, the main language can be declared and each div or paragraph of the other language would need a language override. Not something a skin could do.
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Setting the language for album pages - Jupiter
Posted: 05-Apr-2020 00:19   in response to: RobM in response to: RobM
  Click to reply to this thread Reply
If the user uses 2 languages, he can override the language in the text
<span lang="fr">comment text</span>


Edited by: ctwist on 04-Apr-2020 18:20
Actually, I am repeating what you said, aren't I?
RobM

Posts: 3,126
Registered: 4-Aug-2006
Re: Setting the language for album pages - Jupiter
Posted: 05-Apr-2020 01:01   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
ctwist wrote:
If the user uses 2 languages, he can override the language in the text
<span lang="fr">comment text</span>

Edited by: ctwist on 04-Apr-2020 18:20
Actually, I am repeating what you said, aren't I?

Just a bit ;)
I have only seen one or two albums with two languages being used and from memory they did not use lang attributes in their content. Most users wouldn’t know about them and, a skin can’t easily do it, not worth the effort anyway. It is a fringe case, but I thought it might show how coding for languages in a template system needs to be made a priority if it is truly to be of use.
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Setting the language for album pages - Jupiter
Posted: 05-Apr-2020 13:47   in response to: jGromit in response to: jGromit
  Click to reply to this thread Reply
jGromit wrote:
If I were to build it into the skins, would it be sufficient to let the user define language on the Advanced > User Variables tab? I'd rather not add more UI clutter for something that few users would ever make use of, especially since it would make for a humongous JComboBox!
Look at ExhibitPlus. It builds a language combo box from the available translations. Refer to getSupportedLanguages() in onload.bsh.
If the user wants a different language, he has to provide a translation.

Edited by: ctwist on 05-Apr-2020 07:57
Correction: The list of languages is editable, so the user can enter a language that is not in the list.
jGromit

Posts: 6,778
Registered: 31-Jan-2006
Re: Setting the language for album pages - Jupiter
Posted: 05-Apr-2020 14:14   in response to: ctwist in response to: ctwist
  Click to reply to this thread Reply
That does have a certain appeal. The list isn't loaded up with choices that fall into the "wildly unlikely" category, like Dzongkha or Haitian Creole, but if a speaker of Northern Ndebele wanders in, he's not shut out.

ETA: Interesting that the skin doesn't use it to set an HTML language attribute!
ctwist

Posts: 559
Registered: 27-Sep-2003
Re: Setting the language for album pages - Jupiter
Posted: 05-Apr-2020 16:48   in response to: jGromit in response to: jGromit
  Click to reply to this thread Reply
jGromit wrote:
ETA: Interesting that the skin doesn't use it to set an HTML language attribute!
That will be fixed in the next (i.e. "final") release.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums