jenkins-bot has submitted this change and it was merged.

Change subject: Fix RTL display of some elements
......................................................................


Fix RTL display of some elements

* Don't force ltr on the main module help text and on
  the parameters documentation - they can now be translated.
* Force ltr on the module title (<h6>) - it is always English.
  Also add a CSS rule that makes its alignment correct in ltr and rtl.
* Document areas where ltr still has to be forced - URL and result.

Bug: T88672
Change-Id: I928a7478b7ca95695eca2e27dad5e277e7359c8e
---
M SpecialApiSandbox.php
M resources/UiBuilder.js
M resources/styles.css
3 files changed, 15 insertions(+), 3 deletions(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SpecialApiSandbox.php b/SpecialApiSandbox.php
index f091f32..2ee8d63 100644
--- a/SpecialApiSandbox.php
+++ b/SpecialApiSandbox.php
@@ -41,6 +41,7 @@
 '
                        . '<tr><th class="api-sandbox-result-label"><label 
for="api-sandbox-url">'
                        . $this->msg( 'apisb-result-request-url' )->parse() . 
'</label></th>'
+                       // The URL is always ltr
                        . '<td><input id="api-sandbox-url" readonly="readonly" 
dir="ltr" /></td></tr>
 '
                        . '<tr id="api-sandbox-post-row"><th 
class="api-sandbox-result-label">'
@@ -48,6 +49,7 @@
                        . $this->msg( 'apisb-result-request-post' )->parse() . 
'</label></th>'
                        . '<td><input id="api-sandbox-post" readonly="readonly" 
/></td></tr>
 '
+                       // The result is always ltr
                        . '<tr><td colspan="2"><div id="api-sandbox-output" 
dir="ltr"></div></td></tr>'
                        . "\n</tbody></table>"
                        . "\n</fieldset>\n</form>" );
@@ -106,7 +108,7 @@
                        </td>
                        <td class="api-sandbox-docs-col">
                                <div id="api-sandbox-buttons"></div>
-                               <div dir="ltr" id="api-sandbox-help"></div>
+                               <div id="api-sandbox-help"></div>
                        </td>
                </tr>
        </tbody>
diff --git a/resources/UiBuilder.js b/resources/UiBuilder.js
index 7784f21..99a20e6 100644
--- a/resources/UiBuilder.js
+++ b/resources/UiBuilder.js
@@ -58,7 +58,7 @@
                                                                        )
                                                        )
                                                        .append( $( '<td 
class="api-sandbox-params-value"></td>' ).html( uiBuilder.input( action, param, 
name ) ) )
-                                                       .append( $( '<td 
class="mw-content-ltr" dir="ltr">' ).html( desc ) )
+                                                       .append( $( '<td>' 
).html( desc ) )
                                                        .appendTo( $tbody );
                                        }
                                }
@@ -74,7 +74,11 @@
                setHelp: function ( $container ) {
                        var descHtml = '';
                        $.each( this.info, function ( moduleName, moduleInfo ) {
-                               descHtml += '<h6>' + moduleName + '</h6>\n';
+                               // The module name is always ltr and 
English-based,
+                               // so set English language and ltr direction.
+                               // The text alignment is handled by CSS.
+                               descHtml += '<h6 lang="en" dir="ltr" 
class="mw-content-ltr">' + moduleName +
+                                       '</h6>\n';
                                descHtml += moduleInfo.description;
                                if ( moduleInfo.helpurls && 
moduleInfo.helpurls[0] ) {
                                        descHtml += ' ' + mw.msg( 
'parentheses', mw.html.element( 'a', {
diff --git a/resources/styles.css b/resources/styles.css
index 1cf025b..0a26c27 100644
--- a/resources/styles.css
+++ b/resources/styles.css
@@ -91,3 +91,9 @@
        border: none !important;
        font-size: 100% !important;
 }
+
+/* Help */
+#api-sandbox-help h6 {
+       /* To make sure that it's correctly aligned in RTL wikis */
+       text-align: left;
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I928a7478b7ca95695eca2e27dad5e277e7359c8e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApiSandbox
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to