Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2017-07-23 08:47:32

michilge
Member
From: Sprockhövel, Germany
Registered: 2013-04-15
Posts: 206
Website

Search Handoff Localization

The new cross search is a very fine feature.

Is it localization ready yet?

If yes, what is to be done?

Have a nice weekend
Michael

Offline

#2 2017-07-23 10:20:25

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Search Handoff Localization

Look under Publisher Settings with the other Search settings


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2017-07-23 11:37:44

michilge
Member
From: Sprockhövel, Germany
Registered: 2013-04-15
Posts: 206
Website

Re: Search Handoff Localization

Hi Rod,
thank you for the hint. That helps for the album search. I translated the theme before the 1.2.2 update.

Edit: I tried to gather the intl-strings once more but that didn't work. “Search blog" didn't appear in the.pot file.

For blog search I found the string <?php  echo _x( 'Search Blog', 'submit button', 'pangolin-template' ); ?> in search form.php.
The string "Search Blog“ does not appear in the language file.
Might it help to change the “_x(" to "__(" and have the .pot rebuilt?

Cheers
Michael

Last edited by michilge (2017-07-23 11:42:37)

Offline

#4 2017-07-23 13:06:42

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Search Handoff Localization

Try changing "echo _x" to just "_e".


Matt

The Turning Gate, http://theturninggate.net

Offline

#5 2017-07-23 15:25:10

michilge
Member
From: Sprockhövel, Germany
Registered: 2013-04-15
Posts: 206
Website

Re: Search Handoff Localization

I tried again. It can stay "echo _x".

But I changed the plain words "Search Albums" to "<?php  echo __( 'Alben durchsuchen', 'pangolin-template' ); ?> " and translated again. The whole thing now reads as below.

Now I get the translated handoff string below the search input.

But when I reexport the theme from Backlight it will be overwritten.

<form role="search" method="get" class="search-form" action="<?php  echo esc_url( home_url( '/' ) ); ?>">
	<p>
	<label><span class="screen-reader-text"><?php  echo _x( 'Search for:', 'label', 'pangolin-template' ); ?></span></label>
	<input type="text" class="search-field" placeholder="<?php  echo esc_attr_x( 'Enter search, hit Return...', 'placeholder', 'pangolin-template' ); ?>" value="<?php  echo get_search_query(); ?>" name="s" />		
	</p>
	<button type="submit" class="fa_pseudo"><span><?php  echo _x( 'Search Blog', 'submit button', 'pangolin-template' ); ?></span></button>
</form>

<form role="search" action="/backlight/search" method="GET" class="search-handoff">
	<input type="hidden" id="q" name="q" value="" />
	<button type="submit" class="fa_pseudo"><span><?php  echo __( 'Search Albums', 'pangolin-template' ); ?></span></button>
</form>

<hr />

Last edited by michilge (2017-07-23 15:27:24)

Offline

#6 2017-07-23 17:01:11

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Search Handoff Localization

I see the problem. Change:

	<button type="submit" class="fa_pseudo"><span><?php echo __c('TEXT_SEARCH_ALBUMS_BUTTON', 'Search Albums') ?></span></button>

To:

	<button type="submit" class="fa_pseudo"><span><thp> _e( '<?php echo __c('TEXT_SEARCH_ALBUMS_BUTTON', 'Search Albums') ?>', 'submit button', '<?php echo $template->getIdentifier(); ?>' ); </thp></span></button>

Matt

The Turning Gate, http://theturninggate.net

Offline

#7 2017-07-23 23:55:38

michilge
Member
From: Sprockhövel, Germany
Registered: 2013-04-15
Posts: 206
Website

Re: Search Handoff Localization

I had to make another change to make 'Search Albums' appear in the language template. It is now:

<button type="submit" class="fa_pseudo"><span><thp> echo _x( '<?php echo __c('TEXT_SEARCH_ALBUMS_BUTTON', 'Search Albums') ?>', 'submit button', '<?php echo $template->getIdentifier(); ?>' ); </thp></span></button>

To make this clear for other users, the change was made in the file backlight/modules/pangolin-wordpress/dynamic/view/searchform.php which is the pattern, backlight uses when the theme is exported to Wordpress.

Thank You
Michael

Offline

#8 2017-07-24 01:00:04

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Search Handoff Localization

So using "_e" wouldn't show up for localization? You had to use "echo _x" instead?


Matt

The Turning Gate, http://theturninggate.net

Offline

#9 2017-07-24 01:53:16

michilge
Member
From: Sprockhövel, Germany
Registered: 2013-04-15
Posts: 206
Website

Re: Search Handoff Localization

The "echo " was missing. I copied "echo _x" from the 'Search Blog' instance from further up in the file.

To confirm this precisely I now tried again, changed to "_e", exported the theme, cleared the cache and revisited the loco translate WP plugin. In the plugin I selected the Pangolin-Template to edit the .pot. When I made it sync with the source files, one unused string got removed from the template. After another change back to "_x", 'Search Albums' was found and added to the .pot again as a new string.

Offline

Board footer

Powered by FluxBB