Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author WPReady

    (@wpready)

    Hi papijo,
    The complete words ‘[Show as slideshow]’ and ‘[Show picture list]’ are translatable and they are present in the nggallery.pot

    Maybe the problem is that words are including ‘[‘ and ‘]’ chars?

    Thread Starter papijo

    (@papijo)

    Hi and thanks for the prompt reply.
    Yes the strings are present in the nggallery.pot and can be translated from there, but… only once.
    Let me explain again. Maybe the problem comes from the fact that those 2 strings are customizable in the Settings interface. For a monolingual site, that’s OK, but not for a bi/multi-lingual site.

    Scenario
    Before installing NextCellent Gallery.
    With Poedit open nggallery.pot and create a new translation file save it as nggallery-fr_FR.po. Do the following translations:
    [Show as slideshow] = [Afficher le diaporama]
    [Show picture list] = [Afficher les vignettes]
    Enable slideshow = Activer diaporama
    This is the text the visitors will have to click to switch between display modes. = C’est le texte, que les visiteurs devront cliquer pour basculer entre les modes d’affichage.
    Text to show: = Texte à afficher:

    In admin mode, set your Site language to French.
    Now install and activate NextCellent Gallery.
    In General Settings (admin mode) set Site language to French.
    Install and activate NextCellent Gallery.
    In the Gallery Settings / Gallery / Slideshow section you can see:

    Diaporama |x| Activer diaporama
    Texte à afficher: |[Show as slideshow]| |[Show picture list]|
    C’est le texte, que les visiteurs devront cliquer pour basculer entre les modes d’affichage.

    The 2 strings in the boxes have not been translated.
    Now, of course, I could translate them “manually” by entering French translations into those 2 fields, but… then the French strings will appear on the front end of my site whether the visitor is in French or in English language, which is not what I want.

    Plugin Author WPReady

    (@wpready)

    It seems the issue is because the string is translated before ,but not after.
    However, both strings should suport wpml,polyglot or qtrans.
    I have to run few tests to confirm the behavior.

    Plugin Author WPReady

    (@wpready)

    Confirmed the behavior you mentioned, there will be a minor fix to be delivered shortly.
    However, even if we correct the issue, there is another problem you might consider:

    As an example, if you decide to change the first string ([Show as slideshow]) to ‘[Show Slide]’ this text will be displayed on ALL languages. Since the new value is saved on the database, it also implies that that Poedit can’t help it here (!)

    The fix will correct the behavior so .po files will work again, but currently Nextcellent can’t help you in the above scenario.

    Does it make sense to you?

    Thread Starter papijo

    (@papijo)

    Yes, I understand this. Thanks for looking into the problem.

    Plugin Author WPReady

    (@wpready)

    I tested this solution and it worked fine with current Nextcellent installa
    With minor changes, It will also solve issues between Polylang and other plugins.

    The code needs to be added to current theme in functions.php
    Please check this and see if this work for you.

    //Workaround translation for Nextcellent (can be applied to other plugins)
    //STEPS
    //1-Add strings to be dinamically translated to the Polylang collection
    if (function_exists(‘pll_register_string’)) {
    pll_register_string(‘nggallerySlide’,'[Show as slideshow]’);
    pll_register_string(‘nggalleryPictureList’,'[Show picture list]’);
    }
    //2-Go to PolyLang Languages, translate the strings included for every language

    //3-Add this filter localization for Nextcellent
    //Reference: https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/
    function filter_translation($to_translate) {
    if (function_exists(‘pll__’) && ($to_translate!=””)) {
    return pll__($to_translate);
    }
    return $to_translate; //safe way out if Polylang is disabled / empty strings.
    }

    add_filter(‘localization’,’filter_translation’,10,1);

    Thread Starter papijo

    (@papijo)

    Good job! Works as expected on a multi-lingual site with Polylang plugin enabled.
    One problem though. On a multi-lingual site with Polylang plugin enabled, in the Gallery general settings, the Slideshow / Text to show should NOT display customizable ‘[Show as slideshow]’ and ‘[Show picture list]’ input fields, because if by mistake an admin modifies those strings, then the polylang translations will no longer work!

    This probably needs refining, but I have tested the following code with Polylang installed and un-installed, and it works. Hack to nextcellent-gallery-nextgen-legacy\admin\class-ngg-options.php code, from line 478:

    <label>
    							<input name="galShowSlide" type="checkbox" value="true" <?php checked( $options['galShowSlide']); ?>>
    							<?php _e('Enable slideshow','nggallery'); ?>
    						</label>
    							<br>
    						<?php
    						if (function_exists('pll_register_string')) {
    								echo $options['galTextSlide'].' '.$options['galTextGallery'].'<br>';
    								echo "You can customize these strings in your multilang plugin settings<br>";
    							} else {
    								?>
    						<label>
    							<?php _e('Text to show:','nggallery');
    							?>
    							<input type="text" class="regular-text" name="galTextSlide" value="<?php echo $options['galTextSlide'] ?>">
    						</label>
    						<input type="text" name="galTextGallery" value="<?php echo $options['galTextGallery'] ?>" class="regular-text">
    						<?php } ?>
    Plugin Author WPReady

    (@wpready)

    Hi papijo,
    interesting hack 🙂
    I agree with you this is an annoying situation.

    Looking your solution, the plugin might have a way to deny/allow some options to prevent users making undesired actions.

    Roles options provide some degree of control but not that fine grained.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Languages support for Slideshow "Text to show:"’ is closed to new replies.