[buddypress-trac] [BuddyPress] #3856: Saving activity update action as an array in db

buddypress-trac noreply at wordpress.org
Mon Oct 21 10:20:01 UTC 2013


#3856: Saving activity update action as an array in db
-------------------------+------------------
 Reporter:  modemlooper  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  2.0
Component:  Activity     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------

Comment (by terraling):

 I'm currently building a multi-lingual site and am discovering the
 problems which arise from constructing the activity string at the moment
 an activity is recorded rather than when it is retrieved for display.

 So if John is using the site in English and Juan is using it in Spanish,
 when John looks at the activity stream he sees:

 John posted an update 3 hours ago
 Juan ha publicado una actualización 4 hours ago
 John changed their profile picture 5 hours ago

 i.e. Juan "posted an update" is in Spanish because he was using the site
 in Spanish at the time, rather than the English that John is currently
 viewing the site in.

 My hack requires removing the translations for "posted an update" etc. in
 the .mo files so that activity is always recorded in the database in
 English, and then using the bp_get_activity_action_pre_meta filter to
 str_replace "posted an update" etc. with the translation as required.

 In terms of how you might make minimal changes to how this currently
 works, unless I'm mistaken there is one-to-one relationship between the
 activity "type" and the text appended in the activity "action".

 E.g.
 new_member -> ' became a registered member'
 activity_update -> ' posted an update'
 new_avatar -> ' changed their profile picture'
 etc.

 So for performance reasons you could continue to build the action at the
 moment the activity is recorded, but leave off the text, and append that
 text (wrapped in a get_text call) based upon the activity type when the
 activity is retrieved for display.

 That would certainly make things considerably easier in terms of
 multilingual handling, not sure what other use cases apply.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3856#comment:9>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list