Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 12 months ago

Last modified 12 months ago

#7076 closed defect (bug) (fixed)

I18n: make XProfile admin js text nodes translatable

Reported by: Offereins Owned by: 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 12 months ago.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
6 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
5 years ago

  • Component changed from Locale - i18n to I18N

#3 @Offereins
5 years ago

#7413 was marked as duplicate.

@slaFFik
12 months ago

#4 @slaFFik
12 months 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
12 months 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
12 months 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 and will push to the trunk.
Thanks.

Version 0, edited 12 months ago by slaFFik (next)

#7 @slaffik
12 months 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
12 months 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.