Arlolra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/280792

Change subject: T53852: Serialize localized image options for rtl languages
......................................................................

T53852: Serialize localized image options for rtl languages

 * At least this much is agreed on.
   https://lists.wikimedia.org/pipermail/wikitech-l/2016-March/085146.html

Change-Id: Iefc0f9fbb55a9c5ca10246871d027e569ea86167
---
M lib/html2wt/LinkHandler.js
M tests/parserTests.txt
2 files changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/92/280792/1

diff --git a/lib/html2wt/LinkHandler.js b/lib/html2wt/LinkHandler.js
index e9e027b..cca33bd 100644
--- a/lib/html2wt/LinkHandler.js
+++ b/lib/html2wt/LinkHandler.js
@@ -1045,8 +1045,7 @@
                        });
                        if (idx < 0) {
                                // New option, default to English localization 
for most languages
-                               // TODO: use first alias (localized) instead 
for RTL languages (T53852)
-                               no.ak = lastItem(no.ak);
+                               no.ak = state.env.conf.wiki.rtl ? no.ak[0] : 
lastItem(no.ak);
                                changed = true;
                                return; /* new option */
                        }
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 400cb76..7ee809a 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -13844,6 +13844,17 @@
 !! end
 
 !! test
+Localized image handling (3).
+!! options
+language=fa
+parsoid=html2wt
+!! html/parsoid
+<figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" 
data-file-width="1941" data-file-height="220" data-file-type="bitmap" 
height="25" width="220"/></a></figure>
+!! wikitext
+[[File:Foobar.jpg|بندانگشتی]]
+!! end
+
+!! test
 "border", "frameless" and "class" attributes on an image.
 !! options
 thumbsize=220

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefc0f9fbb55a9c5ca10246871d027e569ea86167
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

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

Reply via email to