Translating s2Member & s2Member Pro
Table of Contents
s2Member and s2Member Pro are equipped with support for front-end translation, using WordPress standards; 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: 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.
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. See also: WordPress In Your Langauge
Building a Translation
If you'd like to translate s2Member and/or s2Member Pro, please use the POT file found inside
/s2member/src/includes/translations/s2member.pot, which contains all translation entries for both the s2Member Framework (i.e., the free version), and also for s2Member Pro.
Quick Tip: If this is your first translation of a WordPress plugin, this article might be of some assistance.
Quick Tip: If you don't use the POT file that comes with s2Member, and instead, you decide to use something like Codestyling Localization to generate your own, please make sure that you configure the scanner to search both the
/s2member-pro directories. Since the
/s2member-pro add-on is not an official plugin (it's actually an add-on), this might require a symlink, or that you contact the team behind the software you're running for some assistance in this matter.
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 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.
.mo Translation File
Let's assume that your locale is:
- You should create:
- Now all you need to do is change the language in the admin settings screen. See Dashboard → Settings → General → Site Language
See also: Additional considerations
Existing Translations (Updating Your
FUZZY translation entries: If you're updating an existing
.po file (e.g., recompiling your
.mo file after changes in a new release of s2Member) please be sure to manually review any "fuzzy" entries. A fuzzy entry can occur as a result of changes from one release of s2Member to the next. Small changes in text might render your translation invalid (i.e., fuzzy).
Depending on your
.po file editor, fuzzy entries may need to be reviewed and changes committed before you recompile; otherwise fuzzy entries will revert to their default state in your final
.mo file. Translations that are fuzzy, are not compiled into your final
.mo file. This can lead to much confusion. Please review any fuzzy entries carefully.