This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Rajeeb Banstola 3 months, 3 weeks ago.

Assigned support staff: Rajeeb Banstola.

Author Posts
June 20, 2019 at 4:46 pm #4061741

maciejM-9

I am trying to: add custom string to transalate

I expected to see: inserted string

Instead, I got: Parse error: syntax error, unexpected 'Hello' (T_STRING) in /wp-content/themes/uncode/partials/menus.php on line 529

In code it is:

	case 'hmenu-center':
					$this->html = '<div class="menu-wrapper'.$menu_sticky.$menu_no_arrow.$menu_sub_animation.' style-'.$stylemain.'-original">'.
													($no_secondary !== 'on' ? $secondary_menu_html : '').
													'
													<header id="masthead" class="navbar'.$stylemaincombo.'">
														<div class="menu-container'.$effects.$stylemainbackfull.'">
													<div class="navbar menu-secondary'.$stylemaincombo.$main_absolute.'">
														<div class="menu-container-mobile '.$effects.$stylemainbackfull.'">
															<div class="row-menu style-'.$stylemain.'-bg">
																<div class="row-menu-inner">
																	<div id="logo-container-mobile" class="col-lg-1 logo-container menu-produktowe" style="text-align: left;padding-top: 31px;">
										/*THIS IS LINE 529*/    		 <a href="/produkty"><i class="fa fa-th fa-1x fa-fw"></i> <span class="produkty-menu"><?php _e('Continue Shopping','uncode'); ?></span></a>
																	</div>
																	<div id="logo-container-mobile" class="col-lg-10 logo-container">
																		<div id="main-logo" class="navbar-header style-'.$stylemain.'">
																			'.$logoDiv.'
																		</div>
																	</div>
																	<div id="logo-container-mobile" class="col-lg-1 logo-container menu-kreatywne" style="text-align: right;padding-top: 31px;">
																		<div class="menu-kreatywne-mobile">[wpml_language_selector_widget] | <span class="logo-container menu-dodatkowe" style="text-align: right;padding-top: 31px;"><a href="#menu-kreatywne"><span class="kreatywne-menu">MENU</span> <i class="fa fa-bars fa-1x fa-fw"></i></a>
																		</div>
																	</div>
																</div>
	
June 21, 2019 at 2:24 am #4063957

Rajeeb Banstola

Hi,

Thank you for contacting WPML!

The error you mentioned doesn't seemed to be linked to the line number you indicated on the code as it doesn't include the text 'Hello'.

If you want to add a new translatable string, then please use the code below:

<?php echo _e( 'Your Text here', 'uncode' ); ?>

Here uncode is the text-domain of the theme you are using.

If you can provide more information on the code and how you are trying to add new string, I would be happy to help you more.

Please let me know.

June 21, 2019 at 7:54 am #4065371

maciejM-9

I add your code and I have this error:

Parse error: syntax error, unexpected 'Your' (T_STRING) in /wp-content/themes/uncode/partials/menus.php on line 529

Here is the code:

	case 'hmenu-center':
					$this->html = '<div class="menu-wrapper'.$menu_sticky.$menu_no_arrow.$menu_sub_animation.' style-'.$stylemain.'-original">'.
													($no_secondary !== 'on' ? $secondary_menu_html : '').
													'
													<header id="masthead" class="navbar'.$stylemaincombo.'">
														<div class="menu-container'.$effects.$stylemainbackfull.'">
													<div class="navbar menu-secondary'.$stylemaincombo.$main_absolute.'">
														<div class="menu-container-mobile '.$effects.$stylemainbackfull.'">
															<div class="row-menu style-'.$stylemain.'-bg">
																<div class="row-menu-inner">
																	<div id="logo-container-mobile" class="col-lg-1 logo-container menu-produktowe" style="text-align: left;padding-top: 31px;">
																	<a href="/produkty"><i class="fa fa-th fa-1x fa-fw"></i> <span class="produkty-menu"><?php echo _e( 'Your Text here', 'uncode' ); ?></span></a>
																	</div>
																	<div id="logo-container-mobile" class="col-lg-10 logo-container">
																		<div id="main-logo" class="navbar-header style-'.$stylemain.'">
																			'.$logoDiv.'
																		</div>
																	</div>
																	<div id="logo-container-mobile" class="col-lg-1 logo-container menu-kreatywne" style="text-align: right;padding-top: 31px;">
																		<div class="menu-kreatywne-mobile">[wpml_language_selector_widget] | <span class="logo-container menu-dodatkowe" style="text-align: right;padding-top: 31px;"><a href="#menu-kreatywne"><span class="kreatywne-menu">MENU</span> <i class="fa fa-bars fa-1x fa-fw"></i></a>
																		</div>
																	</div>
																</div>

I tried many options and I copied the wrong error by mistake in the first post - the correct one was written as "..."unexpected 'Continue'..."

June 25, 2019 at 1:07 am #4080253

Rajeeb Banstola

Hi,

Thank you for providing more details.

Instead of the previous code, please use the code below. I tested it and made sure it works perfectly.

'. esc_html__( 'Continue Reading', 'uncode') .'

You just need to place where the previous code was added including those quotes.

Let me know if this helps!