This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 36 - Pages: 3 [ 1 2 3 | Next ] - Last Post: 18 Feb 21, 14:45 Last Post By: AndreWolff Threads: [ Previous | Next ]
AndreWolff

Posts: 2,084
Registered: 14-Dec-2007
Save the preferred language in the project file.
Posted: 14 Feb 21, 17:47
 
  Click to reply to this thread Reply
I select as language under Preferences / General English for the sample albums for my skins, but for my private albums I use there the Dutch language,

So you understand what will happen:
If I update a sample album I forget to set the language to English and after I update a private album, I do forget to set the language to Dutch.

But if the preferred language is saved in the project file, the language is always correct, so please save the setting in the project file.
davidekholm

Posts: 3,767
Registered: 18-Oct-2002
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 12:38   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Attachment Minimal.jaskin (283.4 KB)
I see this point. There is actually some support for this already, but the skin developer needs to add a "language" combo box for it to work. However, adding this combo box (which some skins do) forces the majority of users to keep track of two language settings, which can be confusing, unless the default is to obey the preference language. Given this, I've improved the logic and also made it far easier for skin developers to provide their own language list. See the attached "Minimal.jaskin" file for how you can add your own "language" combo box to your skin, which also has a "<jAlbum preference>" option as the default setting. You also need v23.2.1 for this to work, so please do a core update first.

The key code of "onload.bsh" is the following:
import se.datadosen.util.Languages;
...
JComboBox<Item> language = new JComboBox<Item>() {
    {
        setModel(Languages.modelFrom(new File(skinDirectory, "texts")));
        insertItemAt(new Item("jalbum", "<jAlbum preference>"), 0);
        setSelectedIndex(0);
    }
};
 
This new Languages.modelFrom() API populates the combo box with the languages your skin supports. It uses "Item" objects so it can present full names for each language, but feed jAlbum the ISO_2 language code instead.
JeffTucker

Posts: 7,692
Registered: 31-Jan-2006
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 13:00   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
What does the "box-box-box" choice represent?

And is there no way for a user to enter a language for which there is no "texts" file in the skin or the core? In my skins, I let the user specify the HTML language. The list picks up all of the "texts" choices from the jAlbum core (not from the skin, which doesn't have any), but the user can also enter any of the standard codes. So, if he's built an album in which he's specified all of the tooltips, titles, and comments in Urdu, he can also get the page to include:
<html lang='ur'>
The skin stashes the choice in a skin-specific variable, htmlLanguage, to avoid any potential collisions.
JeffTucker

Posts: 7,692
Registered: 31-Jan-2006
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 13:22   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
What does the "box-box-box" choice represent?

Ah, it represents Korean. Not immediately obvious. ;)
davidekholm

Posts: 3,767
Registered: 18-Oct-2002
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 13:29   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Yes, the list simply presents the languages found under the directory you specify as argument. Isn't this the best approach? By using the name "language", jAlbum's engine reads it and ensures that all text.xyz constants are set up properly.
davidekholm

Posts: 3,767
Registered: 18-Oct-2002
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 13:33   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
What does the "box-box-box" choice represent?

Korean

And is there no way for a user to enter a language for which there is no "texts" file in the skin or the core?

No, what would be the point of that?
JeffTucker

Posts: 7,692
Registered: 31-Jan-2006
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 13:54   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
No, what would be the point of that?

I thought I explained that already. The user might have created an album in which everything is in Urdu. The <html> tag should have an indication that the language of the page is Urdu. The interwebs don't know or care what "texts" files there are in the app.

Well, never mind.
davidekholm

Posts: 3,767
Registered: 18-Oct-2002
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 14:54   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
You can off course make the JComboBox editable if you wish...
AndreWolff

Posts: 2,084
Registered: 14-Dec-2007
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 18:43   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
I see this point. There is actually some support for this already, but the skin developer needs to add a "language" combo box for it to work.
I am surprised that I have to change the skin to save the language setting in the project file!
That is not required for other jAlbum settings like dateFormat sharpenPercent, imageSize etc.

In the minimal skin the user can only select languages from which text properties files are available, so for instance Dutch can't be selected.
I don't understand this I think all languages should be selectable, also if no text properties file is available for the skin, so the the <html lang="xx> tag can be set in the index file.

A basic problem is that the skin crashes if jAlbum 23.2.1 is not used, so the skin can no longer be used by users of old jAlbum versions.

So I am sorry to say, but this implementation is not acceptable for me.
It should be possible to save the language setting in the project file independent of the used skin I think.
RobM

Posts: 3,644
Registered: 4-Aug-2006
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 20:49   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:
I select as language under Preferences / General English for the sample albums for my skins, but for my private albums I use there the Dutch language,
Why not stick to Dutch for your sample albums? As a sample, people will only be interested in the layout and styles and not the textual content. But if you don’t want to use Dutch, why not use Loren ipsum.
AndreWolff

Posts: 2,084
Registered: 14-Dec-2007
Re: Save the preferred language in the project file.
Posted: 15 Feb 21, 20:53   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Why not stick to Dutch for your sample albums? As a sample, people will only be interested in the layout and styles and not the textual content.
Because in that case most people don’t understand the dutch text in the Viewer settings window.
davidekholm

Posts: 3,767
Registered: 18-Oct-2002
Re: Save the preferred language in the project file.
Posted: 16 Feb 21, 17:23   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
AndreWolff wrote:

So I am sorry to say, but this implementation is not acceptable for me.
It should be possible to save the language setting in the project file independent of the used skin I think.

I basically agree but given that some skins already implement language selection I though this approach is safer.
JeffTucker

Posts: 7,692
Registered: 31-Jan-2006
Re: Save the preferred language in the project file.
Posted: 16 Feb 21, 17:32   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
In my skins, I don't think it would matter. There's a skin variable, htmlLanguage, that picks up the jAlbum language setting, but offers all of the other options, based on the core's "texts" files (not the skins). It also allows entry of any other code the user likes. The skin uses that variable to set the HTML page language, but that's all.

There isn't any collision, because the skins aren't using the jAlbum language setting for anything else - my skins don't have any "texts" files at all. The user can make things like tooltips say anything he wants, simply by entering text in the UI. He never has to wade into manual editing of a confusing file. And those all get saved with the project.

Example: https://jefftucker.net/mercury/man/mercury_text.html

Not sure about anyone else's skins. I believe Laza is always just grabbing the jAlbum language setting.
RobM

Posts: 3,644
Registered: 4-Aug-2006
Re: Save the preferred language in the project file.
Posted: 16 Feb 21, 18:41   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
Not sure about anyone else's skins. I believe Laza is always just grabbing the jAlbum language setting.
It would have made it easier for Polyglot, but I have already coded for the skin to populate the available languages.
AndreWolff

Posts: 2,084
Registered: 14-Dec-2007
Re: Save the preferred language in the project file.
Posted: 17 Feb 21, 10:14   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
I basically agree but given that some skins already implement language selection I though this approach is safer.
If you save the language setting independent from the used skin in a variable which is not used in a one of those skins, I think you can save the setting without problems for these skins.

Next these skins can remove the language combo-box and use your variable instead.
Legend
Forum admins
Helpful Answer
Correct Answer

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