WordPress.org

Ready to get started?Download WordPress

Forums

WP Photo Album Plus
[resolved] Changing the locale (7 posts)

  1. Philstix
    Member
    Posted 1 year ago #

    I'm now using WP Photo Album Plus with qTranslate for a site in English, Dutch, German and French. I'm extremely impressed with the amount of thought and effort you have put into this plugin.

    I use the qTranslate dropdown control to switch languages, so that for example the url of http://mysite/info will automatically change to http://mysite/nl/info when I switch from English to Dutch.

    If I run WP Photo Album Plus without subsequently changing languages it's fine - it detects the locale and uses that to display text in the correct language.

    The problem is that if I then change the locale with qTranslate's dropdown control WP Photo Album Plus doesn't detect the change and stays in the same language that applied when it was started.

    So if I'm displaying the photo gallery page in Dutch the url is http://mysite/nl/photo-gallery/ and if I then start a slideshow from that page the url becomes http://mysite/nl/photo-gallery/?locale=nl_NL&wppa-album=3&wppa-slide&wppa-occur=2&wppa-photo=20 and the slideshow starts with Dutch text displayed correctly.

    If during the slideshow I change the locale, say from Dutch to German, the url changes to http://mysite/de/photo-gallery/?locale=nl_NL&wppa-album=3&wppa-slide&wppa-occur=2&wppa-photo=20 so that the rest of the page is in German but the slideshow text is still in Dutch.

    Is there any way I can make WP Photo Album Plus dynamically change its locale while a slide show is running?

    I have tried both the old and new shortcode / script alternatives without success. I was hoping there might be a locale attribute to set the locale but I couldn't see anything in the reference pages. Is there perhaps some php I could run in a foreign shortcode to change the locale?

    http://wordpress.org/extend/plugins/wp-photo-album-plus/

  2. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 1 year ago #

    Is there any way I can make WP Photo Album Plus dynamically change its locale while a slide show is running?

    No, that is not possible as the slideshow data is already local, changing the slide is entirely done with js, using the data in the language the page was created.

    Why would one want to change the language there? Is this a pure academic issue or does it have any practical use?

  3. Philstix
    Member
    Posted 1 year ago #

    No this is not academic, it is relevant to the site I'm developing.

    The user is free to change the language at any time using the qTranslate dropdown control. That causes a different version of the page to be loaded, one with a different language and a different url. The same WP Photo Album Plus shortcode is in each version of the page.

    I thought that when I changed the language while a slide show was running that the slideshow would stop (because I'm opening a different page) and the shortcode in the new page would cause a new slideshow to start, taking the locale of the new page. It seems that either the original slideshow keeps running or, if a new slideshow is started by the new page, it uses the locale set by the first page.

  4. Philstix
    Member
    Posted 1 year ago #

    I've done a bit more testing with it, and it looks like it does start a new slideshow running, but it keeps the old locale setting.

  5. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 1 year ago #

    This makes sense. I will see if i can change the priority of searching for a locale such that if one is set (by qTranslate) it should have precedence over the locale in the querystring.

    To be continued...

  6. Philstix
    Member
    Posted 1 year ago #

    I've come up with a workaround for the problem.

    I renamed each album using qTranslate shortcodes of the form:
    `[:en]English Title[:nl]Dutch Title[:de]German Title[:fr]French Title' in the album title input box.

    Then I changed the way I loaded the slideshow by using WPPA+ scripts instead of shortcodes, and referring to the album by the localised name instead of by number:
    English page: %%wppa%% %%slide="$English Title"%%
    Dutch page: %%wppa%% %%slide="$Dutch Title"%%
    German page: %%wppa%% %%slide="$German Title"%%
    French page: %%wppa%% %%slide="$French Title"%%

    I also had to disable the WPPA+ link from the album cover photo I'm using, and manually create links to each slideshow page to make sure it went to the page with the correct locale.

    It's a workaround rather than a solution, but it gets the job done :-)

    Thanks again for this wonderful plugin.

  7. Jacob N. Breetvelt
    Member
    Plugin Author

    Posted 1 year ago #

    That causes a different version of the page to be loaded, one with a different language and a different url. The same WP Photo Album Plus shortcode is in each version of the page.

    This is not needed, you can have all languages in one page.

    I renamed each album using qTranslate shortcodes of the form:

    [:en]English Title[:nl]Dutch Title[:de]German Title[:fr]French Title' in the album title input box.

    This is how you should do it.

    English page: %%wppa%% %%slide="$English Title"%%
    Dutch page: %%wppa%% %%slide="$Dutch Title"%%
    German page: %%wppa%% %%slide="$German Title"%%
    French page: %%wppa%% %%slide="$French Title"%%

    This is not recommended, numbers should do.

    I did some testing in my docs site: http://wppa.opajaap.nl/ and can not reproduce the problem. I tested with the qTranslate settings (advanced) Query mode (my default) and pre-path (as it is now) but both ways work.
    I also tested it with and without &locale=... : i removed:

    //	if ( $wppa_locale ) {
    //		if ( $key == 'js' ) $pl .= 'locale='.$wppa_locale.'&';
    //		else $pl .= 'locale='.$wppa_locale.'&';
    //	}

    from wppa-functions.php in the routine function wppa_get_permalink() as it seems to be redundant and it shortens the permalink. Still correct behaviour.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.