Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398919 )

Change subject: [WIP] Bidi-embed user names
......................................................................

[WIP] Bidi-embed user names

TODO: Embed all the other user names too

TODO: Need a JS implementation of embedBidi() in MW core, there isn't
one yet.

Change-Id: I286c4fce073808780ee10a2404786f93593fc9d2
---
M handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
M handlebars/compiled/flow_post.handlebars.php
M handlebars/flow_post_meta_actions.partial.handlebars
M includes/TemplateHelper.php
5 files changed, 17 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/19/398919/1

diff --git a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php 
b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
index 20cfdc8..297809d 100644
--- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
@@ -20,6 +20,7 @@
             'concat' => 'Flow\TemplateHelper::concat',
             'linkWithReturnTo' => 'Flow\TemplateHelper::linkWithReturnTo',
             'escapeContent' => 'Flow\TemplateHelper::escapeContent',
+            'bidi' => 'Flow\TemplateHelper::bidi',
 ),
         'blockhelpers' => array(),
         'hbhelpers' => array(            'eachPost' => 
'Flow\TemplateHelper::eachPost',
@@ -88,13 +89,13 @@
 '.$sp.'                           
title="'.htmlentities((string)((isset($in['actions']['thank']['title']) && 
is_array($in['actions']['thank'])) ? $in['actions']['thank']['title'] : null), 
ENT_QUOTES, 
'UTF-8').'">'.htmlentities((string)((isset($in['actions']['thank']['text']) && 
is_array($in['actions']['thank'])) ? $in['actions']['thank']['text'] : null), 
ENT_QUOTES, 'UTF-8').'</a>
 '.$sp.'' : '').'       </span>
 '.$sp.'
-'.$sp.'        <span class="flow-post-timestamp">
+'.$sp.'        <span class="flow-post-timestamp" dir="auto">
 '.$sp.''.((LCRun3::ifvar($cx, ((isset($in['isOriginalContent']) && 
is_array($in)) ? $in['isOriginalContent'] : null))) ? '                     <a 
href="'.htmlentities((string)((isset($in['links']['topic-history']['url']) && 
is_array($in['links']['topic-history'])) ? $in['links']['topic-history']['url'] 
: null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-anchor">
 '.$sp.'                                '.LCRun3::ch($cx, 'uuidTimestamp', 
array(array(((isset($in['postId']) && is_array($in)) ? $in['postId'] : 
null)),array()), 'encq').'
 '.$sp.'                        </a>
 '.$sp.'' : '                   <span>
 '.$sp.''.LCRun3::hbch($cx, 'ifCond', 
array(array(((isset($in['creator']['name']) && is_array($in['creator'])) ? 
$in['creator']['name'] : null),'===',((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
$in, false, function($cx, $in)use($sp){return '                                 
  '.LCRun3::ch($cx, 'l10n', array(array('flow-edited'),array()), 'encq').'
-'.$sp.'';}, function($cx, $in)use($sp){return '                                
        '.LCRun3::ch($cx, 'l10n', 
array(array('flow-edited-by',((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
'encq').'
+'.$sp.'';}, function($cx, $in)use($sp){return '                                
        '.LCRun3::ch($cx, 'l10n', array(array('flow-edited-by',LCRun3::ch($cx, 
'bidi', array(array(((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
'raw')),array()), 'encq').'
 '.$sp.'';}).'                  </span>
 '.$sp.'                        <a 
href="'.htmlentities((string)((isset($in['links']['diff-prev']['url']) && 
is_array($in['links']['diff-prev'])) ? $in['links']['diff-prev']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-anchor">'.LCRun3::ch($cx, 
'uuidTimestamp', array(array(((isset($in['lastEditId']) && is_array($in)) ? 
$in['lastEditId'] : null)),array()), 'encq').'</a>
 '.$sp.'').'    </span>
diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php 
b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
index 3f590d5..56d2c78 100644
--- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
@@ -20,6 +20,7 @@
             'concat' => 'Flow\TemplateHelper::concat',
             'linkWithReturnTo' => 'Flow\TemplateHelper::linkWithReturnTo',
             'escapeContent' => 'Flow\TemplateHelper::escapeContent',
+            'bidi' => 'Flow\TemplateHelper::bidi',
 ),
         'blockhelpers' => array(),
         'hbhelpers' => array(            'eachPost' => 
'Flow\TemplateHelper::eachPost',
@@ -88,13 +89,13 @@
 '.$sp.'                           
title="'.htmlentities((string)((isset($in['actions']['thank']['title']) && 
is_array($in['actions']['thank'])) ? $in['actions']['thank']['title'] : null), 
ENT_QUOTES, 
'UTF-8').'">'.htmlentities((string)((isset($in['actions']['thank']['text']) && 
is_array($in['actions']['thank'])) ? $in['actions']['thank']['text'] : null), 
ENT_QUOTES, 'UTF-8').'</a>
 '.$sp.'' : '').'       </span>
 '.$sp.'
-'.$sp.'        <span class="flow-post-timestamp">
+'.$sp.'        <span class="flow-post-timestamp" dir="auto">
 '.$sp.''.((LCRun3::ifvar($cx, ((isset($in['isOriginalContent']) && 
is_array($in)) ? $in['isOriginalContent'] : null))) ? '                     <a 
href="'.htmlentities((string)((isset($in['links']['topic-history']['url']) && 
is_array($in['links']['topic-history'])) ? $in['links']['topic-history']['url'] 
: null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-anchor">
 '.$sp.'                                '.LCRun3::ch($cx, 'uuidTimestamp', 
array(array(((isset($in['postId']) && is_array($in)) ? $in['postId'] : 
null)),array()), 'encq').'
 '.$sp.'                        </a>
 '.$sp.'' : '                   <span>
 '.$sp.''.LCRun3::hbch($cx, 'ifCond', 
array(array(((isset($in['creator']['name']) && is_array($in['creator'])) ? 
$in['creator']['name'] : null),'===',((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
$in, false, function($cx, $in)use($sp){return '                                 
  '.LCRun3::ch($cx, 'l10n', array(array('flow-edited'),array()), 'encq').'
-'.$sp.'';}, function($cx, $in)use($sp){return '                                
        '.LCRun3::ch($cx, 'l10n', 
array(array('flow-edited-by',((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
'encq').'
+'.$sp.'';}, function($cx, $in)use($sp){return '                                
        '.LCRun3::ch($cx, 'l10n', array(array('flow-edited-by',LCRun3::ch($cx, 
'bidi', array(array(((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
'raw')),array()), 'encq').'
 '.$sp.'';}).'                  </span>
 '.$sp.'                        <a 
href="'.htmlentities((string)((isset($in['links']['diff-prev']['url']) && 
is_array($in['links']['diff-prev'])) ? $in['links']['diff-prev']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-anchor">'.LCRun3::ch($cx, 
'uuidTimestamp', array(array(((isset($in['lastEditId']) && is_array($in)) ? 
$in['lastEditId'] : null)),array()), 'encq').'</a>
 '.$sp.'').'    </span>
diff --git a/handlebars/compiled/flow_post.handlebars.php 
b/handlebars/compiled/flow_post.handlebars.php
index 574db4a..91888b2 100644
--- a/handlebars/compiled/flow_post.handlebars.php
+++ b/handlebars/compiled/flow_post.handlebars.php
@@ -19,6 +19,7 @@
             'concat' => 'Flow\TemplateHelper::concat',
             'linkWithReturnTo' => 'Flow\TemplateHelper::linkWithReturnTo',
             'escapeContent' => 'Flow\TemplateHelper::escapeContent',
+            'bidi' => 'Flow\TemplateHelper::bidi',
 ),
         'blockhelpers' => array(),
         'hbhelpers' => array(            'eachPost' => 
'Flow\TemplateHelper::eachPost',
@@ -65,13 +66,13 @@
 '.$sp.'                           
title="'.htmlentities((string)((isset($in['actions']['thank']['title']) && 
is_array($in['actions']['thank'])) ? $in['actions']['thank']['title'] : null), 
ENT_QUOTES, 
'UTF-8').'">'.htmlentities((string)((isset($in['actions']['thank']['text']) && 
is_array($in['actions']['thank'])) ? $in['actions']['thank']['text'] : null), 
ENT_QUOTES, 'UTF-8').'</a>
 '.$sp.'' : '').'       </span>
 '.$sp.'
-'.$sp.'        <span class="flow-post-timestamp">
+'.$sp.'        <span class="flow-post-timestamp" dir="auto">
 '.$sp.''.((LCRun3::ifvar($cx, ((isset($in['isOriginalContent']) && 
is_array($in)) ? $in['isOriginalContent'] : null))) ? '                     <a 
href="'.htmlentities((string)((isset($in['links']['topic-history']['url']) && 
is_array($in['links']['topic-history'])) ? $in['links']['topic-history']['url'] 
: null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-anchor">
 '.$sp.'                                '.LCRun3::ch($cx, 'uuidTimestamp', 
array(array(((isset($in['postId']) && is_array($in)) ? $in['postId'] : 
null)),array()), 'encq').'
 '.$sp.'                        </a>
 '.$sp.'' : '                   <span>
 '.$sp.''.LCRun3::hbch($cx, 'ifCond', 
array(array(((isset($in['creator']['name']) && is_array($in['creator'])) ? 
$in['creator']['name'] : null),'===',((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
$in, false, function($cx, $in)use($sp){return '                                 
  '.LCRun3::ch($cx, 'l10n', array(array('flow-edited'),array()), 'encq').'
-'.$sp.'';}, function($cx, $in)use($sp){return '                                
        '.LCRun3::ch($cx, 'l10n', 
array(array('flow-edited-by',((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
'encq').'
+'.$sp.'';}, function($cx, $in)use($sp){return '                                
        '.LCRun3::ch($cx, 'l10n', array(array('flow-edited-by',LCRun3::ch($cx, 
'bidi', array(array(((isset($in['lastEditUser']['name']) && 
is_array($in['lastEditUser'])) ? $in['lastEditUser']['name'] : null)),array()), 
'raw')),array()), 'encq').'
 '.$sp.'';}).'                  </span>
 '.$sp.'                        <a 
href="'.htmlentities((string)((isset($in['links']['diff-prev']['url']) && 
is_array($in['links']['diff-prev'])) ? $in['links']['diff-prev']['url'] : 
null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-anchor">'.LCRun3::ch($cx, 
'uuidTimestamp', array(array(((isset($in['lastEditId']) && is_array($in)) ? 
$in['lastEditId'] : null)),array()), 'encq').'</a>
 '.$sp.'').'    </span>
diff --git a/handlebars/flow_post_meta_actions.partial.handlebars 
b/handlebars/flow_post_meta_actions.partial.handlebars
index 4a91016..efa6f08 100644
--- a/handlebars/flow_post_meta_actions.partial.handlebars
+++ b/handlebars/flow_post_meta_actions.partial.handlebars
@@ -42,7 +42,7 @@
                {{/if}}
        </span>
 
-       <span class="flow-post-timestamp">
+       <span class="flow-post-timestamp" dir="auto">
                {{#if isOriginalContent}}
                        <a href="{{links.topic-history.url}}" 
class="flow-timestamp-anchor">
                                {{uuidTimestamp postId}}
@@ -52,7 +52,7 @@
                                {{#ifCond creator.name "===" lastEditUser.name}}
                                        {{l10n "flow-edited"}}
                                {{else}}
-                                       {{l10n "flow-edited-by" 
lastEditUser.name}}
+                                       {{l10n "flow-edited-by" (bidi 
lastEditUser.name)}}
                                {{/ifCond}}
                        </span>
                        <a href="{{links.diff-prev.url}}" 
class="flow-timestamp-anchor">
diff --git a/includes/TemplateHelper.php b/includes/TemplateHelper.php
index 069c7bd..7187f8c 100644
--- a/includes/TemplateHelper.php
+++ b/includes/TemplateHelper.php
@@ -152,6 +152,7 @@
                                        'escapeContent' => 
'Flow\TemplateHelper::escapeContent',
                                        'enablePatrollingLink' => 
'Flow\TemplateHelper::enablePatrollingLink',
                                        'oouify' => 
'Flow\TemplateHelper::oouify',
+                                       'bidi' => 'Flow\TemplateHelper::bidi',
                                ],
                                'hbhelpers' => [
                                        'eachPost' => 
'Flow\TemplateHelper::eachPost',
@@ -556,6 +557,11 @@
                return self::html( wfMessage( $str, $args )->parse() );
        }
 
+       public static function bidi( array $args, array $named ) {
+               $str = array_shift( $args );
+               return RequestContext::getMain()->getLanguage()->embedBidi( 
$str );
+       }
+
        /**
         * @param array $args Expects 1 argument:
         *         array $data RevisionDiffViewFormatter::formatApi return value

-- 
To view, visit https://gerrit.wikimedia.org/r/398919
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I286c4fce073808780ee10a2404786f93593fc9d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to