latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Translate strings in paypal pro registration

Home Forums Community Forum Translate strings in paypal pro registration

Tagged: 

This topic contains 18 replies, has 3 voices. Last updated by  Cristián Lávaque 3 years, 6 months ago.

Topic Author Topic
Posted: Saturday May 25th, 2013 at 1:23 pm #50631

Hi,

I am trying to tranlate some strings in the paypal prof form vie the codestyling localizatian plugin.
Unfortunately, some string are not getting found, by the Plugin.

I had a look in the code, an there, these strings are translatable.

What can id dot, to translate this without touching the core files? Can i copy the template file to my folder and translate it in the Code directly?

The same Problem with tthe pro sidebar widget: Currently I am not able, to translate “My Account” and “Logout”.

Any help is welcome.

Cheers,
Lars

List Of Topic Replies

Viewing 18 replies - 1 through 18 (of 18 total)
Author Replies
Author Replies
Posted: Sunday May 26th, 2013 at 5:32 pm #50668

You can translate it with a hack like this too:

Create this dir/file: /wp-content/mu-plugins/s2hacks.php
See: Knowledge Base » Hacking s2Member® Via Hooks/Filters

[hilite pre_code]
Posted: Sunday May 26th, 2013 at 9:00 pm #50685

Hi Christian,

just to be sure: Where it says $translated there should follow the translated words?

Thanks,
Demian

Posted: Sunday May 26th, 2013 at 10:21 pm #50686

That’s right.

Posted: Monday May 27th, 2013 at 5:03 am #50701

Hi,

these strings are not contained in die

$original

variable.

This is an output form the

$original

variable:

enYes, I want to receive updates via email.[%s] Username/PasswordYour Username/Password for:
%s

Username: %%%%user_login%%%%
Password: %%%%user_pass%%%%
%%%%wp_login_url%%%%[%s] New User RegistrationNew User Registration on your site:
%s

User ID: %%%%user_id%%%%
Username: %%%%user_login%%%%
Email: %%%%user_email%%%%
IP Address: %%%%user_ip%%%%Congratulations! (your membership has been approved)Thanks %%%%first_name%%%%! Your membership has been approved.

If you haven’t already done so, the next step is to Register a Username.

Complete your registration here:
%%%%registration_url%%%%

If you have any trouble, please feel free to contact us.

Best Regards,
%sThank You! (instructions for access)Thanks %%%%first_name%%%%!

%%%%item_name%%%%

Your order can be retrieved here:
%%%%sp_access_url%%%%
( link expires in %%%%sp_access_exp%%%% )

If you have any trouble, please feel free to contact us.

Best Regards,
%sFree SubscriberBronze MemberSilver MemberGold MemberPlatinum MemberCongratulations! (your membership has been approved)Thanks %%%%first_name%%%%! Your membership has been approved.

%%%%item_name%%%%

Subscr. ID: %%%%subscr_id%%%%
Charges today: $%%%%initial%%%%
Recurring charges: $%%%%recurring/regular_cycle%%%%

Your Username/Password will arrive shortly, in a separate email. If you have any trouble, please feel free to contact us.

Best Regards,
%sThank You! (instructions for access)Thanks %%%%first_name%%%%!

%%%%item_name%%%%

Transaction ID: %%%%txn_id%%%%
Charges today: $%%%%amount%%%%

Your order can be retrieved here:
%%%%sp_access_url%%%%
( link expires in %%%%sp_access_exp%%%% )

If you have any trouble, please feel free to contact us.

Best Regards,
%sCongratulations! (your membership has been approved)Thanks %%%%first_name%%%%! Your membership has been approved.

%%%%item_name%%%%

Subscr. ID: %%%%subscr_id%%%%
Charges today: $%%%%initial%%%%
Recurring charges: $%%%%recurring/regular_cycle%%%%

Your Username/Password will arrive shortly, in a separate email. If you have any trouble, please feel free to contact us.

Best Regards,
%sThank You! (instructions for access)Thanks %%%%first_name%%%%!

%%%%item_name%%%%

Transaction ID: %%%%txn_id%%%%
Charges today: $%%%%amount%%%%

Your order can be retrieved here:
%%%%sp_access_url%%%%
( link expires in %%%%sp_access_exp%%%% )

If you have any trouble, please feel free to contact us.

Best Regards,

What shall I do now?

Cheers,
Lars

Posted: Wednesday May 29th, 2013 at 2:45 am #50789

What code did you use and where was that output?

Posted: Wednesday May 29th, 2013 at 8:39 am #50823

I used thas filter function:

<?php
add_filter('gettext_with_context', 'my_translator', 10, 4);
function my_translator($translated, $original, $context, $domain) {
	if ($domain === 's2member') {
		echo $original;
	       exit;
		if ($original === 'Log Me in'){
			$translated = '####';
		}elseif($original === 'My Account'){
			$translated = 'Account';
		}
	}
	return $translated;
}
Posted: Thursday May 30th, 2013 at 1:47 am #50905

I see. If you echo $original, you’ll get every s2Member domain’s string echoed, not just the one you want translated.

Posted: Friday May 31st, 2013 at 5:29 am #50993

Hi,

nope. That’s wrong.

“Log me in” isn’t there for example….there are also a lot of other strings missing in the output above.

Any other suggestions?

Posted: Friday May 31st, 2013 at 9:31 pm #51094

“Log me in” isn’t there for example….there are also a lot of other strings missing in the output above.

It’ll show the s2Member strings that are the s2Member files that the page loaded. If the string wasn’t in that page, it won’t be shown.

By the way, the string match is case sensitive and the correct string is [hilite mono]'Log Me In'[/hilite], but you have [hilite mono]'Log Me in'[/hilite]. It’s best to look for the string in the source files and once you find it, copy it and then past it in your hack to avoid any mismatches like that.

Posted: Saturday Jun 1st, 2013 at 2:01 pm #51142

Works now!

Thank You!

Posted: Sunday Jun 2nd, 2013 at 12:05 am #51153

Great! Thanks for the update. :)

Posted: Sunday Jun 2nd, 2013 at 10:04 pm #51201

Hi Cristián, what I don´t get is this:

The hack you posted above includes the way to translate a few words (account, password …) but obviously there are much more included in the pro forms. Are you saying we should look up all the strings we want to translate and then include them along the lines of “else if ($original === ‘xxxx’) $translated = ‘xxx’;

Also: is there a sure way to detect text strings within php files that show to a user?

Further, I don´t understand what to think and do with the long code that Cornelia Esther (lars) posted on monday 27th. Should I understand what it is all about?

Thanks,
Demian

Posted: Tuesday Jun 4th, 2013 at 7:21 pm #51379

Are you saying we should look up all the strings we want to translate and then include them along the lines of “else if ($original === ‘xxxx’) $translated = ‘xxx’;

Right, add an [hilite mono]else if...[/hilite] for each string you want to add a translation for.

Also: is there a sure way to detect text strings within php files that show to a user?

If you search the s2Member files for [hilite mono]_x([/hilite] you’ll find the strings that can be translated. http://codex.wordpress.org/Function_Reference/_x

Further, I don´t understand what to think and do with the long code that Cornelia Esther (lars) posted on monday 27th. Should I understand what it is all about?

That was the result of a failed test she did, you can ignore it.

Posted: Tuesday Jun 18th, 2013 at 2:22 pm #52138

Hi Christian,

me again.
What about the string sin the js files, e.g. the form validation?

I tried this:

elseif( $original	=== 'This is a required field, please try again.' )

But it does not work. i copied the words from the js file directly.
I also deleted the cache, but did not succed with that. the old strings were still there.

The output form the js files is generated here:

/wp-content/plugins/s2member/s2member-o.php?ws_plugin__s2member_js_w_globals=1&qcABC=1

Nothing changes in this file, or at least not the string, I want to change…

Thank You,
Lars

Posted: Tuesday Jun 18th, 2013 at 5:17 pm #52148

Try changing the hack file to s2member-o.php. See the article I linked to earlier, the section on s2Member-only Mode, the tab on how it impacts hacks. Knowledge Base » Hacking s2Member® Via Hooks/Filters

Posted: Tuesday Jun 18th, 2013 at 7:15 pm #52157

Okay. I created that file in the mu-plugins folder. It works, but not for the js file.

I removed the version id, to ensure, that I get a “fresh generated” file.

This is a part of my plugin code:

elseif($original === 'This is a required field, please try again.'){
			$translated = 'Das ist ein Pflichtfeld:';

This the generated js code:

nThis is a required field, please try again.'}else

I also tested in a browser, where I opened the site never before….the same result, so it can not be a cache problem.

Posted: Wednesday Jun 19th, 2013 at 5:23 am #52174

I didn’t read the part wirth “s2-o-hacks.php”. My mistake. Now I can also translate the js strings.

Thanks again!

Posted: Thursday Jun 20th, 2013 at 12:47 am #52264

Great! Glad you sorted it out. Thanks for the update. :)

Viewing 18 replies - 1 through 18 (of 18 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.