Translation bug corrected with 3.0.5.1
-
The WP-Members 3.0.5 release included a logic fix for loading the plugin’s translation file. Unfortunately, this created a bug that caused no translation file to load.
Fix:
WP-Members 3.0.5.1 was released to fix this problem, so if you updated to version 3.0.5 and run WordPress in a localized language, please update to 3.0.5.1.
The rest of this post is just a description of where the bug was introduced and what was done to correct it.
Background:
WP-Members is to be loaded into the www.remarpro.com translation project this week. In preparation for that and being able to load language packs from www.remarpro.com to the /wp-content/languages/ directory, the logic for loading the localization files was being reviewed for the 3.0.5 release.
All of this is part of the function
wpmem_load_textdomain()
located at the end of the wp-members.php file.In evaluating the function, I noticed a logic error where the plugin checks to see if the language pack is available and if not, load from the plugin’s /lang/ directory.
The comparison test was as follows:
( $loaded = load_textdomain( $domain, $file ) )
This would not evaluate as the comparison operator should have been “==” (is equal to) and not “=”.
In adding that change, which fixed the comparison test, I had also defined
$loaded
because now that the comparison was fixed, if$loaded
was undefined, that would return an undefined notice. So this was added to define$loaded
:$loaded = false;
That fixed the undefined error, but the problem is that it should have been defined as true. Otherwise, the fixed comparison logic would always evaluate to return the language pack from the WP directory (which does not yet exist for most users) instead of the plugin’s /lang/ directory (which most users are using).
Details of the fix:
3.0.5.1 corrects that problem. It initially defines
$loaded
as true. It also corrects the directory for the WP language pack to /wp-content/languages/plugins/wp-members/ so that as language packs become available, you’ll be able to load those instead of the ones currently packaged with the plugin.
- The topic ‘Translation bug corrected with 3.0.5.1’ is closed to new replies.