Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 4 years ago

Last modified 4 years ago

#7076 closed defect (bug) (fixed)

I18n: make XProfile admin js text nodes translatable

Reported by: offereins's profile Offereins Owned by: slaffik's profile slaFFik
Milestone: 8.0.0 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch commit
Cc: lmoffereins@…

Description

In bp-xprofile/admin/js/admin.js the add_option function creates text nodes with untranslated strings:

txt1         = document.createTextNode( 'Default Value' ),
toDeleteText = document.createTextNode( 'Delete' ),

Is there any reason why these are not translatable? Can we use wp_localize_script() here?

Attachments (1)

7076.patch (1.7 KB) - added by slaFFik 4 years ago.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
9 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Yes. It hasn't been done probably because we haven't noticed because this file is written with a distinct JS style that wasn't replicated anywhere else in BuddyPress (this was written probably six years ago).

The file is isolated enough to be re-written with better JS standards and we can absolutely make the string translatable then.

#2 @DJPaul
8 years ago

  • Component changed from Locale - i18n to I18N

#3 @Offereins
8 years ago

#7413 was marked as duplicate.

@slaFFik
4 years ago

#4 @slaFFik
4 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Contributions to 7.1.0
  • Owner set to slaFFik
  • Status changed from new to assigned

#5 @imath
4 years ago

  • Keywords commit added
  • Milestone changed from 7.1.0 to 8.0.0

Hi @slaFFik

Patch looks good. Thanks for your work on it. I'd just suggest to align the array items according to WPCS, this way:

'default_value' => __( 'Default Value', 'buddypress' ),
'delete'        => __( 'Delete', 'buddypress' ),

We'll include this fix into 8.0.0 as it's not a regression from 7.0.0. Feel free to commit it in trunk 👍

#6 @slaFFik
4 years ago

I haven't aligned this array because other items in this same array are not aligned, I've just preserved the code style that's already in the file.
I will update the patch (will apply same formating for the whole array) and will push it to the trunk.
Thanks.

Last edited 4 years ago by slaFFik (previous) (diff)

#7 @slaffik
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 12828:

XProfile: make admin js text nodes translatable

Certain user-facing strings added in the XProfile admin area using JavaScript were not translatable. We moved them to PHP and injected in JS using wp_localize_scripts().

Fixes #7076 (trunk).

#8 @slaffik
4 years ago

In 12829:

XProfile: make admin js text nodes translatable

Fix JS issues reported by the jshint, convert to camel case.

See #7076 (trunk).

Note: See TracTickets for help on using tickets.