Making WordPress.org

Opened 8 years ago

Closed 8 years ago

#2415 closed defect (bug) (fixed)

API doesn't return translated plugin infomation

Reported by: ocean90's profile ocean90 Owned by: dd32's profile dd32
Milestone: Plugin Directory v3.0 Priority: high
Component: Plugin Directory Keywords:
Cc:

Description

The new code for the api.w.org endpoint returns only results in English because the translation filters are not registered. Plugins_Info_API::load_wordpress() sets $_SERVER['HTTP_HOST'] to wordpress.org which means get_locale() returns en_US.

I think we should set $_SERVER['HTTP_HOST'] to the site of the requested locale.

Change History (5)

#1 @ocean90
8 years ago

  • Owner set to dd32
  • Status changed from new to reviewing

#2 @dd32
8 years ago

  • Keywords needs-patch removed
  • Milestone set to Plugin Directory v3.0
  • Priority changed from normal to high
  • Status changed from reviewing to accepted

#3 @dd32
8 years ago

I think we should set $_SERVER['HTTP_HOST'] to the site of the requested locale.

I think I'd rather add a locale filter (which was the original intention), or define the locale for the request instead of changing the HTTP_HOST.

The filters should also be registered all the time (I guess) bailing early when en_US.

#4 @dd32
8 years ago

I think I'd rather add a locale filter (which was the original intention), or define the locale for the request instead

Which we can now do just by calling switch_to_locale() instead of fancy filters :)

#5 @dd32
8 years ago

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

In 4764:

Plugin Directory: Use translated data for the api.wordpress.org info endpoint.

  • Also translates screenshot titles on the front end
  • Also uses plugin tags in API info endpoint rather than defunct categories.

See #2112
Fixes #2415

Note: See TracTickets for help on using tickets.