mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:45:16 +02:00
Merge branch 'translateitems' of https://github.com/fabrixxm/friendika into fabrixxm-translateitems
This commit is contained in:
commit
b84f49df10
6 changed files with 114 additions and 2 deletions
|
@ -1,5 +1,50 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Render actions localized
|
||||
*/
|
||||
function localize_item(&$item){
|
||||
|
||||
if ($item['verb']=="http://activitystrea.ms/schema/1.0/like" ||
|
||||
$item['verb']=="http://activitystrea.ms/schema/1.0/dislike"){
|
||||
|
||||
$r = q("SELECT * from `item`,`contact` WHERE
|
||||
`item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
|
||||
dbesc($item['parent-uri']));
|
||||
if(count($r)==0) return;
|
||||
$obj=$r[0];
|
||||
|
||||
$author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||
$objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
|
||||
|
||||
$post_type = (($obj['resource-id']) ? t('photo') : t('status'));
|
||||
$plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
|
||||
|
||||
switch($item['verb']){
|
||||
case "http://activitystrea.ms/schema/1.0/like":
|
||||
$bodyverb = t('%1$s likes %2$s\'s %3$s');
|
||||
break;
|
||||
case "http://activitystrea.ms/schema/1.0/dislike":
|
||||
$bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
|
||||
break;
|
||||
}
|
||||
$item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
|
||||
|
||||
}
|
||||
if ($item['verb']=='http://activitystrea.ms/schema/1.0/make-friend'){
|
||||
|
||||
$b = str_replace("[/url]","[/url]\n", $item['body']);
|
||||
preg_match_all("|(\[url.*\[/url\])|", $b, $match);
|
||||
|
||||
$item['body'] = $match[0][0]." "
|
||||
.t('is now friends with')
|
||||
." ".$match[0][1]."\n\n\n"
|
||||
.$match[0][2];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* "Render" a conversation or list of items for HTML display.
|
||||
* There are two major forms of display:
|
||||
|
@ -10,7 +55,6 @@
|
|||
* that are based on unique features of the calling module.
|
||||
*
|
||||
*/
|
||||
|
||||
function conversation(&$a, $items, $mode, $update) {
|
||||
|
||||
require_once('bbcode.php');
|
||||
|
@ -118,7 +162,8 @@ function conversation(&$a, $items, $mode, $update) {
|
|||
|
||||
$drop = replace_macros((($dropping)? $droptpl : $fakedrop), array('$id' => $item['id'], '$delete' => t('Delete')));
|
||||
|
||||
|
||||
//
|
||||
localize_item($item);
|
||||
|
||||
$drop = replace_macros($droptpl,array('$id' => $item['id']));
|
||||
$lock = '<div class="wall-item-lock"></div>';
|
||||
|
@ -384,6 +429,9 @@ function conversation(&$a, $items, $mode, $update) {
|
|||
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
|
||||
$indent .= ' shiny';
|
||||
|
||||
//
|
||||
localize_item($item);
|
||||
|
||||
// Build the HTML
|
||||
|
||||
$tmp_item = replace_macros($template,array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue