Page 1 of 1

Translation feature

PostPosted: April 2nd, 2011, 2:41 pm
by JrRRr76
Do s2member-plugin have or plan to have a simpler method of translating the plugin to other languages, so it follows the same language as the WordPress-site its installed on? (thinking about .po and .ro and that stuff - just found out about that a couple of days ago)

I've tried searching the forums and the directories for the plugin on my installation, but found no language file/directory. I would very much like to have all the fields in the same language as the rest of my site, makes it look more professional you know.. ;)

Installed the plugin a couple of weeks back, and I think it will do what I want extremely well (once I get all the configuration done) It has Paypal and MailChimp integration as to big sellpoints.

Now if only we could get a proper language management I would be thrilled.

Keep it up. As you know "Code is poetry"

Re: Translation feature

PostPosted: April 2nd, 2011, 3:24 pm
by Cristián Lávaque
Yeah, languages will be coming in the future. Not sure when, though.

In the meantime, at least for the front end, you can translate strings in source files directly. With a text editor that support searching inside multiple files, you could look for those strings to find the right file.

Which do you need to translate?

Re: Translation feature

PostPosted: April 3rd, 2011, 1:43 am
by JrRRr76
Hi Christián! Thanks for your reply. Basically all text input fields. Like Firstname/Lastname etc. I havn't set it all up yet, so I guess I could translate some of the source, but I guess my translation will be lost whenever there's an update.. ..so I don't know how much time and effort I want to put in to this though..

I want to translate in to Norwegian btw..

Re: Translation feature

PostPosted: April 3rd, 2011, 8:12 pm
by Cristián Lávaque
OK. Why don't you first translate your WordPress installation and see if that takes care of part of the registration and login forms. Then see what's missing and edit the s2Member files that have that.

This thread may help viewtopic.php?f=4&t=925

Yeah, with updates of the plugin those changes will be lost and need to be reapplied. I'll see if hooks could be used in the meantime.

Re: Translation feature

PostPosted: April 3rd, 2011, 8:23 pm
by Cristián Lávaque
Yeah, it looks like you may be able to use filters to translate the strings and have them in a separate file so they're not lost with the next update of the plugin. :)

For example, the file /s2member/includes/classes/translations.inc.php has some of the strings you may want to translate. Search for the string apply_filters and you'll find the places where you can do something with a filter.

Re: Translation feature

PostPosted: May 20th, 2011, 5:47 am
by stefanogaruti
I can confirm that it's possible to translate some fields in the "login" screen by hooking in this way:
Code: Select all
add_filter('ws_plugin__s2member_translation_mangler','ubi_s2member_translation',10,2);
function ubi_s2member_translation($text,$variables){
   if ($text == 'Email Address *') $text = 'Indirizzo Email *';
   return $text;
}


Unfortunately the fields inthe registration screen: First Name and Second Name are not filtered, they are just echoed from the file "custom-reg-fields.inc.php". :(

I understand that translating the whole s2meber would be an huge effort, but please axtend the hooking system to the registration screen too, it's a metter of few line of code but for us non English-speaker would be an huge advantage!

Thanks a lot
Stefano

Re: Translation feature

PostPosted: May 20th, 2011, 12:15 pm
by Cristián Lávaque
Yes, Stefano, I can understand you perfectly. It's not coming out yet, but I can confirm that this is in the to-do.

Re: Translation feature

PostPosted: May 23rd, 2011, 4:22 am
by Jason Caldwell
Just wanted you to know that I saw this thread.
I agree. We'll take care of basic translations in the very next release.
We need to do it right though, we'll be wrapping vital parts of s2Member copy in __("").

Re: Translation feature

PostPosted: June 26th, 2011, 7:38 pm
by Demiano
Hi, I am also very interested in the translation features whether it will be a .po file or __("") and _e functions.
Can you tell me when I can expect the next release?

Thanks,
Demian

Translating text string on registration page

PostPosted: July 27th, 2011, 2:45 pm
by Demiano
Hey,

I couldt translate most of the strings I needed to be in German, but one I sill can not find. It is on the registration page. I think it has to do with the integration with MailChimp. It is the text showing up at the side of a checkbox. It says: Yes, I want to receive updates via mail.

Can you please tell me in which file I can find this test string?

Thanks, Demian

Re: Translating text string on registration page

PostPosted: August 2nd, 2011, 8:05 pm
by Jason Caldwell
Thanks for the excellent question:
Demiano wrote:Hey,

I couldt translate most of the strings I needed to be in German, but one I sill can not find. It is on the registration page. I think it has to do with the integration with MailChimp. It is the text showing up at the side of a checkbox. It says: Yes, I want to receive updates via mail.

Can you please tell me in which file I can find this test string?

Thanks, Demian

This text is editable inside your Dashboard, under:
s2Member -> API List Servers -> Opt-In Box.

Re: Translation feature

PostPosted: September 20th, 2011, 6:06 pm
by Cristián Lávaque
I just wanted to update you about this, s2Member now supports translations.

* (s2Member/s2Member Pro) Translation Support. s2Member and s2Member Pro are now equipped with support for front-end translation, using standardized WordPress® methodologies; i.e. we've implemented the use of _x(), and various other translation routines for many aspects of s2Member's front-end interfaces. For instance, things like Profile panels, Login/Registration Fields, and Pro Form integrations; as well as error messages displayed to Users/Members. Translation support for back-end admin panels provided by s2Member will come in a future release, along with more extensive translation support for front-end aspects.

Please note, this is but our first step toward internationalizing s2Member and s2Member Pro. Look for further updates/improvements to come in the future.

Like WordPress® itself, we chose to use the GNU gettext localization framework to provide localization infrastructure for s2Member®. GNU gettext is a mature, widely used framework for modular translation of software, and is the de facto standard for localization in the open source/free software realm. If you'd like to translate s2Member and/or s2Member Pro, please use the POT file found inside /s2member/includes/translations/s2member.pot, which contains all translation entries for both the s2Member Framework ( i.e. the free version ), and also for s2Member Pro.

The file: /s2member/includes/translations/s2member.pot will be updated with each new release of s2Member. If this is your first translation of a WordPress® plugin, this article and/or this article, might be of some assistance. When you are finished translating the s2member.pot file, place your completed s2member-[locale].mo file into this directory: /s2member/includes/translations/; and please feel free to share your translation with the rest of the s2Member® community.

Quick Tip: If you only need to translate the front-end of s2Member, please ignore entries in the s2member.pot file with a context matching s2member-admin. Those sections of s2Member are only seen by site Administrators; they are NOT used in s2Member's front-end integration with WordPress®. Skipping over translation entries with a context matching s2member-admin can save you time.


:)

Re: Translation feature

PostPosted: October 26th, 2011, 8:29 am
by freshman66
Hi all,
I did search, but unfortunately didn't find the answer: how can I translate labels for custom profile fields? I see that the pot file is not automatically updated with these strings, so I assume there must be another way...

Any hints on this?

Thanks a lot,
Freshman

Re: Translation feature

PostPosted: October 26th, 2011, 11:46 am
by Jason Caldwell
Hi there. Labels for Custom Registration/Profile Fields configured with s2Member are currently handled via the WordPress Dashboard. When you create a Custom Registration/Profile Field, you can type in the label yourself, giving you the ability to use any language you prefer.


If your site provides multiple translations, the only way to accomplish multiple language translations with Custom Registration/Profile Fields at this time, is through a hack file for s2Member.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
( and you might do something like this )
Code: Select all
<?php
add_action 
("ws_plugin__s2member_after_loaded", "my_s2_custom_field_translations");
function my_s2_custom_field_translations ()
    {
        foreach (($fields = json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true)) as &$field)
            {
                if ($field["id"] === "my_unique_field_id")
                    $field["label"] = "My Unique Field Label ( translated )";
                /**/
                else if ($field["id"] === "my_other_unique_field_id")
                    $field["label"] = "My Other Unique Field Label ( translated )";
            }
        $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"] = json_encode ($fields);
    }
?>

Re: Translation feature

PostPosted: October 26th, 2011, 11:57 am
by freshman66
Hi Jason, thanks for the quick reply. Indeed I do need to provide labels in different languages - the hack will do the job nicely.
Cheers, Freshman

Re: Translation feature

PostPosted: November 15th, 2011, 9:48 pm
by angiegzz
I translated the s2member plugin... started from the POT from s2Member v111029. Generated the mo file. Uploaded it per the instructions.

Now, I have upgraded to Pro v111105. And the mo file is gone! I would imagine it would fallback to english but it doesn. Now I need to make slight adjustments to my translations. Any thoughts?

Re: Translation feature

PostPosted: November 17th, 2011, 12:50 am
by Jason Caldwell
Thanks for your inquiry.

When you update a WordPress plugin, WordPress will first delete the entire plugin directory as it existed previously, along with your MO file, and then it will install a fresh copy of the latest version in it's place. So this explains how you've lost the MO file that you had inside the /s2member/includes/translations directory. WordPress deleted this when you upgraded.

We realized this shortly after we released support for translations, and we updated the latest versions of s2Member, along with updating the instructions too. We now ask that you please put your MO file into the /wp-content/plugins directory instead. This way you won't lose existing translations after an upgrade of s2Member. For instance, you might have this file:
/wp-content/plugins/s2member-fr_FR.mo

If you didn't create a backup before upgrading, you may have lost your previous work. You might check with your hosting company and see if they have a snapshot ( i.e. automated backup ) they can provide.

Re: Translation feature

PostPosted: November 18th, 2011, 1:11 am
by Cristián Lávaque
Zipped up copies of your translations attached to this thread would be another form of backup and it'd help other users too. :)

Re: Translation feature

PostPosted: December 20th, 2011, 11:11 am
by angiegzz
Thank you all for your reply, this helped me resolve my issue.

I have done a limited front-end translation (for my use case), and it's messy: I only translated the front-end features I used.

Let me work on doing this nicely and I'll upload it.

Thanks!

Re: Translation feature

PostPosted: December 20th, 2011, 4:23 pm
by Cristián Lávaque
Great! Thanks. :)

Re: Translation feature

PostPosted: December 22nd, 2011, 10:18 am
by aschneider
Hi. Translations are not working in my case. It seems that "s2member-de_DE.mo" is not found in /wp-content/plugins/.

Do I need to change something else? All other localization stuff is working. BTW the plugin "CodeStyling Localization" does not recognize the language file for s2member as well.

Re: Translation feature

PostPosted: December 23rd, 2011, 5:40 am
by Cristián Lávaque
s2Member doesn't come with the translations yet, it does allow you to create them, though. Did you translate to German and put that file in the directory?

Here's some info: /wp-content/plugins/s2member/includes/translations/

== Translations ==

s2Member and s2Member Pro are now equipped with support for front-end translation, using standardized WordPress® methodologies; i.e. we've implemented the use of `_x()`, and various other translation routines for many aspects of s2Member's front-end interfaces. For instance, things like Profile panels, Login/Registration Fields, and Pro Form integrations; as well as error messages displayed to Users/Members. Translation support for back-end admin panels provided by s2Member will come in a future release, along with more extensive translation support for front-end aspects.

Please note, this is but our first step toward internationalizing s2Member and s2Member Pro. Look for further updates/improvements to come in the future.

Like WordPress® itself, we chose to use the GNU `gettext` localization framework to provide localization infrastructure for s2Member®. GNU `gettext` is a mature, widely used framework for modular translation of software, and is the *de facto* standard for localization in the open source/free software realm. If you'd like to translate s2Member and/or s2Member Pro, please use the POT file found inside `/s2member/includes/translations/s2member.pot`, which contains all translation entries for both the s2Member Framework *( i.e. the free version )*, and also for s2Member Pro.

The file: `/s2member/includes/translations/s2member.pot` will be updated with each new release of s2Member.

If this is your first translation of a WordPress® plugin, [this article](http://codex.wordpress.org/Translating_ ... Technology) and/or [this article](http://urbangiraffe.com/articles/transl ... d-plugins/), might be of some assistance. When you are finished translating the `s2member.pot` file, place your completed `s2member-[locale].mo` file into this directory: `/wp-content/plugins/`; and please feel free to [share your translation](viewforum.php?f=4) with the rest of the s2Member® community.

Quick Tip: If you only need to translate the front-end of s2Member, please ignore entries in the `s2member.pot` file with a context matching `s2member-admin`. Those sections of s2Member are only seen by site Administrators; they are NOT used in s2Member's front-end integration with WordPress®. Skipping over translation entries with a context matching `s2member-admin` can save you time.

Re: Translation feature

PostPosted: December 23rd, 2011, 7:06 am
by aschneider
Thanks for the feedback.

I am sorry, I have put the file in the correct directory but in a wrong path for another domain. Now that I have doeble-checked again it works like a charm. Sorry for the confusion!

Re: Translation feature

PostPosted: December 23rd, 2011, 2:37 pm
by Raam Dev
No worries! Thank you for reporting back. Glad to you fixed it! :)