Skip to:
Content

BuddyPress.org

Opened 9 months ago

Closed 9 months ago

#9074 closed defect (bug) (fixed)

Attributes in block.json files are not translated

Reported by: imath's profile imath Owned by: slaffik's profile slaFFik
Milestone: 12.3.0 Priority: normal
Severity: normal Version: 12.0.0
Component: I18N Keywords: has-patch
Cc:

Description

Here's the list of blocks to check:

  • Latests activities (title attribute)
  • Recent Networkwide Posts (title attribute)
  • Dynamic Groups List (title attribute)
  • Recently Active Members (title attribute)
  • Dynamic Members List (title attribute)
  • Online Members (title attribute)

Change History (6)

This ticket was mentioned in PR #223 on buddypress/buddypress by @imath.


9 months ago
#1

  • Keywords has-patch added; needs-patch removed

1) Fix the Latest Activities block:

  • Avoid a React Error removing the code used to set the postId attribute. We now use specific attributes for the ServerSideRender component.
  • Fix a regressions introduced by r13537 that was preventing the usage of the activity/widget template when BP Nouveau is the active template pack.
  • Fix a misusage of wp_list_pluck() preventing activity types to be fetched for the block.

2) For BP Blocks using a title attributes, make sure the default one can be translated.

  • Latest Activities block,
  • Recent Networkwide Posts
  • Dynamic Groups List
  • Recently Active Members
  • Dynamic Members List
  • Online Members

Trac ticket: https://buddypress.trac.wordpress.org/ticket/9074

dcavins commented on PR #223:


9 months ago
#2

Wow, the way this works is very counterintuitive.

@imath commented on PR #223:


9 months ago
#3

The main problem was with the Latest Activities block, something that used to work previously (setting the postId attribute once the block is added to a post) is now generating an error preventing the Activity Types select box to appear etc.. So I had to use a workaround 😓 .

I noticed it while working on a way to have the default Blocks title translated. Using Block attributes in the block.json file was a wrong idea. Title, description are translated but not attributes.

#4 @imath
9 months ago

  • Milestone changed from 12.2.0 to 12.3.0

#5 @imath
9 months ago

In 13716:

BP Blocks: make sure default block titles can be translated

Some of the BP Blocks are using a title attribute into their block.json. Unfortunately, block attributes do not seem to be include in the translatable strings of the WP Block Metadata API.

To fix this, all block.json title attributes now default to an empty string & the default title value is handled within the PHP callback to render the block.

For the specific case of the Latest Activities block, this commit also fixes some errors that were preventing it to be able to select the list of Activity types to include into the rendered activities.

See #9074 (trunk)
Closes https://github.com/buddypress/buddypress/pull/223

#6 @imath
9 months ago

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

In 13717:

BP Blocks: make sure default block titles can be translated

Some of the BP Blocks are using a title attribute into their block.json. Unfortunately, block attributes do not seem to be include in the translatable strings of the WP Block Metadata API.

To fix this, all block.json title attributes now default to an empty string & the default title value is handled within the PHP callback to render the block.

For the specific case of the Latest Activities block, this commit also fixes some errors that were preventing it to be able to select the list of Activity types to include into the rendered activities.

Fixes #9074 (branch 12.0)

Note: See TracTickets for help on using tickets.