Skip to:
Content

bbPress.org

Opened 10 years ago

Closed 10 years ago

#1775 closed defect (bug) (fixed)

Loading of translation files from WP_LANG_DIR plus general improvement

Reported by: daveshine Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: API - Actions/Filters Keywords: reporter-feedback
Cc: georgemamadashvili@…

Description

Since the current implementation of update-secure/custom translation files placed in wp-content/languages/ dir (aka WP_LANG_DIR) DOES NOT work in 2.0.x and 2.1+ branches I found out another solution which seems also a bit more elegant and lightweight.

This could replace current code within "public function load_textdomain()" (arount line 547 in bbpress.php, v2.1 trunk):

load_textdomain( 'bbpress', WP_LANG_DIR . '/bbpress/bbpress-' . get_locale() . '.mo' );
load_plugin_textdomain( 'bbpress', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

What the above solution does:
First look in WP_LANG_DIR (wp-content/languages) and after that looking in bbPress lang folder. If there are translation files in both folders WP will combine them on loading - which is a good behavior IMHO.

The first line of the code uses "load_textdomain" because WP_LANG_DIR cannot work with relative path as "load_plugin_textdomain" requires.

That way we could have a proper implementation that finally leads to the display of custom and update-secure language files and at the same uses best practices and recognizes also a possible moving of WP languages folder...

Change History (9)

#1 @johnjamesjacoby
10 years ago

  • Keywords reporter-feedback added

I'm not sure what 'update-secure' is, and I'd like to avoid loading two sets of translation files on top of each other.

Can you explain a bit more what the problem is?

Version 0, edited 10 years ago by johnjamesjacoby (next)

#2 follow-up: @daveshine
10 years ago

The actual problem is that translation files in wp-content/languages/bbpress/ don't get displayed - regarding 2.0.x and 2.1 branch.

If ever language packs get released with the plugin bbpress/bbp-languages/ they'll get overridden on plugin updates...

My above solution works and users can have custom language files not affected from plugin updates.

#3 @daveshine
10 years ago

Also, pulling translations in via GlotPress for me is the greatest "rubbish" to think of as these "community translations" are incorrect, not complete and formal/informal wording is mixed up. So especially for German language these so-called "language packs" (via GlotPress) would make things worse and bring no improvement - I want my proper lang files - maintained and improved over long time - not overridden on plugin updates. This is also important for my clients. A solution for custom files not affected by updates is "a must" for such big plugins like "bbPress" (and add BuddyPress etc.). Also the issue with formal/informal versions should be addressed in a perfect world...

#4 in reply to: ↑ 2 @johnjamesjacoby
10 years ago

Replying to daveshine:

The actual problem is that translation files in wp-content/languages/bbpress/ don't get displayed - regarding 2.0.x and 2.1 branch.

I am 100% confident that it works. I have seen dozens of non-English installs. Possible maybe you're doing something incorrectly?

#5 @johnjamesjacoby
10 years ago

Any news on this?

#6 @johnjamesjacoby
10 years ago

  • Milestone changed from Awaiting Review to Future Release

Punting to future release, pending more information.

#7 @Mamaduka
10 years ago

  • Cc georgemamadashvili@… added

#8 follow-up: @daveshine
10 years ago

(Sorry for the delay, was offline for nearly a week and knee-deep in client stuff...)

I just made more tests on my various installs and it seems to work at least since 2.1-r3773 up to 2.1-r3822.
wp-content/languages/bbpress/bbpress-de_DE.mo
and also:
wp-content/plugins/bbpress/bbp-languages/bbpress-de_DE.mo

You can close or remove this ticket now. I will open other tickets for other localization issues with Widgets etc. now to not mix things up here.

I am sorry for not testing enough and posting to early here I just thought it was the best place for that. Really don't know why id didn't work on 2.0.x branch for me - I have only default installs. Ok, since I only use 2.1 branch on all my sites for a few weeks I don't care for 2.0.x anymore :)

#9 in reply to: ↑ 8 @johnjamesjacoby
10 years ago

  • Milestone Future Release deleted
  • Resolution set to fixed
  • Status changed from new to closed

Replying to daveshine:

(Sorry for the delay, was offline for nearly a week and knee-deep in client stuff...)

I just made more tests on my various installs and it seems to work at least since 2.1-r3773 up to 2.1-r3822.
wp-content/languages/bbpress/bbpress-de_DE.mo
and also:
wp-content/plugins/bbpress/bbp-languages/bbpress-de_DE.mo

You can close or remove this ticket now. I will open other tickets for other localization issues with Widgets etc. now to not mix things up here.

I am sorry for not testing enough and posting to early here I just thought it was the best place for that. Really don't know why id didn't work on 2.0.x branch for me - I have only default installs. Ok, since I only use 2.1 branch on all my sites for a few weeks I don't care for 2.0.x anymore :)

No worries. Thanks for keeping an eye on this stuff. Your efforts are greatly appreciated.

Note: See TracTickets for help on using tickets.