Santhosh has uploaded a new change for review.

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

Change subject: Do not make the selection lowercase while passing to hook
......................................................................

Do not make the selection lowercase while passing to hook

Let the dictionary module make it lowercase. Other tools like links
can consume the selection as such.

Bug: 67291
Change-Id: I20c1b3b6ef65b59ced22d07d5a73aaa3f8ca8643
---
M modules/source/ext.cx.source.js
M modules/tools/ext.cx.tools.dictionary.js
M modules/translation/ext.cx.translation.js
3 files changed, 4 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/78/147078/1

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index d38313f..60a0c79 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -155,7 +155,7 @@
                this.$content.on( 'click', function () {
                        var selection = window.getSelection().toString();
                        if ( selection ) {
-                               mw.hook( 'mw.cx.select.word' ).fire( 
selection.toLowerCase() );
+                               mw.hook( 'mw.cx.select.word' ).fire( selection 
);
                        }
                } );
 
diff --git a/modules/tools/ext.cx.tools.dictionary.js 
b/modules/tools/ext.cx.tools.dictionary.js
index 52b99c4..171a968 100644
--- a/modules/tools/ext.cx.tools.dictionary.js
+++ b/modules/tools/ext.cx.tools.dictionary.js
@@ -115,7 +115,8 @@
 
                        return;
                }
-
+               // Normalize the case to lowercase.
+               word = word.toLowerCase();
                // Show the source word and get a translation,
                // and don't appear if getting the translation fails
                this.$card.find( '.card__headword' ).text( word );
diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index eb9af11..925c1c3 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -198,7 +198,7 @@
                // Search for text that was selected using the mouse.
                // Delay it to run every 250 ms so it won't fire all the time 
while typing.
                $section.on( 'click keyup', $.debounce( 250, function () {
-                       var selection = 
window.getSelection().toString().toLowerCase();
+                       var selection = window.getSelection().toString();
 
                        if ( selection ) {
                                mw.hook( 'mw.cx.select.word' ).fire( selection 
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I20c1b3b6ef65b59ced22d07d5a73aaa3f8ca8643
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to