summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2022-09-27 18:53:03 -0400
committerBrian Evans <grknight@gentoo.org>2022-09-27 19:02:02 -0400
commit5ca8d30155e11d97b20f79acec40632c2e06fcd5 (patch)
tree7531fb116791f8328c0bb0cabe42265ca67e6df9 /MLEB/Translate/resources
parentMerge branch 'master' into wikitest (diff)
downloadextensions-1.35.2.tar.gz
extensions-1.35.2.tar.bz2
extensions-1.35.2.zip
Update MLEB to 2021.12v1.35.2
This is the final version for MW 1.35 Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'MLEB/Translate/resources')
-rw-r--r--MLEB/Translate/resources/.eslintrc.json22
-rw-r--r--MLEB/Translate/resources/css/ext.translate.editor.css5
-rw-r--r--MLEB/Translate/resources/css/ext.translate.special.supportedlanguages.css5
-rw-r--r--MLEB/Translate/resources/css/ext.translate.tabgroup.css3
-rw-r--r--MLEB/Translate/resources/css/ext.translate.tag.languages.less18
-rw-r--r--MLEB/Translate/resources/images/action-edit.svg2
-rw-r--r--MLEB/Translate/resources/images/add.svg8
-rw-r--r--MLEB/Translate/resources/images/check-small.svg2
-rw-r--r--MLEB/Translate/resources/images/check-sprite-ltr.svg16
-rw-r--r--MLEB/Translate/resources/images/check-sprite-rtl.svg16
-rw-r--r--MLEB/Translate/resources/images/close.svg4
-rw-r--r--MLEB/Translate/resources/images/contract-ltr.svg2
-rw-r--r--MLEB/Translate/resources/images/contract-rtl.svg2
-rw-r--r--MLEB/Translate/resources/images/edit-mark.svg2
-rw-r--r--MLEB/Translate/resources/images/expand-ltr.svg2
-rw-r--r--MLEB/Translate/resources/images/expand-rtl.svg2
-rw-r--r--MLEB/Translate/resources/images/label-error.svg4
-rw-r--r--MLEB/Translate/resources/images/label-flag.svg4
-rw-r--r--MLEB/Translate/resources/images/label-pen.svg2
-rw-r--r--MLEB/Translate/resources/images/label-tick.svg2
-rw-r--r--MLEB/Translate/resources/images/loading.svg4
-rw-r--r--MLEB/Translate/resources/images/outdated-ltr.svg2
-rw-r--r--MLEB/Translate/resources/images/outdated-rtl.svg2
-rw-r--r--MLEB/Translate/resources/images/paste.svg8
-rw-r--r--MLEB/Translate/resources/images/plus_darkgray.svg8
-rw-r--r--MLEB/Translate/resources/images/project.svg16
-rw-r--r--MLEB/Translate/resources/images/remove.svg8
-rw-r--r--MLEB/Translate/resources/images/search.svg2
-rw-r--r--MLEB/Translate/resources/images/switch.svg4
-rw-r--r--MLEB/Translate/resources/images/translate-ltr.svg4
-rw-r--r--MLEB/Translate/resources/images/translate-rtl.svg4
-rw-r--r--MLEB/Translate/resources/images/trash_darkgray.svg8
-rw-r--r--MLEB/Translate/resources/images/user-small.svg4
-rw-r--r--MLEB/Translate/resources/images/view-list-hi.svg2
-rw-r--r--MLEB/Translate/resources/images/view-list.svg2
-rw-r--r--MLEB/Translate/resources/images/view-page.svg4
-rw-r--r--MLEB/Translate/resources/images/view-proofread-hi.svg2
-rw-r--r--MLEB/Translate/resources/images/view-proofread.svg2
-rw-r--r--MLEB/Translate/resources/js/LanguagesMultiselectWidget.js5
-rw-r--r--MLEB/Translate/resources/js/ext.translate.base.js29
-rw-r--r--MLEB/Translate/resources/js/ext.translate.edit.documentation.js9
-rw-r--r--MLEB/Translate/resources/js/ext.translate.editor.helpers.js84
-rw-r--r--MLEB/Translate/resources/js/ext.translate.editor.js177
-rw-r--r--MLEB/Translate/resources/js/ext.translate.editor.shortcuts.js14
-rw-r--r--MLEB/Translate/resources/js/ext.translate.groupselector.js95
-rw-r--r--MLEB/Translate/resources/js/ext.translate.messagerenamedialog.js27
-rw-r--r--MLEB/Translate/resources/js/ext.translate.messagetable.js116
-rw-r--r--MLEB/Translate/resources/js/ext.translate.navitoggle.js10
-rw-r--r--MLEB/Translate/resources/js/ext.translate.pagemode.js41
-rw-r--r--MLEB/Translate/resources/js/ext.translate.pagetranslation.uls.js4
-rw-r--r--MLEB/Translate/resources/js/ext.translate.parsers.js5
-rw-r--r--MLEB/Translate/resources/js/ext.translate.proofread.js73
-rw-r--r--MLEB/Translate/resources/js/ext.translate.selecttoinput.js5
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js65
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.languagestats.js50
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.managegroups.js40
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.managetranslatorsandbox.js68
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.pagemigration.js166
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.pagepreparation.js88
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js23
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.searchtranslations.js99
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.translate.js70
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.translationstash.js256
-rw-r--r--MLEB/Translate/resources/js/ext.translate.special.translationstats.js13
-rw-r--r--MLEB/Translate/resources/js/ext.translate.statsbar.js21
-rw-r--r--MLEB/Translate/resources/js/ext.translate.translationstashstorage.js57
-rw-r--r--MLEB/Translate/resources/js/ext.translate.translationstats.embedded.js7
-rw-r--r--MLEB/Translate/resources/js/ext.translate.translationstats.graphbuilder.js27
-rw-r--r--MLEB/Translate/resources/js/ext.translate.workflowselector.js17
-rw-r--r--MLEB/Translate/resources/js/jquery.ajaxdispatcher.js11
-rw-r--r--MLEB/Translate/resources/js/jquery.textchange.js44
-rw-r--r--MLEB/Translate/resources/src/.eslintrc.json5
-rw-r--r--MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.css (renamed from MLEB/Translate/resources/css/ext.translate.special.translationstash.css)0
-rw-r--r--MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.js252
-rw-r--r--MLEB/Translate/resources/src/ext.translate.specialTranslationStash/storage.js52
-rw-r--r--MLEB/Translate/resources/src/ve-translate/.eslintrc.json5
-rw-r--r--MLEB/Translate/resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js31
-rw-r--r--MLEB/Translate/resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js58
-rw-r--r--MLEB/Translate/resources/src/ve-translate/ve.ui.MWTranslateAnnotationContextItem.js64
79 files changed, 1242 insertions, 1250 deletions
diff --git a/MLEB/Translate/resources/.eslintrc.json b/MLEB/Translate/resources/.eslintrc.json
new file mode 100644
index 00000000..f6651ece
--- /dev/null
+++ b/MLEB/Translate/resources/.eslintrc.json
@@ -0,0 +1,22 @@
+{
+ "root": true,
+ "extends": [
+ "wikimedia/client-es5",
+ "wikimedia/jquery",
+ "wikimedia/mediawiki",
+ "wikimedia/jsduck"
+ ],
+ "globals": {
+ "Chart": "readonly"
+ },
+ "rules": {
+ "max-len": "off",
+ "no-use-before-define": "off",
+ "no-jquery/no-animate-toggle": "warn",
+ "no-jquery/no-class-state": "off",
+ "no-jquery/no-global-selector": "off",
+ "no-jquery/no-sizzle": "warn",
+ "no-jquery/no-visibility": "error",
+ "compat/compat": "warn"
+ }
+}
diff --git a/MLEB/Translate/resources/css/ext.translate.editor.css b/MLEB/Translate/resources/css/ext.translate.editor.css
index 68a6c047..0fbb5168 100644
--- a/MLEB/Translate/resources/css/ext.translate.editor.css
+++ b/MLEB/Translate/resources/css/ext.translate.editor.css
@@ -410,7 +410,8 @@
position: absolute;
/* 30px + 5px padding on bottom */
top: -35px;
- margin: 0 10px;
+ margin-left: 10px;
+ padding-right: 20px;
z-index: 110;
}
@@ -424,7 +425,7 @@
color: #222;
font-size: 13px;
line-height: 30px;
- height: 30px;
+ overflow-wrap: anywhere;
}
.tux-editor-insert-buttons .tux-editor-paste-original-button {
diff --git a/MLEB/Translate/resources/css/ext.translate.special.supportedlanguages.css b/MLEB/Translate/resources/css/ext.translate.special.supportedlanguages.css
index d0553411..97fe4826 100644
--- a/MLEB/Translate/resources/css/ext.translate.special.supportedlanguages.css
+++ b/MLEB/Translate/resources/css/ext.translate.special.supportedlanguages.css
@@ -3,6 +3,10 @@
line-height: 200%;
}
+.mw-translate-spsl-translators a {
+ unicode-bidi: isolate;
+}
+
.mw-special-SupportedLanguages h2 {
font-weight: bold;
margin-top: 2em;
@@ -18,4 +22,5 @@
white-space: nowrap;
margin: 0.5ex;
color: #000;
+ unicode-bidi: isolate;
}
diff --git a/MLEB/Translate/resources/css/ext.translate.tabgroup.css b/MLEB/Translate/resources/css/ext.translate.tabgroup.css
deleted file mode 100644
index fa8f48ff..00000000
--- a/MLEB/Translate/resources/css/ext.translate.tabgroup.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#left-navigation .selected {
- font-weight: bold;
-}
diff --git a/MLEB/Translate/resources/css/ext.translate.tag.languages.less b/MLEB/Translate/resources/css/ext.translate.tag.languages.less
index 4032c46e..50a8bdfc 100644
--- a/MLEB/Translate/resources/css/ext.translate.tag.languages.less
+++ b/MLEB/Translate/resources/css/ext.translate.tag.languages.less
@@ -23,12 +23,24 @@
white-space: nowrap;
}
-.mw-pt-languages-list {
+/* Increased specificity to override .mw-content-(rtl|ltr) ul { padding: 0; } */
+.mw-pt-languages .mw-pt-languages-list {
padding: 0.5em;
}
-.mw-pt-languages-list a {
- white-space: nowrap;
+.mw-pt-languages-list {
+ li {
+ display: inline-block;
+ margin: 0;
+ }
+
+ li:after {
+ content: '@{msg-tpt-languages-separator}';
+ }
+
+ li:last-child:after {
+ content: none;
+ }
}
.mw-pt-languages-selected,
diff --git a/MLEB/Translate/resources/images/action-edit.svg b/MLEB/Translate/resources/images/action-edit.svg
index a4c351c6..9ea43ae7 100644
--- a/MLEB/Translate/resources/images/action-edit.svg
+++ b/MLEB/Translate/resources/images/action-edit.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15">
- <path d="M9.825 1.975l-6.218 8.888h-.015l-.19 2.164 1.977-.92 6.217-8.89-1.772-1.244z" fill="#36c"/>
+ <path fill="#36c" d="m9.825 1.975-6.218 8.888h-.015l-.19 2.164 1.977-.92 6.217-8.89-1.772-1.244z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/add.svg b/MLEB/Translate/resources/images/add.svg
index 3cb491c0..fb189f98 100644
--- a/MLEB/Translate/resources/images/add.svg
+++ b/MLEB/Translate/resources/images/add.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" xmlns:xlink="http://www.w3.org/1999/xlink">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<linearGradient id="c">
<stop offset="0" stop-color="#8ccb81"/>
@@ -13,9 +13,9 @@
<stop offset="0" stop-color="#34812c" stop-opacity=".957"/>
<stop offset="1" stop-color="#87b870" stop-opacity=".957"/>
</linearGradient>
- <linearGradient id="f" x1="4.551" x2="11.459" y1="4.433" y2="11.341" xlink:href="#c" gradientUnits="userSpaceOnUse" gradientTransform="translate(-.038) scale(1.002)"/>
- <linearGradient id="d" x1="2.583" x2="12.758" y1="2.521" y2="13.001" xlink:href="#b" gradientUnits="userSpaceOnUse" gradientTransform="translate(.253 .127)"/>
- <linearGradient id="e" x1="12.758" x2="2.583" y1="13.001" y2="2.521" xlink:href="#a" gradientUnits="userSpaceOnUse" gradientTransform="translate(.253 .127)"/>
+ <linearGradient id="f" x1="4.551" x2="11.459" y1="4.433" y2="11.341" gradientTransform="translate(-.038) scale(1.002)" gradientUnits="userSpaceOnUse" xlink:href="#c"/>
+ <linearGradient id="d" x1="2.583" x2="12.758" y1="2.521" y2="13.001" gradientTransform="translate(.253 .127)" gradientUnits="userSpaceOnUse" xlink:href="#b"/>
+ <linearGradient id="e" x1="12.758" x2="2.583" y1="13.001" y2="2.521" gradientTransform="translate(.253 .127)" gradientUnits="userSpaceOnUse" xlink:href="#a"/>
</defs>
<path fill="url(#d)" fill-rule="evenodd" stroke="url(#e)" d="M14.9 7.95a6.85 6.85 0 1 1-13.7 0 6.85 6.85 0 1 1 13.7 0z"/>
<path fill="url(#f)" d="M13 8A5 5 0 1 1 3 8a5 5 0 1 1 10 0z"/>
diff --git a/MLEB/Translate/resources/images/check-small.svg b/MLEB/Translate/resources/images/check-small.svg
index 9dd46c85..804d510c 100644
--- a/MLEB/Translate/resources/images/check-small.svg
+++ b/MLEB/Translate/resources/images/check-small.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
- <path fill="#a2a9b1" d="M9.187 0L4.34 8.35l-1.897-1.4-1.49 1.984 3.037 2.248L5.1 12l.7-1.197 5.52-9.577L9.186 0z" overflow="visible"/>
+ <path fill="#a2a9b1" d="M9.187 0 4.34 8.35l-1.897-1.4-1.49 1.984 3.037 2.248L5.1 12l.7-1.197 5.52-9.577L9.186 0z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/images/check-sprite-ltr.svg b/MLEB/Translate/resources/images/check-sprite-ltr.svg
index aee115fc..b80c25a4 100644
--- a/MLEB/Translate/resources/images/check-sprite-ltr.svg
+++ b/MLEB/Translate/resources/images/check-sprite-ltr.svg
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="44" height="248">
<path fill="#eaecf0" d="M44 62H9.978l-9.8 15 9.8 15H44z" overflow="visible"/>
- <path fill="#3e3e3e" d="M34.794 64.844L24.504 82.57l-4.03-2.974-3.16 4.215 6.447 4.775 2.357 1.735 1.488-2.542 11.714-20.33-4.525-2.604z" overflow="visible"/>
+ <path fill="#3e3e3e" d="M34.794 64.844 24.504 82.57l-4.03-2.974-3.16 4.215 6.447 4.775 2.357 1.735 1.488-2.542 11.714-20.33-4.525-2.604z" overflow="visible"/>
<path fill="#c8dbf3" d="M44 93H9.978l-9.8 15 9.8 15H44z" overflow="visible"/>
- <path fill="#36c" stroke="#36c" stroke-width=".75" d="M34.794 95.844l-10.29 17.727-4.03-2.973-3.16 4.215 6.447 4.774 2.357 1.735 1.488-2.54L39.32 98.45l-4.525-2.605z" overflow="visible"/>
+ <path fill="#36c" stroke="#36c" stroke-width=".75" d="m34.794 95.844-10.29 17.727-4.03-2.973-3.16 4.215 6.447 4.774 2.357 1.735 1.488-2.54L39.32 98.45l-4.525-2.605z" overflow="visible"/>
<path fill="#eaecf0" d="M44 0H9.978l-9.8 15 9.8 15H44z" overflow="visible"/>
- <path fill="#fff" stroke="#a2a9b1" stroke-width=".75" d="M34.794 2.844L24.504 20.57l-4.03-2.974-3.16 4.215 6.447 4.775 2.357 1.735 1.488-2.542L39.32 5.448l-4.525-2.604z" overflow="visible"/>
+ <path fill="#fff" stroke="#a2a9b1" stroke-width=".75" d="M34.794 2.844 24.504 20.57l-4.03-2.974-3.16 4.215 6.447 4.775 2.357 1.735 1.488-2.542L39.32 5.448l-4.525-2.604z" overflow="visible"/>
<path fill="#c8dbf3" d="M44 31H9.978l-9.8 15 9.8 15H44z" overflow="visible"/>
- <path fill="#fff" stroke="#9ebfea" stroke-width=".75" d="M34.794 33.844L24.504 51.57l-4.03-2.974-3.16 4.215 6.447 4.775 2.357 1.735 1.488-2.542 11.714-20.33-4.525-2.604z" overflow="visible"/>
- <path fill="#d1d3d4" d="M37.693 128.84l-12.435 21.73-7.02-5.58 1.646-2.202 4.6 3.656 10.882-19.018"/>
- <path fill="#9dbfdf" d="M35.366 158.428l2.327 1.41-12.435 21.734-7.02-5.58 1.648-2.202 4.6 3.657M8.188 166.5v3.438H4.844v3.03h3.343v3.407h2.938v-3.406h3.344v-3.033h-3.346V166.5H8.187z"/>
- <path fill="#54595d" d="M18.237 206.99l1.647-2.2 4.6 3.656 10.882-19.018 2.327 1.41-12.435 21.734"/>
- <path fill="#9dbfdf" d="M19.884 235.79l4.6 3.656 10.882-19.018 2.327 1.41-12.435 21.734-7.02-5.58"/>
+ <path fill="#fff" stroke="#9ebfea" stroke-width=".75" d="M34.794 33.844 24.504 51.57l-4.03-2.974-3.16 4.215 6.447 4.775 2.357 1.735 1.488-2.542 11.714-20.33-4.525-2.604z" overflow="visible"/>
+ <path fill="#d1d3d4" d="m37.693 128.84-12.435 21.73-7.02-5.58 1.646-2.202 4.6 3.656 10.882-19.018"/>
+ <path fill="#9dbfdf" d="m35.366 158.428 2.327 1.41-12.435 21.734-7.02-5.58 1.648-2.202 4.6 3.657M8.188 166.5v3.438H4.844v3.03h3.343v3.407h2.938v-3.406h3.344v-3.033h-3.346V166.5H8.187z"/>
+ <path fill="#54595d" d="m18.237 206.99 1.647-2.2 4.6 3.656 10.882-19.018 2.327 1.41-12.435 21.734"/>
+ <path fill="#9dbfdf" d="m19.884 235.79 4.6 3.656 10.882-19.018 2.327 1.41-12.435 21.734-7.02-5.58"/>
</svg>
diff --git a/MLEB/Translate/resources/images/check-sprite-rtl.svg b/MLEB/Translate/resources/images/check-sprite-rtl.svg
index 5f15ad22..ed8e2173 100644
--- a/MLEB/Translate/resources/images/check-sprite-rtl.svg
+++ b/MLEB/Translate/resources/images/check-sprite-rtl.svg
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="44" height="248">
<path fill="#eaecf0" d="M.177 62H34.2L44 77l-9.8 15H.176z" overflow="visible"/>
- <path fill="#3e3e3e" d="M22.338 64.844L12.048 82.57 8.02 79.597 4.86 83.81l6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
+ <path fill="#3e3e3e" d="M22.338 64.844 12.048 82.57 8.02 79.597 4.86 83.81l6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
<path fill="#c8dbf3" d="M.177 93H34.2l9.8 15-9.8 15H.176z" overflow="visible"/>
- <path fill="#36c" stroke="#36c" stroke-width=".75" d="M22.338 95.844l-10.29 17.727-4.028-2.974-3.16 4.215 6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
+ <path fill="#36c" stroke="#36c" stroke-width=".75" d="m22.338 95.844-10.29 17.727-4.028-2.974-3.16 4.215 6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
<path fill="#eaecf0" d="M.177 0H34.2L44 15l-9.8 15H.176z" overflow="visible"/>
- <path fill="#fff" stroke="#aeaeae" stroke-width=".75" d="M22.338 2.844L12.048 20.57 8.02 17.597 4.86 21.81l6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
+ <path fill="#fff" stroke="#aeaeae" stroke-width=".75" d="M22.338 2.844 12.048 20.57 8.02 17.597 4.86 21.81l6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
<path fill="#c8dbf3" d="M.177 31H34.2L44 46l-9.8 15H.176z" overflow="visible"/>
- <path fill="#fff" stroke="#9ebfea" stroke-width=".75" d="M22.338 33.844L12.048 51.57 8.02 48.597 4.86 52.81l6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
- <path fill="#d1d3d4" d="M22.91 127.428l2.328 1.41-12.435 21.734-7.02-5.58 1.646-2.202 4.6 3.656"/>
- <path fill="#9dbfdf" d="M12.03 177.447l10.88-19.02 2.328 1.412-12.435 21.732-7.02-5.58 1.647-2.202M35.99 166.5v3.438h3.343v3.03H35.99v3.407h-2.938v-3.406h-3.344v-3.032h3.344V166.5h2.938z"/>
- <path fill="#54595d" d="M12.803 212.572l-7.02-5.58 1.646-2.202 4.6 3.656 10.88-19.018 2.328 1.41"/>
- <path fill="#9dbfdf" d="M5.782 237.99l1.647-2.2 4.6 3.656 10.88-19.018 2.328 1.41-12.435 21.734"/>
+ <path fill="#fff" stroke="#9ebfea" stroke-width=".75" d="M22.338 33.844 12.048 51.57 8.02 48.597 4.86 52.81l6.445 4.774 2.356 1.735 1.488-2.542 11.715-20.33-4.525-2.604z" overflow="visible"/>
+ <path fill="#d1d3d4" d="m22.91 127.428 2.328 1.41-12.435 21.734-7.02-5.58 1.646-2.202 4.6 3.656"/>
+ <path fill="#9dbfdf" d="m12.03 177.447 10.88-19.02 2.328 1.412-12.435 21.732-7.02-5.58 1.647-2.202m28.56-7.289v3.438h3.343v3.03H35.99v3.407h-2.938v-3.406h-3.344v-3.032h3.344V166.5h2.938z"/>
+ <path fill="#54595d" d="m12.803 212.572-7.02-5.58 1.646-2.202 4.6 3.656 10.88-19.018 2.328 1.41"/>
+ <path fill="#9dbfdf" d="m5.782 237.99 1.647-2.2 4.6 3.656 10.88-19.018 2.328 1.41-12.435 21.734"/>
</svg>
diff --git a/MLEB/Translate/resources/images/close.svg b/MLEB/Translate/resources/images/close.svg
index 22619b95..57c8603a 100644
--- a/MLEB/Translate/resources/images/close.svg
+++ b/MLEB/Translate/resources/images/close.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
- <path d="M3.636 2.222l14.142 14.142-1.414 1.414L2.222 3.636z"/>
- <path d="M17.778 3.636L3.636 17.778l-1.414-1.414L16.364 2.222z"/>
+ <path d="m3.636 2.222 14.142 14.142-1.414 1.414L2.222 3.636z"/>
+ <path d="M17.778 3.636 3.636 17.778l-1.414-1.414L16.364 2.222z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/contract-ltr.svg b/MLEB/Translate/resources/images/contract-ltr.svg
index 2b7d71b6..1ed25c51 100644
--- a/MLEB/Translate/resources/images/contract-ltr.svg
+++ b/MLEB/Translate/resources/images/contract-ltr.svg
@@ -2,5 +2,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="12" viewBox="0 0 16 12">
<path fill="#a2a9b1" d="M10.52 1.412h4.293v9.257H10.52z" overflow="visible"/>
<path fill="none" stroke="#222" stroke-width="1.367" d="M.683.862h14.633V11.14H.683z" overflow="visible"/>
- <path fill="#222" d="M7.03 2.22L3.688 5.53l-.406.44.408.405 3.25 3.25.843-.844L5.53 6.5h5.782V5.312H5.595l2.25-2.25-.813-.843z" overflow="visible"/>
+ <path fill="#222" d="M7.03 2.22 3.688 5.53l-.406.44.408.405 3.25 3.25.843-.844L5.53 6.5h5.782V5.312H5.595l2.25-2.25-.813-.843z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/images/contract-rtl.svg b/MLEB/Translate/resources/images/contract-rtl.svg
index 8a498500..907ba98d 100644
--- a/MLEB/Translate/resources/images/contract-rtl.svg
+++ b/MLEB/Translate/resources/images/contract-rtl.svg
@@ -2,5 +2,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="12" viewBox="0 0 16 12">
<path fill="#a2a9b1" d="M5.48 1.412H1.186v9.257H5.48z" overflow="visible"/>
<path fill="none" stroke="#222" stroke-width="1.367" d="M15.316.862H.683V11.14h14.633z" overflow="visible"/>
- <path fill="#222" d="M8.97 2.22l-.845.842 2.28 2.25H4.69V6.5h5.78L8.19 8.78l.843.845 3.25-3.25.408-.406-.407-.44-3.31-3.31z" overflow="visible"/>
+ <path fill="#222" d="m8.97 2.22-.845.842 2.28 2.25H4.69V6.5h5.78L8.19 8.78l.843.845 3.25-3.25.408-.406-.407-.44-3.31-3.31z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/images/edit-mark.svg b/MLEB/Translate/resources/images/edit-mark.svg
index 80d09ecb..e1710f09 100644
--- a/MLEB/Translate/resources/images/edit-mark.svg
+++ b/MLEB/Translate/resources/images/edit-mark.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="33.389" height="22.857" viewBox="0 0 33.389 22.857">
- <path fill="#c8ccd1" d="M21.325 2.915l-9.343 13.31-.022.004-.284 3.238 2.968-1.38 9.344-13.31-2.663-1.863z"/>
+ <path fill="#c8ccd1" d="m21.325 2.915-9.343 13.31-.022.004-.284 3.238 2.968-1.38 9.344-13.31-2.663-1.863z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/expand-ltr.svg b/MLEB/Translate/resources/images/expand-ltr.svg
index bffe869c..6862723c 100644
--- a/MLEB/Translate/resources/images/expand-ltr.svg
+++ b/MLEB/Translate/resources/images/expand-ltr.svg
@@ -2,5 +2,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="12" viewBox="0 0 16 12">
<path fill="#a2a9b1" d="M10.52 1.412h4.293v9.257H10.52z" overflow="visible"/>
<path fill="none" stroke="#222" stroke-width="1.367" d="M.683.862h14.633V11.14H.683z" overflow="visible"/>
- <path fill="#222" d="M8.406 2.22l-.844.842 2.282 2.25h-5.72V6.5h5.782l-2.28 2.28.843.845 3.25-3.25.405-.406-.406-.44-3.314-3.31z" overflow="visible"/>
+ <path fill="#222" d="m8.406 2.22-.844.842 2.282 2.25h-5.72V6.5h5.782l-2.28 2.28.843.845 3.25-3.25.405-.406-.406-.44-3.314-3.31z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/images/expand-rtl.svg b/MLEB/Translate/resources/images/expand-rtl.svg
index d65d5660..7e34a1f6 100644
--- a/MLEB/Translate/resources/images/expand-rtl.svg
+++ b/MLEB/Translate/resources/images/expand-rtl.svg
@@ -2,5 +2,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="12" viewBox="0 0 16 12">
<path fill="#a2a9b1" d="M5.48 1.412H1.186v9.257H5.48z" overflow="visible"/>
<path fill="none" stroke="#222" stroke-width="1.367" d="M15.316.862H.683V11.14h14.633z" overflow="visible"/>
- <path fill="#222" d="M7.563 2.22L4.25 5.53l-.406.44.406.405 3.25 3.25.844-.844-2.25-2.28h5.75V5.312H6.156l2.25-2.25-.844-.843z" overflow="visible"/>
+ <path fill="#222" d="M7.563 2.22 4.25 5.53l-.406.44.406.405 3.25 3.25.844-.844-2.25-2.28h5.75V5.312H6.156l2.25-2.25-.844-.843z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/images/label-error.svg b/MLEB/Translate/resources/images/label-error.svg
index 29444722..191e4431 100644
--- a/MLEB/Translate/resources/images/label-error.svg
+++ b/MLEB/Translate/resources/images/label-error.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
- <path style="fill:#b32424;fill-opacity:1" id="path4" d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z" />
+<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
+ <path id="path4" d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z" style="fill:#b32424;fill-opacity:1"/>
</svg>
diff --git a/MLEB/Translate/resources/images/label-flag.svg b/MLEB/Translate/resources/images/label-flag.svg
index 58ee6b77..c89b2a9d 100644
--- a/MLEB/Translate/resources/images/label-flag.svg
+++ b/MLEB/Translate/resources/images/label-flag.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
- <path style="fill:#ac6600;fill-opacity:1" id="path4" d="M17 6L3 1v18h2v-6.87L17 6z" />
+<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
+ <path id="path4" d="M17 6 3 1v18h2v-6.87L17 6z" style="fill:#ac6600;fill-opacity:1"/>
</svg>
diff --git a/MLEB/Translate/resources/images/label-pen.svg b/MLEB/Translate/resources/images/label-pen.svg
index 715470d0..27efaf9f 100644
--- a/MLEB/Translate/resources/images/label-pen.svg
+++ b/MLEB/Translate/resources/images/label-pen.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15">
- <path fill="#54595d" d="M9.825 1.975l-6.218 8.888h-.015l-.19 2.163 1.976-.92 6.218-8.89-1.77-1.243v.002z"/>
+ <path fill="#54595d" d="m9.825 1.975-6.218 8.888h-.015l-.19 2.163 1.976-.92 6.218-8.89-1.77-1.243v.002z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/label-tick.svg b/MLEB/Translate/resources/images/label-tick.svg
index 44326a0c..0cbbe21c 100644
--- a/MLEB/Translate/resources/images/label-tick.svg
+++ b/MLEB/Translate/resources/images/label-tick.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15">
- <path fill="#54595d" d="M10.765 1.078l-5.188 8.938-2.03-1.5L1.95 10.64l3.25 2.407 1.188.875.75-1.28 5.906-10.25-2.28-1.314z"/>
+ <path fill="#54595d" d="m10.765 1.078-5.188 8.938-2.03-1.5L1.95 10.64l3.25 2.407 1.188.875.75-1.28 5.906-10.25-2.28-1.314z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/loading.svg b/MLEB/Translate/resources/images/loading.svg
index 7aa88cb4..0e4c8c5f 100644
--- a/MLEB/Translate/resources/images/loading.svg
+++ b/MLEB/Translate/resources/images/loading.svg
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34.031">
<g color="#000">
- <path fill-opacity=".083" stroke="#54595d" stroke-opacity=".196" stroke-width=".5" d="M16.978.24C7.715.24.245 7.756.245 17.02c0 9.263 7.47 16.778 16.733 16.778 9.262 0 16.777-7.515 16.777-16.778C33.755 7.755 26.24.24 16.978.24zm0 4.15c6.966 0 12.627 5.66 12.627 12.628 0 6.967-5.66 12.583-12.627 12.583-6.967 0-12.584-5.615-12.584-12.582 0-6.967 5.617-12.627 12.584-12.627z" overflow="visible"/>
- <path fill="none" stroke="#36c" stroke-width="2.258" d="M31.677 17.004a14.68 14.68 0 0 1-10.88 14.18" stroke-linecap="round" overflow="visible"/>
+ <path fill-opacity=".083" stroke="#54595d" stroke-opacity=".196" stroke-width=".5" d="M16.978.24C7.715.24.245 7.756.245 17.02c0 9.263 7.47 16.778 16.733 16.778 9.262 0 16.777-7.515 16.777-16.778C33.755 7.755 26.24.24 16.978.24zm0 4.15c6.966 0 12.627 5.66 12.627 12.628 0 6.967-5.66 12.583-12.627 12.583A12.56 12.56 0 0 1 4.394 17.019c0-6.967 5.617-12.627 12.584-12.627z" overflow="visible"/>
+ <path fill="none" stroke="#36c" stroke-linecap="round" stroke-width="2.258" d="M31.677 17.004a14.68 14.68 0 0 1-10.88 14.18" overflow="visible"/>
</g>
</svg>
diff --git a/MLEB/Translate/resources/images/outdated-ltr.svg b/MLEB/Translate/resources/images/outdated-ltr.svg
index cf0fe1dc..d5e49c79 100644
--- a/MLEB/Translate/resources/images/outdated-ltr.svg
+++ b/MLEB/Translate/resources/images/outdated-ltr.svg
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="33.389" height="22.857" viewBox="0 0 33.389 22.857">
<path fill="#fef4ba" d="M0 0h25.922l7.467 11.43-7.468 11.428H0V0z"/>
- <path fill="#54595d" d="M17.98 4.357c-4.06 0-7.374 3.316-7.374 7.375 0 4.06 3.315 7.375 7.375 7.375 4.06 0 7.376-3.316 7.376-7.375 0-4.06-3.316-7.375-7.375-7.375zm0 1.768c3.105 0 5.608 2.504 5.608 5.607s-2.504 5.607-5.607 5.607c-3.102 0-5.606-2.505-5.606-5.608 0-3.103 2.504-5.607 5.607-5.607z"/>
+ <path fill="#54595d" d="M17.98 4.357c-4.06 0-7.374 3.316-7.374 7.375 0 4.06 3.315 7.375 7.375 7.375 4.06 0 7.376-3.316 7.376-7.375 0-4.06-3.316-7.375-7.375-7.375zm0 1.768c3.105 0 5.608 2.504 5.608 5.607s-2.504 5.607-5.607 5.607a5.6 5.6 0 0 1-5.606-5.608 5.599 5.599 0 0 1 5.607-5.607z"/>
<path fill="#54595d" d="M17.19 7.223v5.761h3.427v-1.21H18.4V7.223h-1.21z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/outdated-rtl.svg b/MLEB/Translate/resources/images/outdated-rtl.svg
index 13bcacd8..eaeec849 100644
--- a/MLEB/Translate/resources/images/outdated-rtl.svg
+++ b/MLEB/Translate/resources/images/outdated-rtl.svg
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="33.389" height="22.857" viewBox="0 0 33.389 22.857">
<path fill="#fef4ba" d="M33.39 0H7.466L0 11.43l7.467 11.428H33.39V0z"/>
- <path fill="#54595d" d="M15.408 4.357c-4.06 0-7.375 3.316-7.375 7.375 0 4.06 3.315 7.375 7.375 7.375 4.06 0 7.375-3.316 7.375-7.375 0-4.06-3.316-7.375-7.375-7.375zm0 1.768c3.104 0 5.607 2.504 5.607 5.607s-2.504 5.607-5.607 5.607S9.8 14.834 9.8 11.73c0-3.103 2.505-5.607 5.608-5.607z"/>
+ <path fill="#54595d" d="M15.408 4.357c-4.06 0-7.375 3.316-7.375 7.375 0 4.06 3.315 7.375 7.375 7.375 4.06 0 7.375-3.316 7.375-7.375 0-4.06-3.316-7.375-7.375-7.375zm0 1.768c3.104 0 5.607 2.504 5.607 5.607s-2.504 5.607-5.607 5.607S9.8 14.834 9.8 11.73a5.6 5.6 0 0 1 5.608-5.607z"/>
<path fill="#54595d" d="M14.616 7.223v5.761h3.428v-1.21h-2.218V7.223h-1.21z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/paste.svg b/MLEB/Translate/resources/images/paste.svg
index 932c4b22..bee0f59f 100644
--- a/MLEB/Translate/resources/images/paste.svg
+++ b/MLEB/Translate/resources/images/paste.svg
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
- <path fill="#54595d" d="M29.077 29.012c0 1.06-.86 1.92-1.92 1.92H4.844c-1.06 0-1.92-.86-1.92-1.92V4.042c0-1.06.86-1.92 1.92-1.92h22.313c1.06 0 1.92.86 1.92 1.92v24.97z"/>
- <path fill="#f8f9fa" stroke="#54595d" stroke-width=".5" stroke-miterlimit="10" d="M5.368 4.054h21v24.35h-21z"/>
- <path fill="#a2a9b1" d="M7.743 8.896h15.625v2.872H7.743zM7.743 15.09h15.625v2.875H7.743zM7.743 21.287h6.125v2.873H7.743z"/>
- <path fill="#414042" d="M18.646 2.814V1.068h-5.292v1.746H10.46v2.338H21.54V2.814"/>
+ <path fill="#54595d" d="M29.077 29.012c0 1.06-.86 1.92-1.92 1.92H4.844a1.92 1.92 0 0 1-1.92-1.92V4.042c0-1.06.86-1.92 1.92-1.92h22.313c1.06 0 1.92.86 1.92 1.92v24.97z"/>
+ <path fill="#f8f9fa" stroke="#54595d" stroke-miterlimit="10" stroke-width=".5" d="M5.368 4.054h21v24.35h-21z"/>
+ <path fill="#a2a9b1" d="M7.743 8.896h15.625v2.872H7.743zm0 6.194h15.625v2.875H7.743zm0 6.197h6.125v2.873H7.743z"/>
+ <path fill="#414042" d="M18.646 2.814V1.068h-5.292v1.746H10.46v2.338h11.08V2.814"/>
</svg>
diff --git a/MLEB/Translate/resources/images/plus_darkgray.svg b/MLEB/Translate/resources/images/plus_darkgray.svg
index 5cf4e598..26cbcad4 100644
--- a/MLEB/Translate/resources/images/plus_darkgray.svg
+++ b/MLEB/Translate/resources/images/plus_darkgray.svg
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 768">
- <path fill="#54595d" d="M870.5 445.2V322.8H573.2V25.5H450.8v297.3H153.5v122.4h297.3v297.3h122.4V445.2z"/>
-</svg>
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 768">
+ <path fill="#54595d" d="M870.5 445.2V322.8H573.2V25.5H450.8v297.3H153.5v122.4h297.3v297.3h122.4V445.2z"/>
+</svg>
diff --git a/MLEB/Translate/resources/images/project.svg b/MLEB/Translate/resources/images/project.svg
index 0e7a128b..ce1adeb0 100644
--- a/MLEB/Translate/resources/images/project.svg
+++ b/MLEB/Translate/resources/images/project.svg
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" xml:space="preserve">
- <g transform="translate(-355.875,-530.20145)">
- <rect width="13.336" height="6.4949999" x="373.173" y="532.79199" style="fill:#fff;fill-opacity:0.675;stroke:#c9c9c9;stroke-width:0.2572;stroke-linecap:round"/>
- <linearGradient id="a" x1="716.99408" y1="-394.2966" x2="716.99408" y2="-422.53201" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.0287,0,0,-1.0287,-365.6989,126.7675)">
- <stop style="stop-color:#f4f4f4;stop-opacity:1" offset="0"/>
- <stop style="stop-color:#dddddd;stop-opacity:1" offset="1"/>
+ <g transform="translate(-355.875 -530.201)">
+ <path d="M373.173 532.792h13.336v6.495h-13.336z" style="fill:#fff;fill-opacity:.675;stroke:#c9c9c9;stroke-width:.2572;stroke-linecap:round"/>
+ <linearGradient id="a" x1="716.994" x2="716.994" y1="-394.297" y2="-422.532" gradientTransform="matrix(1.0287 0 0 -1.0287 -365.699 126.767)" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#f4f4f4;stop-opacity:1"/>
+ <stop offset="1" style="stop-color:#ddd;stop-opacity:1"/>
</linearGradient>
- <path d="m 356.261,530.587 h 16.295 l 6.267,6.267 h 8.667 v 24.962 h -31.229 v -31.229 z" style="fill:url(#a);stroke:#9d9d9d;stroke-width:0.77149999;stroke-linecap:square"/>
- <path d="m 381.718,548.951 c 0.006,5.437 -4.396,9.848 -9.832,9.854 -5.436,0.006 -9.847,-4.396 -9.854,-9.831 0,-0.008 0,-0.016 0,-0.022 -0.006,-5.436 4.396,-9.847 9.832,-9.854 5.436,-0.006 9.847,4.396 9.854,9.832 0,0.006 0,0.014 0,0.021 z" style="fill:#f0f0f0;stroke:#6d6d6d;stroke-width:0.84439999;stroke-linecap:round"/>
- <path d="m 372.031,541.108 c -0.825,0.023 -2.344,0.219 -2.344,0.219 0,0 0.25,0.477 0.25,0.688 0,0.211 -0.062,0.778 -0.062,1.031 0,0.253 0.925,0.053 1.094,-0.031 0.169,-0.084 1.281,-1.062 1.281,-1.062 0,0 0.408,-0.612 0.281,-0.781 -0.031,-0.044 -0.225,-0.072 -0.5,-0.064 l 0,0 z m -4.469,0.718 c 0.06,0.656 0.844,1.094 0.844,1.094 l 0.125,-0.438 c 0,10e-4 -0.67,-0.656 -0.969,-0.656 z m -0.781,0.438 c 0,0 -0.406,0.347 -1.062,0.406 -0.247,0.022 -0.745,-0.072 -1.281,-0.156 -1.188,1.37 -1.995,3.062 -2.281,4.938 l 0.219,-0.312 c 0,0 0.77,1.381 1.188,1.5 0.418,0.119 0.892,0.543 1.25,0.781 0.358,0.238 0.591,1.472 0.531,2.188 -0.06,0.716 0.483,0.804 0.781,1.281 0.298,0.477 0.949,3.326 1.188,3.625 0.239,0.299 0.475,-1.253 0.594,-1.969 0.119,-0.716 1.688,-2.034 1.688,-2.75 0,-0.716 -1.798,-1.736 -2.156,-2.094 -0.358,-0.358 -1.477,-0.531 -2.312,-0.531 -0.835,0 -0.847,-1.128 -1.562,-1.188 -0.715,-0.06 0.125,-1 0.125,-1 0,0 1.958,-0.312 2.375,-0.312 0.417,0 0.54,-1.182 0.719,-1.719 0.179,-0.537 1.506,-0.486 1.625,-0.844 0.119,-0.358 -0.542,-0.719 -0.781,-0.719 -0.239,0 -1.259,0.364 -1.438,0.125 -0.179,-0.239 1.031,-0.969 1.031,-0.969 l -0.441,-0.281 z m 9.063,0 c -0.197,0.016 -0.374,0.052 -0.438,0.094 -0.127,0.084 -0.467,0.216 -0.594,0.406 -0.127,0.19 -0.272,0.624 -0.125,0.75 0.147,0.126 0.26,0.157 0.344,0.094 0.084,-0.063 0.729,-0.616 0.812,-0.531 0.083,0.085 0.283,0.594 0.156,0.594 -0.127,0 -1.031,0.281 -1.031,0.281 0,0 -0.003,-0.171 -0.062,-0.156 -0.06,0.015 -0.003,0.235 -0.062,0.25 -0.06,0.015 -0.844,0.375 -0.844,0.375 0,0 -0.1,0.088 -0.219,0.188 l -0.25,0.25 c -0.006,0.007 -0.027,0.025 -0.031,0.031 -0.06,0.104 -0.39,0.599 -0.375,0.719 0.016,0.119 -0.07,0.375 0.094,0.375 0.164,0 1.27,-0.682 1.344,-0.562 0.074,0.119 0.188,0.125 0.188,0.125 0,0 -0.074,-0.156 0,-0.156 0.074,0 0.562,0.188 0.562,0.188 0,0 -0.073,-0.312 0.031,-0.281 0.104,0.03 0.583,0.594 0.688,0.594 0.105,0 0.358,-0.007 0.344,-0.156 -0.015,-0.149 -0.068,-0.335 0.125,-0.469 0.193,-0.134 0.787,-0.231 0.906,-0.156 0.119,0.074 0.304,0.16 0.125,0.25 -0.18,0.089 -0.396,-0.014 -0.5,0.031 -0.104,0.044 -0.392,0.333 -0.406,0.438 -0.015,0.104 0.561,0.565 0.531,0.625 -0.029,0.06 -0.326,0.344 -0.625,0.344 -0.299,0 -2.484,-0.546 -2.812,-0.531 -0.328,0.015 -0.615,0.099 -0.75,0.219 -0.135,0.119 -0.707,0.648 -0.781,0.812 -0.074,0.164 -0.398,0.957 -0.219,1.375 0.179,0.418 0.584,1.176 1.031,1.25 0.447,0.074 0.99,0.107 1.125,0.062 0.135,-0.045 0.859,0.76 0.875,1.312 0.015,0.552 -0.039,1.938 0.125,2.281 0.164,0.343 0.291,0.982 0.812,0.938 0.521,-0.044 0.945,-0.168 1.125,-0.406 0.179,-0.238 0.678,-1.455 0.812,-2.156 0.134,-0.701 0.754,-1.754 0.844,-2.156 0.09,-0.402 0.102,-0.631 -0.062,-0.75 -0.164,-0.119 -0.485,-0.116 -0.5,-0.25 -0.016,-0.135 0.209,-0.016 0.344,0 0.135,0.015 0.631,-0.022 0.75,-0.156 0.119,-0.135 0.324,-0.571 0.25,-0.75 -0.074,-0.18 -0.406,-0.562 -0.406,-0.562 0,0 1.338,0.161 1.875,0.594 0.312,0.251 0.564,0.577 0.75,0.844 -0.047,-2.462 -0.994,-4.705 -2.531,-6.406 -0.014,0.002 -0.054,0.031 -0.062,0.031 -0.232,0 -2.031,0.344 -2.031,0.344 0,0 -0.393,-0.447 -0.688,-0.469 -0.149,-0.016 -0.367,-0.021 -0.564,-0.005 l 0,0 z m -2.282,1.312 c 0,0 -0.212,0.865 0.094,0.844 0.306,-0.021 -0.094,-0.844 -0.094,-0.844 z m -0.406,0.375 c 0,0 -0.365,0.187 -0.281,0.281 0.084,0.094 0.26,0.147 0.312,0.062 0.052,-0.085 -0.031,-0.343 -0.031,-0.343 l 0,0 z m 5.719,8.094 c -0.121,0.026 -0.265,0.124 -0.344,0.219 -0.079,0.095 -0.198,0.43 -0.156,0.625 0.042,0.195 0.218,0.459 0.281,0.438 0.063,-0.021 0.229,-0.084 0.25,-0.438 0.021,-0.354 0.078,-0.671 0.031,-0.75 -0.047,-0.079 -0.062,-0.094 -0.062,-0.094 l 0,0 z" style="fill:#6d6d6d"/>
+ <path d="M356.261 530.587h16.295l6.267 6.267h8.667v24.962h-31.229v-31.229z" style="fill:url(#a);stroke:#9d9d9d;stroke-width:.77149999;stroke-linecap:square"/>
+ <path d="M381.718 548.951c.006 5.437-4.396 9.848-9.832 9.854-5.436.006-9.847-4.396-9.854-9.831v-.022c-.006-5.436 4.396-9.847 9.832-9.854 5.436-.006 9.847 4.396 9.854 9.832v.021z" style="fill:#f0f0f0;stroke:#6d6d6d;stroke-width:.84439999;stroke-linecap:round"/>
+ <path d="M372.031 541.108c-.825.023-2.344.219-2.344.219s.25.477.25.688c0 .211-.062.778-.062 1.031 0 .253.925.053 1.094-.031.169-.084 1.281-1.062 1.281-1.062s.408-.612.281-.781c-.031-.044-.225-.072-.5-.064zm-4.469.718c.06.656.844 1.094.844 1.094l.125-.438c0 .001-.67-.656-.969-.656zm-.781.438s-.406.347-1.062.406c-.247.022-.745-.072-1.281-.156a9.757 9.757 0 0 0-2.281 4.938l.219-.312s.77 1.381 1.188 1.5c.418.119.892.543 1.25.781s.591 1.472.531 2.188c-.06.716.483.804.781 1.281.298.477.949 3.326 1.188 3.625.239.299.475-1.253.594-1.969.119-.716 1.688-2.034 1.688-2.75 0-.716-1.798-1.736-2.156-2.094-.358-.358-1.477-.531-2.312-.531-.835 0-.847-1.128-1.562-1.188-.715-.06.125-1 .125-1s1.958-.312 2.375-.312c.417 0 .54-1.182.719-1.719.179-.537 1.506-.486 1.625-.844s-.542-.719-.781-.719-1.259.364-1.438.125c-.179-.239 1.031-.969 1.031-.969l-.441-.281zm9.063 0c-.197.016-.374.052-.438.094-.127.084-.467.216-.594.406-.127.19-.272.624-.125.75.147.126.26.157.344.094.084-.063.729-.616.812-.531.083.085.283.594.156.594-.127 0-1.031.281-1.031.281s-.003-.171-.062-.156c-.06.015-.003.235-.062.25-.06.015-.844.375-.844.375s-.1.088-.219.188l-.25.25c-.006.007-.027.025-.031.031-.06.104-.39.599-.375.719.016.119-.07.375.094.375s1.27-.682 1.344-.562a.255.255 0 0 0 .188.125s-.074-.156 0-.156.562.188.562.188-.073-.312.031-.281c.104.03.583.594.688.594.105 0 .358-.007.344-.156-.015-.149-.068-.335.125-.469.193-.134.787-.231.906-.156.119.074.304.16.125.25-.18.089-.396-.014-.5.031-.104.044-.392.333-.406.438-.015.104.561.565.531.625-.029.06-.326.344-.625.344s-2.484-.546-2.812-.531c-.328.015-.615.099-.75.219-.135.119-.707.648-.781.812-.074.164-.398.957-.219 1.375.179.418.584 1.176 1.031 1.25.447.074.99.107 1.125.062s.859.76.875 1.312c.015.552-.039 1.938.125 2.281.164.343.291.982.812.938.521-.044.945-.168 1.125-.406.179-.238.678-1.455.812-2.156.134-.701.754-1.754.844-2.156.09-.402.102-.631-.062-.75-.164-.119-.485-.116-.5-.25-.016-.135.209-.016.344 0 .135.015.631-.022.75-.156.119-.135.324-.571.25-.75-.074-.18-.406-.562-.406-.562s1.338.161 1.875.594c.312.251.564.577.75.844a9.805 9.805 0 0 0-2.531-6.406c-.014.002-.054.031-.062.031-.232 0-2.031.344-2.031.344s-.393-.447-.688-.469a3.263 3.263 0 0 0-.564-.005zm-2.282 1.312s-.212.865.094.844c.306-.021-.094-.844-.094-.844zm-.406.375s-.365.187-.281.281c.084.094.26.147.312.062.052-.085-.031-.343-.031-.343zm5.719 8.094a.702.702 0 0 0-.344.219c-.079.095-.198.43-.156.625.042.195.218.459.281.438.063-.021.229-.084.25-.438.021-.354.078-.671.031-.75-.047-.079-.062-.094-.062-.094z" style="fill:#6d6d6d"/>
</g>
</svg>
diff --git a/MLEB/Translate/resources/images/remove.svg b/MLEB/Translate/resources/images/remove.svg
index 3cc0c703..db5a537c 100644
--- a/MLEB/Translate/resources/images/remove.svg
+++ b/MLEB/Translate/resources/images/remove.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<linearGradient id="c">
<stop offset="0" stop-color="#fa9a87"/>
@@ -13,9 +13,9 @@
<stop offset="0" stop-color="#c14d33"/>
<stop offset="1" stop-color="#e0696a"/>
</linearGradient>
- <linearGradient id="e" x1="12.758" x2="2.583" y1="13.001" y2="2.521" xlink:href="#a" gradientUnits="userSpaceOnUse"/>
- <linearGradient id="d" x1="2.583" x2="12.758" y1="2.521" y2="13.001" xlink:href="#b" gradientUnits="userSpaceOnUse"/>
- <linearGradient id="f" x1="4.551" x2="11.459" y1="4.433" y2="11.341" xlink:href="#c" gradientUnits="userSpaceOnUse"/>
+ <linearGradient id="e" x1="12.758" x2="2.583" y1="13.001" y2="2.521" gradientUnits="userSpaceOnUse" xlink:href="#a"/>
+ <linearGradient id="d" x1="2.583" x2="12.758" y1="2.521" y2="13.001" gradientUnits="userSpaceOnUse" xlink:href="#b"/>
+ <linearGradient id="f" x1="4.551" x2="11.459" y1="4.433" y2="11.341" gradientUnits="userSpaceOnUse" xlink:href="#c"/>
</defs>
<path fill="url(#d)" fill-rule="evenodd" stroke="url(#e)" d="M14.647 7.824a6.85 6.85 0 1 1-13.7 0 6.85 6.85 0 1 1 13.7 0z" transform="translate(.253 .127)"/>
<path fill="url(#f)" d="M13.006 7.982a4.988 4.988 0 1 1-9.976 0 4.988 4.988 0 1 1 9.976 0z" transform="translate(-.038) scale(1.002)"/>
diff --git a/MLEB/Translate/resources/images/search.svg b/MLEB/Translate/resources/images/search.svg
index f9b81b15..082b6c7b 100644
--- a/MLEB/Translate/resources/images/search.svg
+++ b/MLEB/Translate/resources/images/search.svg
@@ -3,5 +3,5 @@
<title>
search
</title>
- <path fill="#54595d" fill-rule="evenodd" d="M12.2 13.6a7 7 0 111.4-1.4l5.4 5.4-1.4 1.4-5.4-5.4zM13 8A5 5 0 113 8a5 5 0 0110 0z"/>
+ <path fill="#54595d" fill-rule="evenodd" d="M12.2 13.6a7 7 0 1 1 1.4-1.4l5.4 5.4-1.4 1.4-5.4-5.4zM13 8A5 5 0 1 1 3 8a5 5 0 0 1 10 0z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/switch.svg b/MLEB/Translate/resources/images/switch.svg
index 40967827..f5bb38e7 100644
--- a/MLEB/Translate/resources/images/switch.svg
+++ b/MLEB/Translate/resources/images/switch.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 768">
- <path fill="#54595d" d="M751.863 131.86l-186.744-1.106H349.324V27.837L128 233.67l221.326 188.127V318.88H565.12v215.793H462.2L650.33 756l204.726-221.327H752.14V318.88l-.278-187.02zm-90.467 90.745v4.427h-4.427v-4.427h4.425z"/>
- <path fill="#54595d" d="M655.503 228.447c.062-1.788.05-3.578.046-5.367-.025-1.523-.09-3.04.26-4.532 1.39-4.26 2.03-2.45 9.01-5.744.176 1.704.096 3.43.095 5.144.004 1.708-.003 3.417.003 5.125.006 1.19.008 2.377.024 3.566.014.584.016 1.17.022 1.756-.028 4.033.477.91-8.24 5.074.058-1.59.057-3.18.078-4.77.085-3.247.003-6.496.118-9.742.105-2.014.248-4.026.37-6.04.145-3.94 2.308-3.068 8.245-5.887.213-.1.498.79.733 1.42.733 2.91 1.115 5.89 1.545 8.854.457 3.367.885 6.733 1.15 10.12.152 2.527.183 5.053.587 7.555.26 1.833.743 3.62 1.19 5.414.188.823.355 1.65.407 2.492.288 3.13.21 1.59-8.18 3.726-.477.123.093-.98.134-1.47.066-.776.134-1.55.185-2.327.175-2.656.19-3.618.294-6.34.114-4.458.13-8.92.042-13.378.06-1.338 0-2.536-.664-3.706-.49-.78-1.084-1.406-2.002-1.596-1.142-.125-2.296-.1-3.443-.105-.726-.004-1.08-.068-1.787.196-.342.128-1.292.682-.972.506 2.18-1.2 4.274-2.573 6.55-3.575.537-.236-.858.8-1.246 1.24-.412.468-.765.984-1.147 1.476-1.973 2.593-3.097 5.555-3.672 8.73-.33 2.2-.3 4.426-.313 6.644-.014 2.337.006 4.674.04 7.01-.027 1.143.127 2.262.595 3.304.156.295.303.587.43.894l-8.073 4.495c-.105-.3-.243-.58-.38-.864-.523-1.167-.75-2.414-.668-3.7.014-2.338.01-4.675-.037-7.013-.023-2.277.016-4.557.307-6.817.536-3.302 1.61-6.413 3.59-9.152.234-.33 1.82-2.655 2.22-2.923 3.898-2.61 7.296-5.857 11.956-5.82 1.226 0 2.49-.06 3.675.314 1.014.462 1.74 1.232 2.333 2.17.767 1.33.954 2.665.77 4.197-.172 4.53-.317 9.06-.425 13.59-.05 2.837-.087 5.67-.113 8.508-.005.453.346 1.087-.016 1.36-8.296 6.283-8.284 8.008-8.196 4.66-.02-.802-.1-1.598-.26-2.384-.376-1.835-.88-3.642-1.138-5.5-.442-2.542-.443-5.108-.54-7.68-.216-3.374-.638-6.722-1.096-10.07-.422-2.877-.792-5.777-1.63-8.568-1.09-2.503-1.21.16 7.562-5.02.378-.223-.205.062-.3.447-.038.153-.027.314-.04.472-.172 2.04-.458 4.072-.582 6.117-.173 3.214-.062 6.434-.03 9.652.02 1.564.02 3.13.077 4.692-9.543 5.167-8.17 7.38-8.24 3.323.006-.595.008-1.188.022-1.78.016-1.2.02-2.4.03-3.597.01-1.715.016-3.43.035-5.145.008-1.604.02-3.21-.087-4.81 8.643-4.672 9.406-6.928 7.386-2.63-.568 1.375-.443 2.85-.45 4.312-.003 1.773-.016 3.548.046 5.32l-8.203 4.18z"/>
+ <path fill="#54595d" d="m751.863 131.86-186.744-1.106H349.324V27.837L128 233.67l221.326 188.127V318.88H565.12v215.793H462.2L650.33 756l204.726-221.327H752.14V318.88l-.278-187.02zm-90.467 90.745v4.427h-4.427v-4.427h4.425z"/>
+ <path fill="#54595d" d="M655.503 228.447c.062-1.788.05-3.578.046-5.367-.025-1.523-.09-3.04.26-4.532 1.39-4.26 2.03-2.45 9.01-5.744.176 1.704.096 3.43.095 5.144.004 1.708-.003 3.417.003 5.125.006 1.19.008 2.377.024 3.566.014.584.016 1.17.022 1.756-.028 4.033.477.91-8.24 5.074.058-1.59.057-3.18.078-4.77.085-3.247.003-6.496.118-9.742.105-2.014.248-4.026.37-6.04.145-3.94 2.308-3.068 8.245-5.887.213-.1.498.79.733 1.42.733 2.91 1.115 5.89 1.545 8.854.457 3.367.885 6.733 1.15 10.12.152 2.527.183 5.053.587 7.555.26 1.833.743 3.62 1.19 5.414.188.823.355 1.65.407 2.492.288 3.13.21 1.59-8.18 3.726-.477.123.093-.98.134-1.47.066-.776.134-1.55.185-2.327.175-2.656.19-3.618.294-6.34.114-4.458.13-8.92.042-13.378.06-1.338 0-2.536-.664-3.706-.49-.78-1.084-1.406-2.002-1.596-1.142-.125-2.296-.1-3.443-.105-.726-.004-1.08-.068-1.787.196-.342.128-1.292.682-.972.506 2.18-1.2 4.274-2.573 6.55-3.575.537-.236-.858.8-1.246 1.24-.412.468-.765.984-1.147 1.476-1.973 2.593-3.097 5.555-3.672 8.73-.33 2.2-.3 4.426-.313 6.644-.014 2.337.006 4.674.04 7.01-.027 1.143.127 2.262.595 3.304.156.295.303.587.43.894l-8.073 4.495c-.105-.3-.243-.58-.38-.864a7.759 7.759 0 0 1-.668-3.7c.014-2.338.01-4.675-.037-7.013-.023-2.277.016-4.557.307-6.817.536-3.302 1.61-6.413 3.59-9.152.234-.33 1.82-2.655 2.22-2.923 3.898-2.61 7.296-5.857 11.956-5.82 1.226 0 2.49-.06 3.675.314 1.014.462 1.74 1.232 2.333 2.17.767 1.33.954 2.665.77 4.197a963.34 963.34 0 0 0-.425 13.59c-.05 2.837-.087 5.67-.113 8.508-.005.453.346 1.087-.016 1.36-8.296 6.283-8.284 8.008-8.196 4.66-.02-.802-.1-1.598-.26-2.384-.376-1.835-.88-3.642-1.138-5.5-.442-2.542-.443-5.108-.54-7.68-.216-3.374-.638-6.722-1.096-10.07-.422-2.877-.792-5.777-1.63-8.568-1.09-2.503-1.21.16 7.562-5.02.378-.223-.205.062-.3.447-.038.153-.027.314-.04.472-.172 2.04-.458 4.072-.582 6.117-.173 3.214-.062 6.434-.03 9.652.02 1.564.02 3.13.077 4.692-9.543 5.167-8.17 7.38-8.24 3.323.006-.595.008-1.188.022-1.78.016-1.2.02-2.4.03-3.597.01-1.715.016-3.43.035-5.145.008-1.604.02-3.21-.087-4.81 8.643-4.672 9.406-6.928 7.386-2.63-.568 1.375-.443 2.85-.45 4.312-.003 1.773-.016 3.548.046 5.32l-8.203 4.18z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/translate-ltr.svg b/MLEB/Translate/resources/images/translate-ltr.svg
index 7bfc8618..db1c0a45 100644
--- a/MLEB/Translate/resources/images/translate-ltr.svg
+++ b/MLEB/Translate/resources/images/translate-ltr.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="33.389" height="22.857" viewBox="0 0 33.389 22.857">
- <path fill="#729fcf" d="M0 0h25.922l7.467 11.43-7.468 11.428H0V0z"/>
- <path fill="#fff" d="M21.324 2.915l-9.343 13.31-.02.004-.285 3.238 2.968-1.38 9.344-13.31-2.663-1.863z"/>
+ <path fill="#729fcf" d="M0 0h25.922l7.467 11.43-7.468 11.428H0V0z"/>
+ <path fill="#fff" d="m21.324 2.915-9.343 13.31-.02.004-.285 3.238 2.968-1.38 9.344-13.31-2.663-1.863z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/translate-rtl.svg b/MLEB/Translate/resources/images/translate-rtl.svg
index 9e9857f8..043e6553 100644
--- a/MLEB/Translate/resources/images/translate-rtl.svg
+++ b/MLEB/Translate/resources/images/translate-rtl.svg
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="33.389" height="22.857" viewBox="0 0 33.389 22.857">
- <path fill="#729fcf" d="M33.39 0H7.466L0 11.43l7.467 11.428H33.39V0z"/>
- <path fill="#fff" d="M21.05 2.915l-9.342 13.31-.022.004-.284 3.238 2.968-1.38 9.344-13.31-2.663-1.863z"/>
+ <path fill="#729fcf" d="M33.39 0H7.466L0 11.43l7.467 11.428H33.39V0z"/>
+ <path fill="#fff" d="m21.05 2.915-9.342 13.31-.022.004-.284 3.238 2.968-1.38 9.344-13.31-2.663-1.863z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/trash_darkgray.svg b/MLEB/Translate/resources/images/trash_darkgray.svg
index 3d1bef76..3da38d47 100644
--- a/MLEB/Translate/resources/images/trash_darkgray.svg
+++ b/MLEB/Translate/resources/images/trash_darkgray.svg
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 96 96">
- <path fill="#54595d" d="M13.5 28.2l8.1 63c.3 2.7 2.4 4.8 5.1 4.8h42.6c2.7 0 4.8-2.1 4.8-4.5l8.1-63H13.5v-.3zM77.4 6.6C81 6.6 84 8.1 84 9.9v7.2c0 1.8-3 1.5-6.9 1.5H18.6c-3.6 0-6.6.3-6.6-1.5V9.9c0-1.8 3-3.3 6.9-3.3l13.5-1.2L37.2 0h21.3l5.1 5.7 13.8.9z"/>
-</svg>
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 96 96">
+ <path fill="#54595d" d="m13.5 28.2 8.1 63c.3 2.7 2.4 4.8 5.1 4.8h42.6c2.7 0 4.8-2.1 4.8-4.5l8.1-63H13.5v-.3zM77.4 6.6C81 6.6 84 8.1 84 9.9v7.2c0 1.8-3 1.5-6.9 1.5H18.6c-3.6 0-6.6.3-6.6-1.5V9.9c0-1.8 3-3.3 6.9-3.3l13.5-1.2L37.2 0h21.3l5.1 5.7 13.8.9z"/>
+</svg>
diff --git a/MLEB/Translate/resources/images/user-small.svg b/MLEB/Translate/resources/images/user-small.svg
index af79fbf1..ea037509 100644
--- a/MLEB/Translate/resources/images/user-small.svg
+++ b/MLEB/Translate/resources/images/user-small.svg
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15">
<g fill="#c8ccd1">
- <path d="M12.28 4.776c0 2.64-2.14 4.783-4.78 4.783S2.723 7.414 2.723 4.775C2.722 2.138 4.862 0 7.502 0c2.638 0 4.78 2.138 4.78 4.776z"/>
- <path d="M13.36 8.61h-.947c-1.03 1.624-2.844 2.706-4.912 2.706-2.067 0-3.882-1.082-4.913-2.707h-.942c-.445 0-.8.357-.8.8v4.795c0 .436.354.795.8.795H13.36c.44 0 .794-.36.794-.795V9.41c0-.442-.353-.8-.794-.8z"/>
+ <path d="M12.28 4.776c0 2.64-2.14 4.783-4.78 4.783S2.723 7.414 2.723 4.775A4.776 4.776 0 0 1 7.502 0a4.779 4.779 0 0 1 4.78 4.776z"/>
+ <path d="M13.36 8.61h-.947a5.81 5.81 0 0 1-9.825-.001h-.942c-.445 0-.8.357-.8.8v4.795c0 .436.354.795.8.795H13.36c.44 0 .794-.36.794-.795V9.41c0-.442-.353-.8-.794-.8z"/>
</g>
</svg>
diff --git a/MLEB/Translate/resources/images/view-list-hi.svg b/MLEB/Translate/resources/images/view-list-hi.svg
index e9798819..ac492449 100644
--- a/MLEB/Translate/resources/images/view-list-hi.svg
+++ b/MLEB/Translate/resources/images/view-list-hi.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="15" viewBox="0 0 25 15">
- <path fill="#fff" d="M5.954 1.63h13.092V4.3H5.954zM5.954 6.166h13.092v2.668H5.954zM5.954 10.7h13.092v2.67H5.954z"/>
+ <path fill="#fff" d="M5.954 1.63h13.092V4.3H5.954zm0 4.536h13.092v2.668H5.954zm0 4.534h13.092v2.67H5.954z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/view-list.svg b/MLEB/Translate/resources/images/view-list.svg
index 49f03d57..e8f3b29f 100644
--- a/MLEB/Translate/resources/images/view-list.svg
+++ b/MLEB/Translate/resources/images/view-list.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="15" viewBox="0 0 25 15">
- <path fill="#222" d="M5.954 1.63h13.092V4.3H5.954zM5.954 6.166h13.092v2.668H5.954zM5.954 10.7h13.092v2.67H5.954z"/>
+ <path fill="#222" d="M5.954 1.63h13.092V4.3H5.954zm0 4.536h13.092v2.668H5.954zm0 4.534h13.092v2.67H5.954z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/view-page.svg b/MLEB/Translate/resources/images/view-page.svg
index 7e983678..61a2c027 100644
--- a/MLEB/Translate/resources/images/view-page.svg
+++ b/MLEB/Translate/resources/images/view-page.svg
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="15" viewBox="0 0 25 15">
- <g fill="#222">
- <path d="M5.97 1.625v2.688h5.655V1.624H5.97zm7.405 0v2.688h5.656V1.624h-5.655zM5.97 6.156v2.688h5.655V6.156H5.97zm7.405 0v2.688h5.656V6.156h-5.655zM5.97 10.688v2.687h5.655v-2.688H5.97zm7.405 0v2.687h5.656v-2.688h-5.655z"/>
- </g>
+ <path fill="#222" d="M5.97 1.625v2.688h5.655V1.624H5.97zm7.405 0v2.688h5.656V1.624h-5.655zM5.97 6.156v2.688h5.655V6.156H5.97zm7.405 0v2.688h5.656V6.156h-5.655zM5.97 10.688v2.687h5.655v-2.688H5.97zm7.405 0v2.687h5.656v-2.688h-5.655z"/>
</svg>
diff --git a/MLEB/Translate/resources/images/view-proofread-hi.svg b/MLEB/Translate/resources/images/view-proofread-hi.svg
index 4d38ee33..52e4ce2d 100644
--- a/MLEB/Translate/resources/images/view-proofread-hi.svg
+++ b/MLEB/Translate/resources/images/view-proofread-hi.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="15" viewBox="0 0 25 15">
- <path fill="#fff" d="M15.766 1.078l-5.188 8.938-2.03-1.5-1.595 2.125 3.25 2.407 1.188.875.75-1.28 5.907-10.25-2.28-1.314z" overflow="visible"/>
+ <path fill="#fff" d="m15.766 1.078-5.188 8.938-2.03-1.5-1.595 2.125 3.25 2.407 1.188.875.75-1.28 5.907-10.25-2.28-1.314z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/images/view-proofread.svg b/MLEB/Translate/resources/images/view-proofread.svg
index 1b3f287b..37c25f35 100644
--- a/MLEB/Translate/resources/images/view-proofread.svg
+++ b/MLEB/Translate/resources/images/view-proofread.svg
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="15" viewBox="0 0 25 15">
- <path fill="#222" d="M15.766 1.078l-5.188 8.938-2.03-1.5-1.595 2.125 3.25 2.407 1.188.875.75-1.28 5.907-10.25-2.28-1.314z" overflow="visible"/>
+ <path fill="#222" d="m15.766 1.078-5.188 8.938-2.03-1.5-1.595 2.125 3.25 2.407 1.188.875.75-1.28 5.907-10.25-2.28-1.314z" overflow="visible"/>
</svg>
diff --git a/MLEB/Translate/resources/js/LanguagesMultiselectWidget.js b/MLEB/Translate/resources/js/LanguagesMultiselectWidget.js
index 2ec3b0e7..54c2ebc1 100644
--- a/MLEB/Translate/resources/js/LanguagesMultiselectWidget.js
+++ b/MLEB/Translate/resources/js/LanguagesMultiselectWidget.js
@@ -69,9 +69,9 @@ LanguagesMultiselectWidget.prototype.onInputChange = function () {
* @return {OO.ui.MenuOptionWidget[]} Menu items
*/
LanguagesMultiselectWidget.prototype.getOptionsFromData = function ( data ) {
- var languageCode, options = [];
+ var options = [];
- for ( languageCode in data ) {
+ for ( var languageCode in data ) {
if ( this.languages[ languageCode ] !== undefined ) {
options.push( new OO.ui.MenuOptionWidget( {
data: languageCode,
@@ -90,7 +90,6 @@ LanguagesMultiselectWidget.prototype.setValue = function ( valueObject ) {
this.clearItems();
valueObject.forEach( function ( obj ) {
var data;
-
if ( typeof obj === 'string' ) {
data = obj;
} else {
diff --git a/MLEB/Translate/resources/js/ext.translate.base.js b/MLEB/Translate/resources/js/ext.translate.base.js
index cb0e13a5..6756ff90 100644
--- a/MLEB/Translate/resources/js/ext.translate.base.js
+++ b/MLEB/Translate/resources/js/ext.translate.base.js
@@ -54,15 +54,13 @@
* @return {jQuery.Promise} Object containing the requested properties on success.
*/
getMessageGroup: function ( id, props ) {
- var params, api;
-
if ( Array.isArray( props ) ) {
props = props.join( '|' );
} else if ( props === undefined ) {
props = 'id|label|description|icon|priority|prioritylangs|priorityforce|workflowstates';
}
- params = {
+ var params = {
meta: 'messagegroups',
mgformat: 'flat',
mgprop: props,
@@ -70,7 +68,7 @@
formatversion: 2
};
- api = new mw.Api();
+ var api = new mw.Api();
return api.get( params ).then( function ( result ) {
return result.query.messagegroups[ 0 ];
@@ -86,12 +84,11 @@
* @return {Object} Message group object
*/
findGroup: function ( id, groups ) {
- var result;
-
if ( !id ) {
return groups;
}
+ var result;
groups.some( function ( group ) {
if ( group.id === id ) {
result = group;
@@ -156,8 +153,7 @@
* @param {Array} regions Which regions to add the languages.
*/
addExtraLanguagesToLanguageData: function ( languages, regions ) {
- var code;
- for ( code in languages ) {
+ for ( var code in languages ) {
if ( code in $.uls.data.languages ) {
continue;
}
@@ -178,22 +174,17 @@
}
} );
- function pageShowHandler() {
- $( window ).on( 'beforeunload.translate', function () {
- if ( mw.translate.isDirty() ) {
- // Return our message
- return mw.msg( 'translate-js-support-unsaved-warning' );
- }
- } );
- }
-
/**
* A warning to be shown if a user tries to close the page or navigate away
* from it without saving the written translation.
*/
function translateOnBeforeUnloadRegister() {
- pageShowHandler();
- $( window ).on( 'pageshow.translate', pageShowHandler );
+ $( window ).on( 'beforeunload', function () {
+ if ( mw.translate.isDirty() ) {
+ // Return our message
+ return mw.msg( 'translate-js-support-unsaved-warning' );
+ }
+ } );
}
$( function () {
diff --git a/MLEB/Translate/resources/js/ext.translate.edit.documentation.js b/MLEB/Translate/resources/js/ext.translate.edit.documentation.js
index 6404cbb9..45bcc6e7 100644
--- a/MLEB/Translate/resources/js/ext.translate.edit.documentation.js
+++ b/MLEB/Translate/resources/js/ext.translate.edit.documentation.js
@@ -17,6 +17,15 @@
$( 'body' ).append( windowManager.$element );
windowManager.addWindows( [ warningDialog ] );
+ // TODO load ext.translate.ve unconditionally after 1.39 release: T295203
+ // (see gerrit I7a55a09514110fa7d290d6f03ce9c0b7962c9140; this should be
+ // loaded from extension.json, not from here)
+ if ( mw.config.get( 'wgVersion' ) >= '1.38' ) {
+ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
+ mw.libs.ve.targetLoader.addPlugin( 'ext.translate.ve' );
+ } );
+ }
+
$( function () {
mw.hook( 've.activationComplete' ).add( function () {
// eslint-disable-next-line no-undef
diff --git a/MLEB/Translate/resources/js/ext.translate.editor.helpers.js b/MLEB/Translate/resources/js/ext.translate.editor.helpers.js
index f728381e..7bd6c0b8 100644
--- a/MLEB/Translate/resources/js/ext.translate.editor.helpers.js
+++ b/MLEB/Translate/resources/js/ext.translate.editor.helpers.js
@@ -93,22 +93,13 @@
* @param {Object} documentation A documentation object as returned by API.
*/
showMessageDocumentation: function ( documentation ) {
- var $descEditLink,
- documentationDir,
- expand,
- $messageDescViewer,
- $messageDoc,
- readMore,
- langAttr,
- $readMore = null;
-
if ( !mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
return;
}
- $messageDescViewer = this.$editor.find( '.message-desc-viewer' );
- $descEditLink = $messageDescViewer.find( '.message-desc-edit' );
- $messageDoc = $messageDescViewer.find( '.message-desc' );
+ var $messageDescViewer = this.$editor.find( '.message-desc-viewer' );
+ var $descEditLink = $messageDescViewer.find( '.message-desc-edit' );
+ var $messageDoc = $messageDescViewer.find( '.message-desc' );
// Display the documentation only if it's not empty and
// documentation language is configured
@@ -117,13 +108,13 @@
// is heavily hinted at in the UI
return;
} else if ( documentation.value ) {
- documentationDir = $.uls.data.getDir( documentation.language );
+ var documentationDir = $.uls.data.getDir( documentation.language );
// Show the documentation and set appropriate
// lang and dir attributes.
// The message documentation is assumed to be written
// in the content language of the wiki.
- langAttr = {
+ var langAttr = {
lang: documentation.language,
dir: documentationDir
};
@@ -147,12 +138,12 @@
$descEditLink.text( mw.msg( 'tux-editor-edit-desc' ) );
if ( documentation.html.length > 500 ) {
- expand = function () {
+ var expand = function () {
$messageDoc.removeClass( 'compact' );
$readMore.text( mw.msg( 'tux-editor-message-desc-less' ) );
};
- readMore = function () {
+ var readMore = function () {
if ( $messageDoc.hasClass( 'compact' ) ) {
expand();
} else {
@@ -161,7 +152,7 @@
}
};
- $readMore = $( '<span>' )
+ var $readMore = $( '<span>' )
.addClass( 'read-more column' )
.text( mw.msg( 'tux-editor-message-desc-more' ) )
.on( 'click', readMore );
@@ -187,14 +178,15 @@
* @param {Object} documentation A gettext object as returned by API.
*/
showUneditableDocumentation: function ( documentation ) {
- var dir;
-
if ( documentation.error ) {
return;
}
- dir = $.uls.data.getDir( documentation.language );
+ var dir = $.uls.data.getDir( documentation.language );
+ // The following classes are used here:
+ // * mw-content-ltr
+ // * mw-content-rtl
this.$editor.find( '.uneditable-documentation' )
.attr( {
lang: documentation.language,
@@ -211,8 +203,6 @@
* @param {Array} translations An inotherlanguages array as returned by the translation helpers API.
*/
showAssistantLanguages: function ( translations ) {
- var $elements;
-
if ( translations.error ) {
return;
}
@@ -221,15 +211,13 @@
return;
}
- $elements = translations.map( function ( translation ) {
- var $element, langAttr;
-
- langAttr = {
+ var $elements = translations.map( function ( translation ) {
+ var langAttr = {
lang: translation.language,
dir: $.uls.data.getDir( translation.language )
};
- $element = $( '<div>' )
+ var $element = $( '<div>' )
.addClass( 'row in-other-language' )
.append(
$( '<div>' )
@@ -258,26 +246,23 @@
* @param {Array} translations A ttmserver array as returned by API.
*/
showTranslationMemory: function ( translations ) {
- var $heading, $tmSuggestions, $messageList, lang, dir,
- suggestions = {};
-
if ( !translations.length ) {
return;
}
// Container for the suggestions
- $tmSuggestions = $( '<div>' ).addClass( 'tm-suggestions' );
+ var $tmSuggestions = $( '<div>' ).addClass( 'tm-suggestions' );
- $heading = this.$editor.find( '.tm-suggestions-title' );
+ var $heading = this.$editor.find( '.tm-suggestions-title' );
$heading.after( $tmSuggestions );
- $messageList = $( '.tux-messagelist' );
- lang = $messageList.data( 'targetlangcode' );
- dir = $messageList.data( 'targetlangdir' );
+ var $messageList = $( '.tux-messagelist' );
+ var lang = $messageList.data( 'targetlangcode' );
+ var dir = $messageList.data( 'targetlangdir' );
- translations.forEach( function ( translation ) {
- var suggestion;
+ var suggestions = {};
+ translations.forEach( function ( translation ) {
// Remove once formatversion=2
if ( translation.local === '' ) {
translation.local = true;
@@ -291,7 +276,7 @@
}
// Check if suggestion with this value already exists
- suggestion = suggestions[ translation.target ];
+ var suggestion = suggestions[ translation.target ];
if ( suggestion ) {
suggestion.count++;
suggestion.sources.push( translation );
@@ -399,14 +384,13 @@
* @param {Array} suggestions
*/
showMachineTranslations: function ( suggestions ) {
- var $mtSuggestions, $messageList, translationLang, translationDir,
- translateEditor = this;
-
if ( !suggestions.length ) {
return;
}
- $mtSuggestions = this.$editor.find( '.tm-suggestions' );
+ var translateEditor = this;
+
+ var $mtSuggestions = this.$editor.find( '.tm-suggestions' );
if ( !$mtSuggestions.length ) {
$mtSuggestions = $( '<div>' ).addClass( 'tm-suggestions' );
@@ -416,9 +400,9 @@
.removeClass( 'hide' )
.after( $mtSuggestions );
- $messageList = $( '.tux-messagelist' );
- translationLang = $messageList.data( 'targetlangcode' );
- translationDir = $messageList.data( 'targetlangdir' );
+ var $messageList = $( '.tux-messagelist' );
+ var translationLang = $messageList.data( 'targetlangcode' );
+ var translationDir = $messageList.data( 'targetlangdir' );
suggestions.forEach( function ( translation ) {
var $translation;
@@ -452,10 +436,9 @@
* @param {string} suggestion Text to add
*/
suggestionAdder: function ( $source, suggestion ) {
- var inserter,
- $target = this.$editor.find( '.tux-textarea-translation' );
+ var $target = this.$editor.find( '.tux-textarea-translation' );
- inserter = function () {
+ var inserter = function () {
var selection;
if ( window.getSelection ) {
selection = window.getSelection().toString();
@@ -491,13 +474,12 @@
* @param {Object} insertables A insertables object as returned by API.
*/
addInsertables: function ( insertables ) {
- var i,
- count = insertables.length,
+ var count = insertables.length,
$sourceMessage = this.$editor.find( '.sourcemessage' ),
$buttonArea = this.$editor.find( '.tux-editor-insert-buttons' ),
$textarea = this.$editor.find( '.tux-textarea-translation' );
- for ( i = 0; i < count; i++ ) {
+ for ( var i = 0; i < count; i++ ) {
// The dir and lang attributes must be set here,
// because the language of the insertables is the language
// of the source message and not of the translation.
diff --git a/MLEB/Translate/resources/js/ext.translate.editor.js b/MLEB/Translate/resources/js/ext.translate.editor.js
index e4e227c1..2bbfddbb 100644
--- a/MLEB/Translate/resources/js/ext.translate.editor.js
+++ b/MLEB/Translate/resources/js/ext.translate.editor.js
@@ -16,10 +16,9 @@
diff: 'diff',
fuzzy: 'fuzzy',
getAllClasses: function () {
- var prop,
- classes = [];
+ var classes = [];
- for ( prop in this ) {
+ for ( var prop in this ) {
if ( typeof this[ prop ] === 'string' ) {
classes.push( this[ prop ] );
}
@@ -70,6 +69,7 @@
this.listen();
this.storage = this.options.storage || new mw.translate.TranslationApiStorage();
this.canDelete = mw.translate.canDelete();
+ this.editFontClass = 'mw-editfont-' + mw.user.options.get( 'editfont' );
this.delayValidation = delayer();
this.validating = null;
}
@@ -130,6 +130,8 @@
$tuxListStatus.children( '.tux-status-unsaved' ).remove();
$tuxListStatus.children().addClass( 'hide' );
+ // `highlightClass` documented above
+ // eslint-disable-next-line mediawiki/class-doc
$( '<span>' )
.addClass( 'tux-status-unsaved ' + highlightClass )
.text( mw.msg( 'tux-status-unsaved' ) )
@@ -206,12 +208,11 @@
* Save the translation
*/
save: function () {
- var translation, editSummary,
- translateEditor = this;
+ var translateEditor = this;
mw.hook( 'mw.translate.editor.beforeSubmit' ).fire( translateEditor.$editor );
- translation = translateEditor.$editor.find( '.tux-textarea-translation' ).val();
- editSummary = translateEditor.$editor.find( '.tux-input-editsummary' ).val() || '';
+ var translation = translateEditor.$editor.find( '.tux-textarea-translation' ).val();
+ var editSummary = translateEditor.$editor.find( '.tux-input-editsummary' ).val() || '';
translateEditor.saving = true;
@@ -333,6 +334,9 @@
);
this.saving = false;
this.markUnsavedFailure();
+
+ // Enable the save button again
+ this.$editor.find( '.tux-editor-save-button' ).prop( 'disabled', false );
},
/**
@@ -349,12 +353,10 @@
next: function () {
var $next = this.$editTrigger.next( '.tux-message' );
- // Skip if the message is hidden. For example in a filter result.
- if ( $next.length && $next.hasClass( 'hide' ) ) {
- this.$editTrigger = $next;
- this.next();
-
- return;
+ // Determine the next message to show. The immediate next one maybe hidden
+ // for example in case of filtering
+ while ( $next.length && $next.hasClass( 'hide' ) ) {
+ $next = $next.next( '.tux-message' );
}
// If this is the last message, just hide it
@@ -397,7 +399,6 @@
href: uri.toString(),
target: '_blank'
} )
- // eslint-disable-next-line mediawiki/msg-doc
.text( mw.msg( message ) )
);
},
@@ -409,9 +410,7 @@
* @return {jQuery} The new message tools menu element
*/
createMessageTools: function () {
- var $editItem, $historyItem, $deleteItem, $translationsItem, $linkToThisItem;
-
- $editItem = this.createMessageToolsItem(
+ var $editItem = this.createMessageToolsItem(
'message-tools-edit',
{
title: this.message.title,
@@ -424,7 +423,7 @@
$editItem.addClass( 'hide' );
}
- $historyItem = this.createMessageToolsItem(
+ var $historyItem = this.createMessageToolsItem(
'message-tools-history',
{
title: this.message.title,
@@ -433,7 +432,7 @@
'tux-editor-message-tools-history'
);
- $deleteItem = this.createMessageToolsItem(
+ var $deleteItem = this.createMessageToolsItem(
'message-tools-delete',
{
title: this.message.title,
@@ -453,7 +452,7 @@
// A link to Special:Translations,
// with translations of this message to other languages
- $translationsItem = this.createMessageToolsItem(
+ var $translationsItem = this.createMessageToolsItem(
'message-tools-translations',
{
title: 'Special:Translations',
@@ -462,7 +461,7 @@
'tux-editor-message-tools-translations'
);
- $linkToThisItem = this.createMessageToolsItem(
+ var $linkToThisItem = this.createMessageToolsItem(
'message-tools-linktothis',
{
title: 'Special:Translate',
@@ -480,38 +479,15 @@
prepareEditorColumn: function () {
var translateEditor = this,
- sourceString,
- originalTranslation,
- $editorColumn,
- $messageKeyLabel,
- $moreNoticesTab,
- $notices,
- $noticesBlock,
- $editAreaBlock,
- $textarea,
- $controlButtonBlock,
- $editingButtonBlock,
- $pasteOriginalButton,
- $editSummary,
- $editSummaryBlock,
$discardChangesButton = $( [] ),
$saveButton = $( [] ),
- $requestRight,
- $skipButton,
- $cancelButton,
- $sourceString,
- $closeIcon,
- $layoutActions,
- $infoToggleIcon,
- $messageList,
- targetLangAttrib, targetLangDir, targetLangCode, prefix,
$messageTools = translateEditor.createMessageTools(),
canTranslate = mw.translate.canTranslate();
- $editorColumn = $( '<div>' )
+ var $editorColumn = $( '<div>' )
.addClass( 'seven columns editcolumn' );
- $messageKeyLabel = $( '<div>' )
+ var $messageKeyLabel = $( '<div>' )
.addClass( 'ten columns messagekey' )
.text( this.message.title )
.append(
@@ -523,7 +499,7 @@
e.stopPropagation();
} );
- $closeIcon = $( '<span>' )
+ var $closeIcon = $( '<span>' )
.addClass( 'one column close' )
.attr( 'title', mw.msg( 'tux-editor-close-tooltip' ) )
.on( 'click', function ( e ) {
@@ -531,7 +507,7 @@
e.stopPropagation();
} );
- $infoToggleIcon = $( '<span>' )
+ var $infoToggleIcon = $( '<span>' )
// Initially the editor column is contracted,
// so show the expand button first
.addClass( 'one column editor-info-toggle editor-expand' )
@@ -541,7 +517,7 @@
e.stopPropagation();
} );
- $layoutActions = $( '<div>' )
+ var $layoutActions = $( '<div>' )
.addClass( 'two columns layout-actions' )
.append( $closeIcon, $infoToggleIcon );
@@ -550,11 +526,15 @@
.append( $messageKeyLabel, $layoutActions )
);
- $messageList = $( '.tux-messagelist' );
- originalTranslation = this.message.translation;
- sourceString = this.message.definition;
- $sourceString = $( '<span>' )
- .addClass( 'twelve columns sourcemessage' )
+ var $messageList = $( '.tux-messagelist' );
+ var originalTranslation = this.message.translation;
+ var sourceString = this.message.definition;
+ // The following classes are used here:
+ // * mw-editfont-serif
+ // * mw-editfont-sans-serif
+ // * mw-editfont-monospace
+ var $sourceString = $( '<span>' )
+ .addClass( 'twelve columns sourcemessage ' + this.editFontClass )
.attr( {
lang: $messageList.data( 'sourcelangcode' ),
dir: $messageList.data( 'sourcelangdir' )
@@ -575,10 +555,10 @@
.append( $sourceString )
);
- $notices = $( '<div>' )
+ var $notices = $( '<div>' )
.addClass( 'tux-notice hide' );
- $moreNoticesTab = $( '<div>' )
+ var $moreNoticesTab = $( '<div>' )
.addClass( 'tux-more-notices hide' )
.on( 'click', function () {
var $this = $( this ),
@@ -613,7 +593,8 @@
translateEditor.toggleMoreButtonClass();
} );
- targetLangCode = this.message.targetLanguage;
+ var targetLangCode = this.message.targetLanguage;
+ var targetLangAttrib, targetLangDir;
if ( targetLangCode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
targetLangAttrib = mw.config.get( 'wgContentLanguage' );
targetLangDir = $.uls.data.getDir( targetLangAttrib );
@@ -622,8 +603,12 @@
targetLangDir = $messageList.data( 'targetlangdir' );
}
- $textarea = $( '<textarea>' )
- .addClass( 'tux-textarea-translation' )
+ // The following classes are used here:
+ // * mw-editfont-serif
+ // * mw-editfont-sans-serif
+ // * mw-editfont-monospace
+ var $textarea = $( '<textarea>' )
+ .addClass( 'tux-textarea-translation ' + this.editFontClass )
.attr( {
lang: targetLangAttrib,
dir: targetLangDir
@@ -678,7 +663,7 @@
}
} );
- $textarea.on( 'textchange', function () {
+ $textarea.on( 'input', function () {
var $pasteSourceButton = translateEditor.$editor.find( '.tux-editor-paste-original-button' ),
original = translateEditor.message.translation || '',
current = $textarea.val() || '';
@@ -717,11 +702,11 @@
}, 500 );
} );
- $noticesBlock = $( '<div>' )
+ var $noticesBlock = $( '<div>' )
.addClass( 'tux-notices-block' )
.append( $moreNoticesTab, $notices );
- $editAreaBlock = $( '<div>' )
+ var $editAreaBlock = $( '<div>' )
.addClass( 'row tux-editor-editarea-block' )
.append( $( '<div>' )
.addClass( 'editarea twelve columns' )
@@ -730,8 +715,9 @@
$editorColumn.append( $editAreaBlock );
+ var $editingButtonBlock, $editSummaryBlock, $requestRight, $skipButton;
if ( canTranslate ) {
- $pasteOriginalButton = $( '<button>' )
+ var $pasteOriginalButton = $( '<button>' )
.addClass( 'tux-editor-paste-original-button' )
.text( mw.msg( 'tux-editor-paste-original-button-label' ) )
.on( 'click', function () {
@@ -743,7 +729,7 @@
$pasteOriginalButton.addClass( 'hide' );
} );
- $editSummary = $( '<input>' )
+ var $editSummary = $( '<input>' )
.addClass( 'tux-input-editsummary' )
.attr( {
maxlength: 255,
@@ -754,7 +740,7 @@
// Enable edit summary if there was a change to translation area
// or disable if there is no text in translation area
- $textarea.on( 'textchange', function () {
+ $textarea.on( 'input', function () {
if ( $editSummary.prop( 'disabled' ) ) {
$editSummary.prop( 'disabled', false );
}
@@ -873,7 +859,7 @@
} );
// This appears instead of "Skip" on the last message on the page
- $cancelButton = $( '<button>' )
+ var $cancelButton = $( '<button>' )
.addClass( 'tux-editor-cancel-button mw-ui-button mw-ui-quiet' )
.text( mw.msg( 'tux-editor-cancel-button-label' ) )
.on( 'click', function ( e ) {
@@ -883,7 +869,7 @@
e.stopPropagation();
} );
- $controlButtonBlock = $( '<div>' )
+ var $controlButtonBlock = $( '<div>' )
.addClass( 'twelve columns tux-editor-control-buttons' )
.append( $requestRight, $saveButton, $skipButton, $cancelButton );
@@ -900,7 +886,7 @@
);
if ( canTranslate ) {
- prefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix();
+ var prefix = $.fn.updateTooltipAccessKeys.getAccessKeyPrefix();
$editorColumn.append( $( '<div>' )
.addClass( 'row shortcutinfo' )
.text( mw.msg(
@@ -969,10 +955,9 @@
*/
validateTranslation: function () {
var translateEditor = this,
- api,
$textarea = translateEditor.$editor.find( '.tux-textarea-translation' );
- api = new mw.Api();
+ var api = new mw.Api();
this.validating = api.post( {
action: 'translationcheck',
@@ -1029,9 +1014,6 @@
removeNotices: function ( types ) {
var $tuxNotice = this.$editor.find( '.tux-notice' ),
stringTypes = [],
- $currentNotices,
- index,
- errMsg,
allNoticeTypes = noticeTypes.getAllClasses();
if ( typeof types === 'string' ) {
@@ -1040,16 +1022,16 @@
stringTypes = types;
}
- for ( index = 0; index < stringTypes.length; index++ ) {
+ for ( var index = 0; index < stringTypes.length; index++ ) {
if ( allNoticeTypes.indexOf( stringTypes[ index ] ) === -1 ) {
- errMsg = 'tux: Invalid notice type removeNotice - ' + stringTypes[ index ];
+ var errMsg = 'tux: Invalid notice type removeNotice - ' + stringTypes[ index ];
mw.log.error( errMsg );
throw new Error( errMsg );
}
$tuxNotice.find( '.' + stringTypes[ index ] ).remove();
}
- $currentNotices = $tuxNotice.children();
+ var $currentNotices = $tuxNotice.children();
// If a single notice is shown, we can hide the more notice button,
// and display the hidden notice.
if ( $currentNotices.length <= 1 ) {
@@ -1070,9 +1052,10 @@
* @return {jQuery} the new notice element
*/
addNotice: function ( notice, type ) {
- var noticeCount,
- $notices = this.$editor.find( '.tux-notice' ),
+ var $notices = this.$editor.find( '.tux-notice' ),
$moreNoticesTab = this.$editor.find( '.tux-more-notices' ),
+ // `noticeTypes` documented above
+ // eslint-disable-next-line mediawiki/class-doc
$newNotice = $( '<div>' )
.addClass( 'tux-notice-message ' + type )
.html( notice );
@@ -1083,7 +1066,7 @@
.removeClass( 'hide' )
.prepend( $newNotice );
- noticeCount = $notices.find( '.tux-notice-message' ).length;
+ var noticeCount = $notices.find( '.tux-notice-message' ).length;
if ( noticeCount > 1 ) {
$moreNoticesTab
@@ -1121,10 +1104,7 @@
},
prepareInfoColumn: function () {
- var $messageDescEditor, $messageDescTextarea,
- $messageDescSaveButton, $messageDescCancelButton,
- $messageDescViewer,
- $infoColumn = $( '<div>' ).addClass( 'infocolumn' ),
+ var $infoColumn = $( '<div>' ).addClass( 'infocolumn' ),
translateEditor = this;
$infoColumn.append( $( '<div>' )
@@ -1133,7 +1113,7 @@
);
if ( mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
- $messageDescSaveButton = $( '<button>' )
+ var $messageDescSaveButton = $( '<button>' )
.addClass( 'tux-editor-savedoc-button mw-ui-button mw-ui-progressive' )
.prop( 'disabled', true )
.text( mw.msg( 'tux-editor-doc-editor-save' ) )
@@ -1145,16 +1125,16 @@
} );
} );
- $messageDescCancelButton = $( '<button>' )
+ var $messageDescCancelButton = $( '<button>' )
.addClass( 'tux-editor-skipdoc-button mw-ui-button mw-ui-quiet' )
.text( mw.msg( 'tux-editor-doc-editor-cancel' ) )
.on( 'click', function () {
translateEditor.hideDocumentationEditor();
} );
- $messageDescTextarea = $( '<textarea>' )
+ var $messageDescTextarea = $( '<textarea>' )
.addClass( 'tux-textarea-documentation' )
- .on( 'textchange', function () {
+ .on( 'input', function () {
$messageDescSaveButton.prop( 'disabled', false );
} );
@@ -1162,7 +1142,7 @@
$messageDescTextarea.prop( 'placeholder', mw.msg( 'tux-editor-doc-editor-placeholder' ) );
}
- $messageDescEditor = $( '<div>' )
+ var $messageDescEditor = $( '<div>' )
.addClass( 'row message-desc-editor hide' )
.append(
$messageDescTextarea,
@@ -1174,7 +1154,7 @@
)
);
- $messageDescViewer = $( '<div>' )
+ var $messageDescViewer = $( '<div>' )
.addClass( 'message-desc-viewer hide' )
.append(
$( '<div>' )
@@ -1241,13 +1221,11 @@
},
show: function () {
- var $next, $textarea;
-
if ( !this.$editor ) {
this.init();
}
- $textarea = this.$editor.find( '.editcolumn textarea' );
+ var $textarea = this.$editor.find( '.editcolumn textarea' );
// Hide all other open editors in the page
$( '.tux-message.open' ).each( function () {
$( this ).data( 'translateeditor' ).hide();
@@ -1271,7 +1249,7 @@
this.$editTrigger.addClass( 'open' );
// don't waste time, get ready with next message
- $next = this.$editTrigger.next( '.tux-message' );
+ var $next = this.$editTrigger.next( '.tux-message' );
if ( $next.length ) {
$next.data( 'translateeditor' ).init();
@@ -1341,8 +1319,6 @@
* @param {Object} definitiondiff A definitiondiff object as returned by API.
*/
addDefinitionDiff: function ( definitiondiff ) {
- var $trigger;
-
if ( !definitiondiff || definitiondiff.error ) {
mw.log( 'Error loading translation diff ' + definitiondiff && definitiondiff.error );
return;
@@ -1351,7 +1327,7 @@
// Load the diff styles
mw.loader.load( 'mediawiki.diff.styles' );
- $trigger = $( '<span>' )
+ var $trigger = $( '<span>' )
.addClass( 'show-diff-link' )
.text( mw.msg( 'tux-editor-outdated-notice-diff-link' ) )
.on( 'click', function () {
@@ -1384,10 +1360,8 @@
* @param {jQuery} $textarea Text area.
*/
resizeInsertables: function ( $textarea ) {
- var $buttonArea, buttonAreaHeight;
-
- $buttonArea = this.$editor.find( '.tux-editor-insert-buttons' );
- buttonAreaHeight = $buttonArea.height();
+ var $buttonArea = this.$editor.find( '.tux-editor-insert-buttons' );
+ var buttonAreaHeight = $buttonArea.height();
$textarea.css( 'padding-bottom', buttonAreaHeight + 5 );
$buttonArea.css( 'top', -buttonAreaHeight );
autosize.update( $textarea );
@@ -1400,8 +1374,7 @@
* @param {string} noticeType
*/
displayNotices: function ( notices, noticeType ) {
- var index;
- for ( index = 0; index < notices.length; ++index ) {
+ for ( var index = 0; index < notices.length; ++index ) {
this.addNotice( notices[ index ], noticeType );
}
},
diff --git a/MLEB/Translate/resources/js/ext.translate.editor.shortcuts.js b/MLEB/Translate/resources/js/ext.translate.editor.shortcuts.js
index b8d5c4e2..8c56ef94 100644
--- a/MLEB/Translate/resources/js/ext.translate.editor.shortcuts.js
+++ b/MLEB/Translate/resources/js/ext.translate.editor.shortcuts.js
@@ -5,16 +5,14 @@
'use strict';
var translateEditorShortcuts = {
showShortcuts: function () {
- var editorOffset, minTop, maxTop, maxLeft, middle, rtl;
-
// Any better way?
- rtl = $( document.body ).is( '.rtl' );
+ var rtl = $( document.body ).is( '.rtl' );
- editorOffset = this.$editor.offset();
- minTop = editorOffset.top;
- maxTop = minTop + this.$editor.outerHeight();
- middle = minTop + ( maxTop - minTop ) / 2;
- maxLeft = rtl ? editorOffset.left : editorOffset.left + this.$editor.outerWidth();
+ var editorOffset = this.$editor.offset();
+ var minTop = editorOffset.top;
+ var maxTop = minTop + this.$editor.outerHeight();
+ var middle = minTop + ( maxTop - minTop ) / 2;
+ var maxLeft = rtl ? editorOffset.left : editorOffset.left + this.$editor.outerWidth();
this.hideShortcuts();
diff --git a/MLEB/Translate/resources/js/ext.translate.groupselector.js b/MLEB/Translate/resources/js/ext.translate.groupselector.js
index c87f4acf..9b37d908 100644
--- a/MLEB/Translate/resources/js/ext.translate.groupselector.js
+++ b/MLEB/Translate/resources/js/ext.translate.groupselector.js
@@ -56,17 +56,11 @@
* Prepare the selector menu rendering
*/
prepareSelectorMenu: function () {
- var $listFilters,
- $listFiltersGroup,
- $search,
- $searchIcon,
- $searchGroup;
-
this.$menu = $( '<div>' )
.addClass( 'tux-groupselector' )
.addClass( 'grid hide' );
- $searchIcon = $( '<div>' )
+ var $searchIcon = $( '<div>' )
.addClass( 'two columns tux-groupselector__filter__search__icon' );
this.$search = $( '<input>' )
@@ -77,11 +71,11 @@
this.$search.prop( 'placeholder', mw.msg( 'translate-msggroupselector-search-placeholder' ) );
}
- $search = $( '<div>' )
+ var $search = $( '<div>' )
.addClass( 'ten columns' )
.append( this.$search );
- $listFilters = $( '<div>' )
+ var $listFilters = $( '<div>' )
.addClass( 'tux-groupselector__filter__tabs' )
.addClass( 'six columns' )
.append(
@@ -98,12 +92,12 @@
);
}
- $searchGroup = $( '<div>' )
+ var $searchGroup = $( '<div>' )
.addClass( 'tux-groupselector__filter__search' )
.addClass( 'six columns' )
.append( $searchIcon, $search );
- $listFiltersGroup = $( '<div>' )
+ var $listFiltersGroup = $( '<div>' )
.addClass( 'tux-groupselector__filter' )
.addClass( 'row' )
.append( $listFilters, $searchGroup );
@@ -165,8 +159,7 @@
* Attach event listeners
*/
listen: function () {
- var $tabs,
- groupSelector = this;
+ var groupSelector = this;
// Hide the selector panel when clicking outside of it
$( document.documentElement ).on( 'click', this.hide.bind( this ) );
@@ -183,15 +176,14 @@
// Handle click on row item. This selects the group, and in case it has
// subgroups, also opens a new menu to show them.
groupSelector.$menu.on( 'click', '.tux-grouplist__item', function () {
- var $newLink,
- messageGroup = $( this ).data( 'msggroup' );
+ var messageGroup = $( this ).data( 'msggroup' );
groupSelector.hide();
groupSelector.$trigger.nextAll().remove();
if ( !groupSelector.options.preventSelector ) {
- $newLink = $( '<span>' )
+ var $newLink = $( '<span>' )
.addClass( 'grouptitle grouplink' )
.text( messageGroup.label )
.data( 'msggroupid', messageGroup.id );
@@ -216,7 +208,7 @@
} );
// Handle the tabs All | Recent
- $tabs = groupSelector.$menu.find( '.tux-grouptab' );
+ var $tabs = groupSelector.$menu.find( '.tux-grouptab' );
$tabs.on( 'click', function () {
var $this = $( this );
@@ -361,15 +353,14 @@
* @param {Object} foundIDs The array in which the keys are IDs of message groups that were found already.
*/
flattenGroupList: function ( messageGroups, foundIDs ) {
- var i, messageGroupList;
-
+ var messageGroupList;
if ( messageGroups.groups ) {
messageGroupList = messageGroups.groups;
} else {
messageGroupList = messageGroups;
}
- for ( i = 0; i < messageGroupList.length; i++ ) {
+ for ( var i = 0; i < messageGroupList.length; i++ ) {
// Avoid duplicate groups, and add the parent before subgroups
if ( !foundIDs[ messageGroupList[ i ].id ] ) {
this.flatGroupList.push( messageGroupList[ i ] );
@@ -393,11 +384,11 @@
var self = this;
this.loadGroups().done( function ( groups ) {
- var currentGroup, index, matcher, foundGroups = [];
+ var foundGroups = [];
if ( !self.flatGroupList ) {
self.flatGroupList = [];
- currentGroup = mw.translate.findGroup( self.parentGroupId, groups );
+ var currentGroup = mw.translate.findGroup( self.parentGroupId, groups );
if ( self.parentGroupId ) {
currentGroup = currentGroup.groups;
}
@@ -406,9 +397,9 @@
// Optimization, assuming that people search the beginning
// of the group name.
- matcher = new RegExp( '\\b' + escapeRegex( query ), 'i' );
+ var matcher = new RegExp( '\\b' + escapeRegex( query ), 'i' );
- for ( index = 0; index < self.flatGroupList.length; index++ ) {
+ for ( var index = 0; index < self.flatGroupList.length; index++ ) {
if ( matcher.test( self.flatGroupList[ index ].label ) ||
query === self.flatGroupList[ index ].id ) {
foundGroups.push( self.flatGroupList[ index ] );
@@ -427,18 +418,17 @@
* @return {jQuery.Promise}
*/
loadGroups: function () {
- var params;
-
if ( groupsLoader !== undefined ) {
return groupsLoader;
}
- params = {
+ var params = {
action: 'query',
meta: 'messagegroups',
mgformat: 'tree',
- mgprop: 'id|label|icon|priority|prioritylangs|priorityforce',
- mgiconsize: '32'
+ mgprop: 'id|label|icon',
+ mgiconsize: '32',
+ mglanguageFilter: this.options.language
};
groupsLoader = new mw.Api()
@@ -458,32 +448,18 @@
*/
addGroupRows: function ( groups ) {
var groupSelector = this,
- $msgGroupRows = [],
- $parent,
- targetLanguage = this.options.language;
+ $msgGroupRows = [];
if ( !groups ) {
return;
}
groups.forEach( function ( group ) {
- /* Hide from the selector:
- * - discouraged groups (the only priority value currently supported).
- * - groups that are recommended for other languages.
- */
- if ( group.priority === 'discouraged' ||
- ( group.priorityforce &&
- group.prioritylangs &&
- group.prioritylangs.indexOf( targetLanguage ) === -1 )
- ) {
- return;
- }
-
$msgGroupRows.push( groupSelector.prepareMessageGroupRow( group ) );
} );
if ( this.parentGroupId ) {
- $parent = this.$list.find( '.tux-grouplist__item[data-msggroupid="' +
+ var $parent = this.$list.find( '.tux-grouplist__item[data-msggroupid="' +
this.parentGroupId + '"]' );
if ( $parent.length ) {
@@ -502,28 +478,21 @@
* @return {Object} a jQuery object with the groups selector row (<div>).
*/
prepareMessageGroupRow: function ( messagegroup ) {
- var $row,
- $icon,
- $label,
- $statsbar,
- $subGroupsLabel,
- style = '';
-
- $row = $( '<div>' )
+ var $row = $( '<div>' )
.addClass( 'row tux-grouplist__item' )
.attr( 'data-msggroupid', messagegroup.id )
.data( 'msggroup', messagegroup );
- $icon = $( '<div>' )
+ var $icon = $( '<div>' )
.addClass( 'tux-grouplist__item__icon' )
.addClass( 'one column' );
- $statsbar = $( '<div>' ).languagestatsbar( {
+ var $statsbar = $( '<div>' ).languagestatsbar( {
language: this.options.language,
group: messagegroup.id
} );
- $label = $( '<div>' )
+ var $label = $( '<div>' )
.addClass( 'tux-grouplist__item__label' )
.addClass( 'seven columns' )
.append(
@@ -534,6 +503,7 @@
$statsbar
);
+ var style = '';
if ( messagegroup.icon && messagegroup.icon.raster ) {
style += 'background-image: url(--);';
style = style.replace( /--/g, messagegroup.icon.raster );
@@ -548,7 +518,7 @@
$icon.attr( 'style', style );
}
- $subGroupsLabel = $( [] );
+ var $subGroupsLabel = $( [] );
if ( messagegroup.groups && messagegroup.groups.length > 0 ) {
$subGroupsLabel = $( '<div>' )
@@ -577,6 +547,17 @@
}
return isSupported;
+ },
+
+ /**
+ * Only shows message groups translatable to given target language
+ *
+ * @param {string} targetLanguage
+ */
+ updateTargetLanguage: function ( targetLanguage ) {
+ this.options.language = targetLanguage;
+ groupsLoader = undefined;
+ this.firstShow = true;
}
};
diff --git a/MLEB/Translate/resources/js/ext.translate.messagerenamedialog.js b/MLEB/Translate/resources/js/ext.translate.messagerenamedialog.js
index 499e1541..40ad5807 100644
--- a/MLEB/Translate/resources/js/ext.translate.messagerenamedialog.js
+++ b/MLEB/Translate/resources/js/ext.translate.messagerenamedialog.js
@@ -19,8 +19,6 @@ mw.translate = mw.translate || {};
* @param {Function} [onRenameSelect] Function to call when the rename button is pressed
*/
mw.translate.MessageRenameDialog = function ( config, onRenameSelect ) {
- var errMsg;
-
// HTML Elements
this.messageSearch = null;
this.searchButton = null;
@@ -36,7 +34,7 @@ mw.translate.MessageRenameDialog = function ( config, onRenameSelect ) {
this.resetProperties();
if ( !onRenameSelect ) {
- errMsg = 'Must provide the "onRenameSelect" callback function.';
+ var errMsg = 'Must provide the "onRenameSelect" callback function.';
mw.log.error( errMsg );
throw new Error( errMsg );
}
@@ -174,13 +172,12 @@ mw.translate.MessageRenameDialog.prototype.getTeardownProcess = function ( data
* @param {Array} messages
*/
mw.translate.MessageRenameDialog.prototype.displayMessages = function ( messages ) {
- var i;
if ( !messages.length ) {
this.displayNotice( mw.msg( 'translate-smg-rename-no-msg' ), 'info' );
return;
}
- for ( i = 0; i < messages.length; i++ ) {
+ for ( var i = 0; i < messages.length; i++ ) {
this.displayMessage( messages[ i ] );
}
};
@@ -191,9 +188,7 @@ mw.translate.MessageRenameDialog.prototype.displayMessages = function ( messages
* @param {Object} message
*/
mw.translate.MessageRenameDialog.prototype.displayMessage = function ( message ) {
- var $title, $content, $container;
-
- $title = $( '<div>' ).append(
+ var $title = $( '<div>' ).append(
$( '<a>' ).text( message.title ).addClass( 'smg-rename-msg-key' )
.prop( 'href', message.link )
.data( 'msg-key', message.key ),
@@ -202,9 +197,9 @@ mw.translate.MessageRenameDialog.prototype.displayMessage = function ( message )
).addClass( 'smg-rename-similarity' )
);
- $content = $( '<div>' ).text( message.content ).addClass( 'smg-rename-msg-content' );
+ var $content = $( '<div>' ).text( message.content ).addClass( 'smg-rename-msg-content' );
- $container = $( '<div>' ).addClass( 'smg-rename-list' );
+ var $container = $( '<div>' ).addClass( 'smg-rename-list' );
$container.append( $title, $content );
@@ -242,11 +237,10 @@ mw.translate.MessageRenameDialog.prototype.resetProperties = function () {
* @return {jQuery.Promise} Resolves after making call to the onRenameSelect function.
*/
mw.translate.MessageRenameDialog.prototype.rename = function () {
- var deferred, promise, renameData;
- deferred = $.Deferred();
- promise = deferred.promise();
+ var deferred = $.Deferred();
+ var promise = deferred.promise();
- renameData = {
+ var renameData = {
groupId: this.currentGroupId,
targetKey: this.targetKey,
selectedKey: this.selectedMessage
@@ -301,11 +295,14 @@ mw.translate.MessageRenameDialog.prototype.filterMessages = function ( searchVal
* Method use to display a notice on the dialog box
*
* @param {string} msg
- * @param {string} type
+ * @param {string} type Type of notice to display.
*/
mw.translate.MessageRenameDialog.prototype.displayNotice = function ( msg, type ) {
var possibleTypes = [ 'info', 'error', 'warning' ];
+ // `type` classes documented above. Will be one of "possibleTypes".
+ // eslint-disable-next-line mediawiki/class-doc
this.$notice.removeClass( possibleTypes.join( ' ' ) );
+ // eslint-disable-next-line mediawiki/class-doc
this.$notice.text( msg ).addClass( type ).removeClass( 'hide' );
this.updateSize();
};
diff --git a/MLEB/Translate/resources/js/ext.translate.messagetable.js b/MLEB/Translate/resources/js/ext.translate.messagetable.js
index 9bea2c33..20da0930 100644
--- a/MLEB/Translate/resources/js/ext.translate.messagetable.js
+++ b/MLEB/Translate/resources/js/ext.translate.messagetable.js
@@ -76,7 +76,7 @@
$filterInput.prop( 'placeholder', mw.msg( 'tux-message-filter-placeholder' ) );
}
- $filterInput.on( 'textchange', $.debounce( 250, function () {
+ $filterInput.on( 'input', $.debounce( 250, function () {
messageTable.search( $filterInput.val() );
} ) );
@@ -142,9 +142,7 @@
* @param {Object} message
*/
addTranslate: function ( message ) {
- var $message,
- targetLangDir, targetLangAttrib,
- targetLangCode = this.$container.data( 'targetlangcode' ),
+ var targetLangCode = this.$container.data( 'targetlangcode' ),
sourceLangCode = this.$container.data( 'sourcelangcode' ),
sourceLangDir = $.uls.data.getDir( sourceLangCode ),
status = message.properties.status,
@@ -175,6 +173,7 @@
statusMsg = 'tux-status-' + status;
}
+ var targetLangDir, targetLangAttrib;
if ( targetLangCode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
targetLangAttrib = mw.config.get( 'wgContentLanguage' );
targetLangDir = $.uls.data.getDir( targetLangAttrib );
@@ -183,7 +182,7 @@
targetLangDir = this.$container.data( 'targetlangdir' );
}
- $message = $( '<div>' )
+ var $message = $( '<div>' )
.addClass( 'row message tux-message-item ' + status )
.append(
$( '<div>' )
@@ -251,9 +250,7 @@
* @param {Object} message
*/
addProofread: function ( message ) {
- var $message, $icon;
-
- $message = $( '<div>' )
+ var $message = $( '<div>' )
.addClass( 'row tux-message tux-message-proofread' );
this.$container.append( $message );
@@ -263,7 +260,7 @@
targetlangcode: this.$container.data( 'targetlangcode' )
} );
- $icon = $message.find( '.tux-proofread-action' );
+ var $icon = $message.find( '.tux-proofread-action' );
if ( $icon.length === 0 ) {
return;
}
@@ -285,14 +282,18 @@
} );
setTimeout( function () {
- var offset, $visibleIcon = $( '.autotooltip:visible' );
+ var $visibleIcon = $( '.autotooltip:visible' );
if ( !$visibleIcon.length ) {
return;
}
- offset = $visibleIcon.offset();
+ var offset = $visibleIcon.offset();
tooltip.$element.appendTo( document.body );
- tooltip.toggle( true ).toggleClipping( false ).togglePositioning( false );
+ tooltip
+ .toggle( true )
+ .toggleClipping( false )
+ .togglePositioning( false )
+ .setAnchorEdge( 'top' );
tooltip.$element.css( {
top: offset.top + $visibleIcon.outerHeight() + 5,
left: offset.left + $visibleIcon.outerWidth() - tooltip.$element.width() / 2 - 15
@@ -311,9 +312,7 @@
* @param {Object} message
*/
addPageModeMessage: function ( message ) {
- var $message;
-
- $message = $( '<div>' )
+ var $message = $( '<div>' )
.addClass( 'row tux-message tux-message-pagemode' );
this.$container.append( $message );
@@ -330,8 +329,7 @@
* @param {string} query
*/
search: function ( query ) {
- var $note, $button, $result,
- resultCount = 0,
+ var resultCount = 0,
matcher = new RegExp( '(^|\\s|\\b)' + escapeRegex( query ), 'gi' );
this.$container.find( itemsClass[ this.mode ] ).each( function () {
@@ -348,12 +346,12 @@
}
} );
- $result = this.$container.find( '.tux-message-filter-result' );
+ var $result = this.$container.find( '.tux-message-filter-result' );
if ( !$result.length ) {
- $note = $( '<div>' )
+ var $note = $( '<div>' )
.addClass( 'advanced-search' );
- $button = $( '<button>' )
+ var $button = $( '<button>' )
.addClass( 'mw-ui-button' )
.text( mw.msg( 'tux-message-filter-advanced-button' ) );
@@ -383,12 +381,13 @@
},
resize: function () {
- var actualWidth = 0, $messageSelector = $( '.row.tux-message-selector' );
+ var $messageSelector = $( '.row.tux-message-selector' );
if ( $messageSelector.is( ':hidden' ) ) {
return;
}
+ var actualWidth = 0;
// Calculate the total width required for the filters
$messageSelector.children( 'li' ).each( function () {
actualWidth += $( this ).outerWidth( true );
@@ -458,9 +457,7 @@
* @param {number} [limit] Only load this many messages and then stop even if there is more.
*/
load: function ( limit ) {
- var remaining,
- query,
- self = this,
+ var self = this,
offset = this.$loader.data( 'offset' ),
pageSize = limit || this.$loader.data( 'pagesize' );
@@ -484,8 +481,7 @@
pageSize,
this.settings.filter
).done( function ( result ) {
- var messages = result.query.messagecollection,
- state, i;
+ var messages = result.query.messagecollection;
if ( !self.loading ) {
// reject. This was cancelled.
@@ -493,7 +489,7 @@
}
if ( result.warnings ) {
- for ( i = 0; i !== result.warnings.length; i++ ) {
+ for ( var i = 0; i !== result.warnings.length; i++ ) {
if ( result.warnings[ i ].code === 'translate-language-disabled-source' ) {
self.handleLoadErrors( [ result.warnings[ i ] ] );
break;
@@ -519,7 +515,7 @@
}
} );
- state = result.query.metadata && result.query.metadata.state;
+ var state = result.query.metadata && result.query.metadata.state;
$( '.tux-workflow' ).workflowselector(
self.settings.group,
self.settings.language,
@@ -527,7 +523,7 @@
).removeClass( 'hide' );
// Dynamically loaded messages should pass the search filter if present.
- query = $( '.tux-message-filter-box' ).val();
+ var query = $( '.tux-message-filter-box' ).val();
if ( query ) {
self.search( query );
@@ -544,7 +540,7 @@
} else {
self.$loader.data( 'offset', result[ 'query-continue' ].messagecollection.mcoffset );
- remaining = result.query.metadata.remaining;
+ var remaining = result.query.metadata.remaining;
self.$loaderInfo.text(
mw.msg( 'tux-messagetable-more-messages', remaining )
@@ -680,7 +676,7 @@
$actions.append( messageTable.otherActionButton(
'tux-empty-list-translated-action',
function () {
- mw.translate.changeFilter( $( '.tux-tab-untranslated' ).trigger( 'click' ) );
+ $( '.tux-tab-untranslated' ).trigger( 'click' );
} )
);
} else {
@@ -717,10 +713,7 @@
switchMode: function ( mode ) {
var messageTable = this,
filter = this.settings.filter,
- userId = mw.config.get( 'wgUserId' ),
- $tuxTabUntranslated,
- $tuxTabUnproofread,
- $hideTranslatedButton;
+ userId = mw.config.get( 'wgUserId' );
messageTable.$actionBar.find( '.tux-view-switcher .down' ).removeClass( 'down' );
if ( mode === 'translate' ) {
@@ -742,9 +735,9 @@
messageTable.$container.empty();
$( '.translate-tooltip' ).remove();
- $tuxTabUntranslated = $( '.tux-message-selector > .tux-tab-untranslated' );
- $tuxTabUnproofread = $( '.tux-message-selector > .tux-tab-unproofread' );
- $hideTranslatedButton = messageTable.$actionBar.find( '.tux-editor-clear-translated' );
+ var $tuxTabUntranslated = $( '.tux-message-selector > .tux-tab-untranslated' );
+ var $tuxTabUnproofread = $( '.tux-message-selector > .tux-tab-unproofread' );
+ var $hideTranslatedButton = messageTable.$actionBar.find( '.tux-editor-clear-translated' );
if ( messageTable.mode === 'proofread' ) {
$tuxTabUntranslated.addClass( 'hide' );
@@ -798,30 +791,20 @@
* The scroll handler
*/
scroll: function () {
- var $window,
- isActionBarFloating,
- needsTableHeaderFloat, needsTableHeaderStick,
- needsActionBarFloat, needsActionBarStick,
- windowScrollTop, windowScrollBottom,
- messageTableRelativePos,
- messageListOffset,
- messageListHeight, messageListWidth,
- messageListTop, messageListBottom;
-
- $window = $( window );
-
- windowScrollTop = $window.scrollTop();
- windowScrollBottom = windowScrollTop + $window.height();
- messageListOffset = this.$container.offset();
- messageListHeight = this.$container.height();
- messageListTop = messageListOffset.top;
- messageListBottom = messageListTop + messageListHeight;
- messageListWidth = this.$container.width();
+ var $window = $( window );
+
+ var windowScrollTop = $window.scrollTop();
+ var windowScrollBottom = windowScrollTop + $window.height();
+ var messageListOffset = this.$container.offset();
+ var messageListHeight = this.$container.height();
+ var messageListTop = messageListOffset.top;
+ var messageListBottom = messageListTop + messageListHeight;
+ var messageListWidth = this.$container.width();
// Header:
- messageTableRelativePos = messageListTop - this.$header.height() - windowScrollTop;
- needsTableHeaderFloat = messageTableRelativePos + 10 < 0;
- needsTableHeaderStick = messageTableRelativePos - 10 >= 0;
+ var messageTableRelativePos = messageListTop - this.$header.height() - windowScrollTop;
+ var needsTableHeaderFloat = messageTableRelativePos + 10 < 0;
+ var needsTableHeaderStick = messageTableRelativePos - 10 >= 0;
if ( needsTableHeaderFloat ) {
this.$header.addClass( 'floating' ).width( messageListWidth );
} else if ( needsTableHeaderStick ) {
@@ -830,9 +813,9 @@
}
// Action bar:
- isActionBarFloating = this.$actionBar.hasClass( 'floating' );
- needsActionBarFloat = windowScrollBottom < messageListBottom;
- needsActionBarStick = windowScrollBottom > ( messageListBottom + this.$actionBar.height() );
+ var isActionBarFloating = this.$actionBar.hasClass( 'floating' );
+ var needsActionBarFloat = windowScrollBottom < messageListBottom;
+ var needsActionBarStick = windowScrollBottom > ( messageListBottom + this.$actionBar.height() );
if ( !isActionBarFloating && needsActionBarFloat ) {
this.$actionBar.addClass( 'floating' ).width( messageListWidth );
@@ -905,13 +888,12 @@
}
function isLoaderVisible( $loader ) {
- var viewportBottom, elementTop,
- $window = $( window );
+ var $window = $( window );
- viewportBottom = ( window.innerHeight ? window.innerHeight : $window.height() ) +
+ var viewportBottom = ( window.innerHeight ? window.innerHeight : $window.height() ) +
$window.scrollTop();
- elementTop = $loader.offset().top;
+ var elementTop = $loader.offset().top;
// Start already if user is reaching close to the bottom
return elementTop - viewportBottom < 200;
diff --git a/MLEB/Translate/resources/js/ext.translate.navitoggle.js b/MLEB/Translate/resources/js/ext.translate.navitoggle.js
index 69d173d8..b421893d 100644
--- a/MLEB/Translate/resources/js/ext.translate.navitoggle.js
+++ b/MLEB/Translate/resources/js/ext.translate.navitoggle.js
@@ -18,19 +18,17 @@
}
$( function () {
- var $miniLogo, $toggle, rtl, delim;
-
- rtl = $body.hasClass( 'rtl' );
- delim = rtl ?
+ var rtl = $body.hasClass( 'rtl' );
+ var delim = rtl ?
$( '#mw-head-base' ).css( 'margin-right' ) :
$( '#mw-head-base' ).css( 'margin-left' );
- $miniLogo = $( '#p-logo' )
+ var $miniLogo = $( '#p-logo' )
.clone()
.removeAttr( 'id' )
.addClass( 'tux-navi-minilogo' );
- $toggle = $( '<div>' )
+ var $toggle = $( '<div>' )
.addClass( 'tux-navitoggle' )
.css( rtl ? 'right' : 'left', delim )
.on( 'click', function () {
diff --git a/MLEB/Translate/resources/js/ext.translate.pagemode.js b/MLEB/Translate/resources/js/ext.translate.pagemode.js
index 9c03ce9f..fb668a73 100644
--- a/MLEB/Translate/resources/js/ext.translate.pagemode.js
+++ b/MLEB/Translate/resources/js/ext.translate.pagemode.js
@@ -1,5 +1,6 @@
( function () {
'use strict';
+
/**
* Page mode plugin
*
@@ -35,50 +36,56 @@
* Initialize the plugin
*/
init: function () {
- var pagemode = this;
+ var that = this;
this.message.proofreadable = false;
this.render();
- pagemode.$message.translateeditor( {
- message: pagemode.message,
+ this.$message.translateeditor( {
+ message: this.message,
beforeSave: function ( translation ) {
- pagemode.$message.find( '.tux-pagemode-translation' )
- .html( mw.translate.formatMessageGently( translation || '', pagemode.message.key ) )
+ that.$message.find( '.tux-pagemode-translation' )
+ .html( mw.translate.formatMessageGently( translation || '', that.message.key ) )
.addClass( 'highlight' );
},
onSave: function ( translation ) {
- pagemode.$message.find( '.tux-pagemode-translation' )
+ that.$message.find( '.tux-pagemode-translation' )
.removeClass( 'highlight' );
- pagemode.message.translation = translation;
+ that.message.translation = translation;
- pagemode.$message.find( '.tux-pagemode-status' )
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
+ that.$message.find( '.tux-pagemode-status' )
.removeClass( 'translated fuzzy proofread untranslated' )
- .addClass( pagemode.message.properties.status );
+ .addClass( that.message.properties.status );
}
} );
},
render: function () {
- var targetLangAttrib, targetLangDir,
- sourceLangDir = $.uls.data.getDir( this.options.sourcelangcode );
+ var sourceLangDir = $.uls.data.getDir( this.options.sourcelangcode );
- if ( this.options.targetlangcode ===
- mw.config.get( 'wgTranslateDocumentationLanguageCode' )
- ) {
+ var targetLangAttrib;
+ if ( this.options.targetlangcode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
targetLangAttrib = mw.config.get( 'wgContentLanguage' );
} else {
targetLangAttrib = this.options.targetlangcode;
}
- targetLangDir = $.uls.data.getDir( targetLangAttrib );
+ var targetLangDir = $.uls.data.getDir( targetLangAttrib );
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
this.$message.append(
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
$( '<div>' )
.addClass( 'row tux-message-item-compact message ' + this.message.properties.status )
.append(
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
$( '<div>' )
.addClass( 'one column tux-pagemode-status ' + this.message.properties.status ),
$( '<div>' )
@@ -106,10 +113,10 @@
* Attach event listeners
*/
listen: function () {
- var pagemode = this;
+ var that = this;
this.$message.children( '.message' ).on( 'click', function ( e ) {
- pagemode.$message.data( 'translateeditor' ).show();
+ that.$message.data( 'translateeditor' ).show();
e.preventDefault();
} );
}
diff --git a/MLEB/Translate/resources/js/ext.translate.pagetranslation.uls.js b/MLEB/Translate/resources/js/ext.translate.pagetranslation.uls.js
index a0bfc2d4..9c54557d 100644
--- a/MLEB/Translate/resources/js/ext.translate.pagetranslation.uls.js
+++ b/MLEB/Translate/resources/js/ext.translate.pagetranslation.uls.js
@@ -2,9 +2,7 @@
'use strict';
mw.uls.changeLanguage = function ( language ) {
- var page;
-
- page = 'Special:MyLanguage/' + mw.config.get( 'wgPageName' );
+ var page = 'Special:MyLanguage/' + mw.config.get( 'wgPageName' );
if ( mw.config.get( 'wgTranslatePageTranslation' ) === 'translation' ) {
page = page.replace( /\/[^/]+$/, '' );
diff --git a/MLEB/Translate/resources/js/ext.translate.parsers.js b/MLEB/Translate/resources/js/ext.translate.parsers.js
index 393a76bb..655bf5b1 100644
--- a/MLEB/Translate/resources/js/ext.translate.parsers.js
+++ b/MLEB/Translate/resources/js/ext.translate.parsers.js
@@ -19,8 +19,7 @@
* @return {string} Formatted text in html
*/
formatMessageGently: function ( text, key ) {
- var externals,
- protocols = mw.config.get( 'wgUrlProtocols' );
+ var protocols = mw.config.get( 'wgUrlProtocols' );
// Try to keep simple.
text = $( '<div>' ).text( text ).html();
@@ -59,7 +58,7 @@
return $( '<div>' ).append( $link ).html();
} );
- externals = new RegExp( '\\[((' + protocols + ')[^ ]+) (.+?)\\]', 'g' );
+ var externals = new RegExp( '\\[((' + protocols + ')[^ ]+) (.+?)\\]', 'g' );
text = text.replace( externals, function ( match, p1, p2, p3 ) {
var $link = $( '<a>' ).html( p3 ).prop( 'href', p1 );
return $( '<div>' ).append( $link ).html();
diff --git a/MLEB/Translate/resources/js/ext.translate.proofread.js b/MLEB/Translate/resources/js/ext.translate.proofread.js
index ad3791af..2513ef1f 100644
--- a/MLEB/Translate/resources/js/ext.translate.proofread.js
+++ b/MLEB/Translate/resources/js/ext.translate.proofread.js
@@ -3,6 +3,7 @@
/**
* Proofread Plugin
+ *
* Prepare a proofread UI with all the required actions
* for a translation unit (message).
* This is mainly used with the messagetable plugin in proofread mode,
@@ -35,7 +36,7 @@
* Initialize the plugin
*/
init: function () {
- var proofread = this;
+ var that = this;
this.render();
@@ -53,52 +54,49 @@
this.disableProofread();
}
- proofread.$message.translateeditor( {
- message: proofread.message,
+ this.$message.translateeditor( {
+ message: this.message,
onSave: function ( translation ) {
- proofread.$message.find( '.tux-proofread-translation' )
+ that.$message.find( '.tux-proofread-translation' )
.text( translation );
- proofread.message.translation = translation;
- proofread.markSelfTranslation();
+ that.message.translation = translation;
+ that.markSelfTranslation();
- proofread.$message.find( '.tux-proofread-status' )
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
+ that.$message.find( '.tux-proofread-status' )
.removeClass( 'translated fuzzy proofread untranslated' )
- .addClass( proofread.message.properties.status );
+ .addClass( that.message.properties.status );
}
} );
},
render: function () {
- var targetLangCode, targetLangDir, targetLangAttrib,
- sourceLangCode, sourceLangDir,
- $proofreadAction, $proofreadEdit, userId, reviewers, otherReviewers,
- translatedBySelf, proofreadBySelf;
-
// List of all reviewers
- reviewers = this.message.properties.reviewers || [];
+ var reviewers = this.message.properties.reviewers || [];
// The id of the current user, converted to string as the are in reviewers
- userId = String( mw.config.get( 'wgUserId' ) );
+ var userId = String( mw.config.get( 'wgUserId' ) );
// List of all reviewers excluding the current user.
- otherReviewers = reviewers.filter( function ( element ) {
+ var otherReviewers = reviewers.filter( function ( element ) {
return element !== userId;
} );
/* Whether the current user if the last translator of this message.
* Accepting own translations is prohibited. */
- translatedBySelf = ( this.message.properties[ 'last-translator-text' ] === mw.user.getName() );
- proofreadBySelf = reviewers.indexOf( userId ) > -1;
+ var translatedBySelf = ( this.message.properties[ 'last-translator-text' ] === mw.user.getName() );
+ var proofreadBySelf = reviewers.indexOf( userId ) > -1;
- sourceLangCode = this.options.sourcelangcode;
- sourceLangDir = $.uls.data.getDir( sourceLangCode );
- targetLangCode = this.options.targetlangcode;
+ var sourceLangDir = $.uls.data.getDir( this.options.sourcelangcode );
- $proofreadAction = $( '<div>' )
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
+ var $proofreadAction = $( '<div>' )
.attr( 'title', mw.msg( 'tux-proofread-action-tooltip' ) )
.addClass(
'tux-proofread-action ' + this.message.properties.status + ' ' + ( proofreadBySelf ? 'accepted' : '' )
);
- $proofreadEdit = $( '<div>' )
+ var $proofreadEdit = $( '<div>' )
.addClass( 'tux-proofread-edit' )
.append( $( '<span>' )
.addClass( 'tux-proofread-edit-label hide' )
@@ -111,23 +109,29 @@
$( this ).find( '.tux-proofread-edit-label' ).addClass( 'hide' );
} );
- if ( targetLangCode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
+ var targetLangAttrib;
+ if ( this.options.targetlangcode === mw.config.get( 'wgTranslateDocumentationLanguageCode' ) ) {
targetLangAttrib = mw.config.get( 'wgContentLanguage' );
} else {
- targetLangAttrib = targetLangCode;
+ targetLangAttrib = this.options.targetlangcode;
}
- targetLangDir = $.uls.data.getDir( targetLangAttrib );
+ var targetLangDir = $.uls.data.getDir( targetLangAttrib );
+
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
this.$message.append(
$( '<div>' )
.addClass( 'row tux-message-item-compact message' )
.append(
+ // `status` class is documented elsewhere
+ // eslint-disable-next-line mediawiki/class-doc
$( '<div>' )
.addClass( 'one column tux-proofread-status ' + this.message.properties.status ),
$( '<div>' )
.addClass( 'five columns tux-proofread-source' )
.attr( {
- lang: sourceLangCode,
+ lang: this.options.sourcelangcode,
dir: sourceLangDir
} )
.text( this.message.definition ),
@@ -195,12 +199,11 @@
* Mark this message as proofread.
*/
proofread: function () {
- var reviews, $counter, params,
- message = this.message,
+ var message = this.message,
$message = this.$message,
api = new mw.Api();
- params = {
+ var params = {
action: 'translationreview',
revision: this.message.properties.revision
};
@@ -214,8 +217,8 @@
.removeClass( 'tux-notice' ) // in case, it failed previously
.addClass( 'accepted' );
- $counter = $message.find( '.tux-proofread-count' );
- reviews = $counter.data( 'reviewCount' );
+ var $counter = $message.find( '.tux-proofread-count' );
+ var reviews = $counter.data( 'reviewCount' );
$counter.text( mw.language.convertNumber( reviews + 1 ) );
// Update stats
@@ -242,17 +245,17 @@
* Attach event listeners
*/
listen: function () {
- var proofread = this;
+ var that = this;
this.$message.find( '.tux-proofread-action' ).on( 'click', function () {
- proofread.proofread();
+ that.proofread();
return false;
} );
this.$message.find( '.tux-proofread-edit' ).on( 'click', function () {
// Make sure that the tooltip is hidden when going to the editor
$( '.translate-tooltip' ).remove();
- proofread.$message.data( 'translateeditor' ).show();
+ that.$message.data( 'translateeditor' ).show();
return false;
} );
diff --git a/MLEB/Translate/resources/js/ext.translate.selecttoinput.js b/MLEB/Translate/resources/js/ext.translate.selecttoinput.js
index 71253bb4..a27fd903 100644
--- a/MLEB/Translate/resources/js/ext.translate.selecttoinput.js
+++ b/MLEB/Translate/resources/js/ext.translate.selecttoinput.js
@@ -3,14 +3,13 @@ $( function () {
'use strict';
var select = document.getElementById( selectid ),
- target = document.getElementById( targetid ),
- atxt;
+ target = document.getElementById( targetid );
if ( !target || !select ) {
return;
}
- atxt = select.options[ select.selectedIndex ].value;
+ var atxt = select.options[ select.selectedIndex ].value;
if ( !atxt ) {
return;
diff --git a/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js b/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js
index 41d4ac0a..cac1edd8 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.aggregategroups.js
@@ -9,15 +9,14 @@
}
function dissociate( event ) {
- var params,
- $target = $( event.target ),
+ var $target = $( event.target ),
api = new mw.Api();
function successFunction() {
$target.parent( 'li' ).remove();
}
- params = $.extend( getApiParams( $target ), {
+ var params = $.extend( getApiParams( $target ), {
do: 'dissociate',
group: $target.data( 'groupid' )
} );
@@ -31,14 +30,14 @@
}
function associate( event, resp ) {
- var successFunction, params, subgroupId, i,
- $target = $( event.target ),
+ var $target = $( event.target ),
$parent = $target.parents( '.mw-tpa-group' ),
parentId = $parent.data( 'id' ),
subgroupName = $parent.children( '.tp-group-input' ).val(),
api = new mw.Api();
- successFunction = function () {
+ var subgroupId;
+ var successFunction = function () {
var aAttr, $a, spanAttr, $span, $ol;
aAttr = {
@@ -63,7 +62,7 @@
// Get the label for the value and make API request if valid
subgroupId = '';
- for ( i = 0; i < resp.length; ++i ) {
+ for ( var i = 0; i < resp.length; ++i ) {
if ( subgroupName === resp[ i ].label ) {
subgroupId = resp[ i ].id;
break;
@@ -71,7 +70,7 @@
}
if ( subgroupId ) {
- params = $.extend( getApiParams( $target ), {
+ var params = $.extend( getApiParams( $target ), {
do: 'associate',
group: subgroupId
} );
@@ -89,8 +88,7 @@
}
function removeGroup( event ) {
- var params,
- $target = $( event.target ),
+ var $target = $( event.target ),
api = new mw.Api();
function successFunction() {
@@ -101,7 +99,7 @@
if ( typeof window.confirm === 'function' &&
// eslint-disable-next-line no-alert
window.confirm( mw.msg( 'tpt-aggregategroup-remove-confirm' ) ) ) {
- params = $.extend( getApiParams( $target ), {
+ var params = $.extend( getApiParams( $target ), {
do: 'remove'
} );
@@ -120,15 +118,13 @@
aggregateGroupId = $parent.data( 'groupid' ),
$displayGroup = $parent.children( '.tp-display-group' ),
$editGroup = $parent.children( '.tp-edit-group' ),
- successFunction,
- params,
$aggGroupNameInputName = $editGroup.children( 'input.tp-aggregategroup-edit-name' ),
$aggGroupNameInputDesc = $editGroup.children( 'input.tp-aggregategroup-edit-description' ),
aggregateGroupName = $aggGroupNameInputName.val(),
aggregateGroupDesc = $aggGroupNameInputDesc.val(),
api = new mw.Api();
- successFunction = function () {
+ var successFunction = function () {
// Replace the text by the new text without altering the other 2 span tags
$displayGroup.children( '.tp-name' ).contents().filter( function () {
return this.nodeType === 3;
@@ -138,7 +134,7 @@
$editGroup.addClass( 'hidden' );
};
- params = {
+ var params = {
action: 'aggregategroups',
do: 'update',
groupname: aggregateGroupName,
@@ -162,13 +158,12 @@
}
$( function () {
- var excludeFunction, autocompleteFunction, resp,
- api = new mw.Api(),
+ var api = new mw.Api(),
exclude = [],
groups = [],
$input = $( '.tp-group-input' );
- excludeFunction = function ( event ) {
+ var excludeFunction = function ( event ) {
exclude = [];
if ( groups.length === 0 ) {
@@ -196,7 +191,8 @@
);
};
- autocompleteFunction = function ( request, response ) {
+ var resp;
+ var autocompleteFunction = function ( request, response ) {
// Allow case insensitive search
var inp = new RegExp( request.term, 'i' );
@@ -245,8 +241,7 @@
} );
$( '#tpt-aggregategroups-save' ).on( 'click', function () {
- var successFunction, params,
- $aggGroupNameInputName = $( 'input.tp-aggregategroup-add-name' ),
+ var $aggGroupNameInputName = $( 'input.tp-aggregategroup-add-name' ),
$aggGroupNameInputDesc = $( 'input.tp-aggregategroup-add-description' ),
aggregateGroupName = $aggGroupNameInputName.val(),
aggregateGroupDesc = $aggGroupNameInputDesc.val();
@@ -256,36 +251,34 @@
$aggGroupNameInputName.val( '' );
$aggGroupNameInputDesc.val( '' );
- successFunction = function ( data ) {
- var $removeSpan, $editSpan, $displayHeader, $div, $groupSelector, $addButton,
- $cancelButton, $divDisplay, $divEdit, $saveButton,
- aggregateGroupId = data.aggregategroups.aggregategroupId;
+ var successFunction = function ( data ) {
+ var aggregateGroupId = data.aggregategroups.aggregategroupId;
- $removeSpan = $( '<span>' ).attr( 'id', aggregateGroupId )
+ var $removeSpan = $( '<span>' ).attr( 'id', aggregateGroupId )
.addClass( 'tp-aggregate-remove-ag-button' );
- $editSpan = $( '<span>' ).attr( 'id', aggregateGroupId )
+ var $editSpan = $( '<span>' ).attr( 'id', aggregateGroupId )
.addClass( 'tp-aggregate-edit-ag-button' );
// Prints the name and the two spans in a single row
- $displayHeader = $( '<h2>' ).addClass( 'tp-name' ).text( aggregateGroupName )
+ var $displayHeader = $( '<h2>' ).addClass( 'tp-name' ).text( aggregateGroupName )
.append( $editSpan, $removeSpan );
- $divDisplay = $( '<div>' ).addClass( 'tp-display-group' )
+ var $divDisplay = $( '<div>' ).addClass( 'tp-display-group' )
.append( $displayHeader )
.append( $( '<p>' ).addClass( 'tp-desc' ).text( aggregateGroupDesc ) );
- $saveButton = $( '<input>' )
+ var $saveButton = $( '<input>' )
.attr( {
type: 'button',
class: 'tp-aggregategroup-update'
} )
.val( mw.msg( 'tpt-aggregategroup-update' ) );
- $cancelButton = $( '<input>' )
+ var $cancelButton = $( '<input>' )
.attr( {
type: 'button',
class: 'tp-aggregategroup-update-cancel'
} )
.val( mw.msg( 'tpt-aggregategroup-update-cancel' ) );
- $divEdit = $( '<div>' )
+ var $divEdit = $( '<div>' )
.addClass( 'tp-edit-group hidden' )
.append( $( '<label>' )
.text( mw.msg( 'tpt-aggregategroup-edit-name' ) ) )
@@ -310,14 +303,14 @@
)
.append( $saveButton, $cancelButton );
- $div = $( '<div>' ).addClass( 'mw-tpa-group' )
+ var $div = $( '<div>' ).addClass( 'mw-tpa-group' )
.append( $divDisplay, $divEdit )
.append( $( '<ol id=\'mw-tpa-grouplist-' + aggregateGroupId + '\'>' ) );
$div.data( 'groupid', aggregateGroupId );
$div.data( 'id', aggregateGroupId );
- $groupSelector = $( '<input>' ).attr( {
+ var $groupSelector = $( '<input>' ).attr( {
type: 'text',
class: 'tp-group-input'
} );
@@ -329,7 +322,7 @@
// Enable showing all groups when nothing is entered
$( this ).autocomplete( 'search', $( this ).val() );
} );
- $addButton = $( '<input>' )
+ var $addButton = $( '<input>' )
.attr( {
type: 'button',
class: 'tp-aggregate-add-button',
@@ -353,7 +346,7 @@
$( 'a.tpt-add-new-group' ).before( $div );
};
- params = {
+ var params = {
action: 'aggregategroups',
do: 'add',
groupname: aggregateGroupName,
diff --git a/MLEB/Translate/resources/js/ext.translate.special.languagestats.js b/MLEB/Translate/resources/js/ext.translate.special.languagestats.js
index 00daca44..9ebe93f4 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.languagestats.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.languagestats.js
@@ -13,6 +13,8 @@
/**
* Add css class to every other visible row.
* It's not possible to do zebra colors with CSS only if there are hidden rows.
+ *
+ * @param {jQuery} $table
*/
function doZebra( $table ) {
$table.find( 'tr:visible:odd' ).toggleClass( 'tux-statstable-even', false );
@@ -20,8 +22,7 @@
}
function addExpanders( $table ) {
- var $allChildRows, $allTogglesCache, $toggleAllButton,
- $metaRows = $( 'tr.AggregateMessageGroup', $table );
+ var $metaRows = $( 'tr.AggregateMessageGroup', $table );
// Quick return
if ( !$metaRows.length ) {
@@ -29,8 +30,7 @@
}
$metaRows.each( function () {
- var $toggler,
- $parent = $( this ),
+ var $parent = $( this ),
thisGroupId = $parent.attr( 'data-groupid' ),
$children = $( 'tr[data-parentgroup="' + thisGroupId + '"]', $table );
@@ -40,7 +40,7 @@
}
// Build toggle link
- $toggler = $( '<span>' ).addClass( 'groupexpander collapsed' )
+ var $toggler = $( '<span>' ).addClass( 'groupexpander collapsed' )
.append(
'[',
$( '<a>' )
@@ -80,9 +80,9 @@
} );
// Create, bind and append the toggle-all button
- $allChildRows = $( 'tr[data-parentgroup]', $table );
- $allTogglesCache = null;
- $toggleAllButton = $( '<span>' ).addClass( 'collapsed' )
+ var $allChildRows = $( 'tr[data-parentgroup]', $table );
+ var $allTogglesCache = null;
+ var $toggleAllButton = $( '<span>' ).addClass( 'collapsed' )
.append(
'[',
$( '<a>' )
@@ -121,13 +121,12 @@
}
function applySorting( $table ) {
- var index,
- sort = {},
+ var sort = {},
re = /#sortable:(\d+)=(asc|desc)/,
match = re.exec( location.hash );
if ( match ) {
- index = parseInt( match[ 1 ], 10 );
+ var index = parseInt( match[ 1 ], 10 );
sort[ index ] = match[ 2 ];
}
$table.tablesorter( { sortList: [ sort ] } );
@@ -144,8 +143,7 @@
}
function narrowTable( $table, enable ) {
- var $select,
- labelColumnCount = 1,
+ var labelColumnCount = 1,
// 0-indexed
defaultValueColumn = 2;
@@ -155,7 +153,7 @@
} );
}
- $select = makeValueColumnSelector( $columns, labelColumnCount, defaultValueColumn );
+ var $select = makeValueColumnSelector( $columns, labelColumnCount, defaultValueColumn );
// Prevent table sorter from making the select inaccessible
$select.on( 'mousedown click', function ( e ) {
e.stopPropagation();
@@ -176,9 +174,9 @@
}
function makeValueColumnSelector( headings, skip, def ) {
- var i, $select = $( '<select>' );
+ var $select = $( '<select>' );
- for ( i = skip; i < headings.length; i++ ) {
+ for ( var i = skip; i < headings.length; i++ ) {
$( '<option>' )
.text( headings[ i ] )
.val( i )
@@ -190,21 +188,18 @@
}
function showValueColumn( $table, $select, skip ) {
- var i, index, cssQuery;
-
- index = parseInt( $select.val(), 10 );
- cssQuery = 'th:nth-child(_)'.replace( '_', index + 1 );
+ var index = parseInt( $select.val(), 10 );
+ var cssQuery = 'th:nth-child(_)'.replace( '_', index + 1 );
$table.find( cssQuery ).html( $select );
- for ( i = 0; i < $select.children().length; i++ ) {
+ for ( var i = 0; i < $select.children().length; i++ ) {
cssQuery = 'tr > *:nth-child(_)'.replace( '_', i + skip + 1 );
$table.find( cssQuery ).toggleClass( 'statstable-hide', i + skip !== index );
}
}
$( function () {
- var isNarrowMode, minimumTableWidth,
- $table = $( '.statstable' );
+ var $table = $( '.statstable' );
// Sometimes the table is not present on the page
if ( !$table.length ) {
@@ -223,19 +218,20 @@
return;
}
+ var minimumTableWidth;
// Hopefully previous stuff have time to render by now to have accurate picture of the width
( window.requestAnimationFrame || setTimeout )( function () {
minimumTableWidth = $table.outerWidth();
$table.css( 'max-width', '' );
} );
+ var isNarrowMode;
new ResizeObserver( function ( entries ) {
- var newMode, shouldCollapse, shouldExpand;
-
- shouldCollapse = entries[ 0 ].contentRect.width < minimumTableWidth;
+ var shouldCollapse = entries[ 0 ].contentRect.width < minimumTableWidth;
// Some fudge to avoid flapping
- shouldExpand = entries[ 0 ].contentRect.width - 20 > minimumTableWidth;
+ var shouldExpand = entries[ 0 ].contentRect.width - 20 > minimumTableWidth;
+ var newMode;
if ( isNarrowMode && shouldExpand ) {
newMode = false;
} else if ( !isNarrowMode && shouldCollapse ) {
diff --git a/MLEB/Translate/resources/js/ext.translate.special.managegroups.js b/MLEB/Translate/resources/js/ext.translate.special.managegroups.js
index 9337ed5f..c796467d 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.managegroups.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.managegroups.js
@@ -3,17 +3,15 @@
GroupSynchronization;
$( function () {
- var windowManager, renameDialog;
-
RenameDropdown.init();
GroupSynchronization.init();
// Create and append a window manager.
- windowManager = new OO.ui.WindowManager();
+ var windowManager = new OO.ui.WindowManager();
windowManager.$element.appendTo( document.body );
// Create a new process dialog window.
- renameDialog = new mw.translate.MessageRenameDialog( {
+ var renameDialog = new mw.translate.MessageRenameDialog( {
classes: [ 'smg-rename-dialog' ],
size: 'large'
}, function ( renameParams ) {
@@ -38,9 +36,8 @@
* Attach the click handler to display the rename dropdown.
*/
$( '#mw-content-text' ).on( 'click', '.smg-rename-actions', function ( event ) {
- var $target, $parentContainer;
- $target = $( event.target );
- $parentContainer = $target.parents( '.mw-translate-smg-change' );
+ var $target = $( event.target );
+ var $parentContainer = $target.parents( '.mw-translate-smg-change' );
RenameDropdown.appendTo( event.target, $parentContainer, {
groupId: $target.data( 'groupId' ),
msgKey: $target.data( 'msgkey' ),
@@ -142,8 +139,8 @@
* @return {jQuery.Promise}
*/
function getRenames( groupId, msgKey ) {
- var params, api = new mw.Api(), changesetName;
- params = {
+ var api = new mw.Api();
+ var params = {
action: 'query',
meta: 'managemessagegroups',
formatversion: 2,
@@ -151,7 +148,7 @@
mmgmessageKey: msgKey
};
- changesetName = getChangesetName();
+ var changesetName = getChangesetName();
if ( changesetName !== null ) {
params.mmgchangesetName = changesetName;
}
@@ -167,10 +164,9 @@
* @return {string}
*/
function getChangesetName() {
- var locationPaths, suffix, pageTitle;
- locationPaths = window.location.pathname.split( '/' );
- suffix = locationPaths.pop();
- pageTitle = $( '#smgPageTitle' ).val();
+ var locationPaths = window.location.pathname.split( '/' );
+ var suffix = locationPaths.pop();
+ var pageTitle = $( '#smgPageTitle' ).val();
if ( suffix && suffix.indexOf( pageTitle ) === -1 ) {
return suffix;
@@ -199,9 +195,9 @@
* @return {jQuery.Promise}
*/
function setRename( renameParams ) {
- var params, api = new mw.Api(), changesetName;
+ var api = new mw.Api();
- params = {
+ var params = {
action: 'managemessagegroups',
groupId: renameParams.groupId,
renameMessageKey: renameParams.selectedKey,
@@ -212,7 +208,7 @@
formatversion: 2
};
- changesetName = getChangesetName();
+ var changesetName = getChangesetName();
if ( changesetName !== null ) {
params.changesetName = changesetName;
}
@@ -227,9 +223,9 @@
* @return {jQuery.Promise}
*/
function setAsNew( groupId, msgKey ) {
- var params, api = new mw.Api(), changesetName;
+ var api = new mw.Api();
- params = {
+ var params = {
action: 'managemessagegroups',
groupId: groupId,
messageKey: msgKey,
@@ -239,7 +235,7 @@
formatversion: 2
};
- changesetName = getChangesetName();
+ var changesetName = getChangesetName();
if ( changesetName !== null ) {
params.changesetName = changesetName;
}
@@ -406,9 +402,9 @@
}
function markAsResolved( operation, groupId, messageTitle ) {
- var params, api = new mw.Api();
+ var api = new mw.Api();
- params = {
+ var params = {
action: 'managegroupsynchronizationcache',
group: groupId,
operation: operation,
diff --git a/MLEB/Translate/resources/js/ext.translate.special.managetranslatorsandbox.js b/MLEB/Translate/resources/js/ext.translate.special.managetranslatorsandbox.js
index e5986e1a..76b605b9 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.managetranslatorsandbox.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.managetranslatorsandbox.js
@@ -34,14 +34,13 @@
}
function removeSelectedRequests() {
- var $nextRequest,
- $selectedRequests = $( '.request-selector:checked' );
+ var $selectedRequests = $( '.request-selector:checked' );
- $nextRequest = $selectedRequests
+ var $nextRequest = $selectedRequests
.first() // First selected request
.closest( '.request' ) // The request corresponds that checkbox
.prevAll( ':not(.hide)' ) // Go back till a non-hidden request
- .first(); // The above selecter gives list from bottom to top. Select the bottom one.
+ .first(); // The above selector gives list from bottom to top. Select the bottom one.
$selectedRequests.closest( '.request' ).remove();
@@ -67,8 +66,7 @@
* @param {Object} request The request data set from backend on request items
*/
function displayRequestDetails( request ) {
- var storage,
- $reminderStatus = $( '<span>' ).addClass( 'reminder-status' ),
+ var $reminderStatus = $( '<span>' ).addClass( 'reminder-status' ),
$detailsPane = $( '.details.pane' );
if ( request.reminderscount ) {
@@ -182,14 +180,27 @@
}
}
- // @todo: move higher in the tree
- storage = new mw.translate.TranslationStashStorage();
- storage.getUserTranslations( request.username ).done( showTranslations );
+ getUserTranslations( request.username ).done( showTranslations );
+ }
+
+ /**
+ * Get the current users translations.
+ *
+ * @param {string} user User name
+ * @return {jQuery.Promise}
+ */
+ function getUserTranslations( user ) {
+ var api = new mw.Api();
+
+ return api.postWithToken( 'csrf', {
+ action: 'translationstash',
+ subaction: 'query',
+ username: user
+ } );
}
function showTranslations( translations ) {
- var gender,
- $target = $( '.translations' );
+ var $target = $( '.translations' );
$target.empty();
@@ -204,7 +215,7 @@
return;
}
- gender = $( '.requests-list .request.selected' ).data( 'data' ).gender;
+ var gender = $( '.requests-list .request.selected' ).data( 'data' ).gender;
$target.append(
$( '<div>' )
.addClass( 'row title' )
@@ -349,12 +360,11 @@
* or hides that link if there are no such requests.
*/
function indicateOlderRequests() {
- var oldRequestsCount, oldRequestsCountString,
- $olderRequests = getOlderRequests(),
+ var $olderRequests = getOlderRequests(),
$olderRequestsIndicator = $( '.older-requests-indicator' );
- oldRequestsCount = $olderRequests.length;
- oldRequestsCountString = mw.language.convertNumber( oldRequestsCount );
+ var oldRequestsCount = $olderRequests.length;
+ var oldRequestsCountString = mw.language.convertNumber( oldRequestsCount );
if ( oldRequestsCount ) {
$olderRequestsIndicator
@@ -404,8 +414,7 @@
}
function selectAllRequests() {
- var selectedCount,
- $requestCheckboxes = $( '.request-selector' ),
+ var $requestCheckboxes = $( '.request-selector' ),
$detailsPane = $( '.details.pane' ),
$selectAll = $( '.request-selector-all' ),
$requestRows = $( '.requests .request' ),
@@ -419,6 +428,7 @@
} );
} );
+ var selectedCount;
if ( selectAllChecked ) {
displayOnMultipleSelection();
$visibleRows.addClass( 'selected' );
@@ -476,8 +486,7 @@
* @param {jQuery.Event} e
*/
function requestSelectHandler( e ) {
- var checkedCount, $checkedBoxes,
- request = e.target,
+ var request = e.target,
$detailsPane = $( '.details.pane' ),
$requestCheckboxes = $( '.request-selector' ),
$selectAll = $( '.request-selector-all' ),
@@ -492,8 +501,8 @@
$thisRequestRow.removeClass( 'selected' );
}
- $checkedBoxes = $requestCheckboxes.filter( ':checked' );
- checkedCount = $checkedBoxes.length;
+ var $checkedBoxes = $requestCheckboxes.filter( ':checked' );
+ var checkedCount = $checkedBoxes.length;
if ( checkedCount === $requestCheckboxes.length ) {
// All boxes are selected
@@ -561,10 +570,9 @@
}
LanguageFilter.prototype.init = function () {
- var languageFilter = this,
- $clearButton;
+ var languageFilter = this;
- $clearButton = $( '<button>' )
+ var $clearButton = $( '<button>' )
.addClass( 'clear-language-selector hide' )
.text( '×' );
@@ -654,12 +662,11 @@
};
TranslatorSearch.prototype.keyup = function () {
- var query,
- translatorSearch = this;
+ var translatorSearch = this;
// Respond to the keypress events after a small timeout to avoid freeze when typed fast
delay( function () {
- query = translatorSearch.$search.val().trim().toLowerCase();
+ var query = translatorSearch.$search.val().trim().toLowerCase();
translatorSearch.filter( query );
}, 300 );
};
@@ -685,14 +692,13 @@
};
function updateAfterFiltering() {
- var $selectedRequests,
- $firstVisibleUser = $( '.request:not(.hide)' ).first();
+ var $firstVisibleUser = $( '.request:not(.hide)' ).first();
if ( $firstVisibleUser.length ) {
$firstVisibleUser.trigger( 'click' );
} else {
$( '.details.pane' ).empty();
- $selectedRequests = $( '.request-selector:checked' );
+ var $selectedRequests = $( '.request-selector:checked' );
$selectedRequests.closest( '.request' ).removeClass( 'selected' );
$selectedRequests.prop( {
checked: false,
diff --git a/MLEB/Translate/resources/js/ext.translate.special.pagemigration.js b/MLEB/Translate/resources/js/ext.translate.special.pagemigration.js
index 06578db1..126aa564 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.pagemigration.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.pagemigration.js
@@ -17,12 +17,11 @@
function createTranslationPage( i, content ) {
return function () {
- var identifier, title, summary,
- api = new mw.Api();
+ var api = new mw.Api();
- identifier = sourceUnits[ i ].identifier;
- title = 'Translations:' + pageName + '/' + identifier + '/' + langCode;
- summary = $( '#pm-summary' ).val();
+ var identifier = sourceUnits[ i ].identifier;
+ var title = 'Translations:' + pageName + '/' + identifier + '/' + langCode;
+ var summary = $( '#pm-summary' ).val();
return api.postWithToken( 'csrf', {
action: 'edit',
@@ -53,9 +52,9 @@
rvstart: fuzzyTimestamp,
titles: pageTitle
} ).then( function ( data ) {
- var pageContent, oldTranslationUnits, obj, page,
- $errorBox = $( '.mw-tpm-sp-error__message' );
- for ( page in data.query.pages ) {
+ var $errorBox = $( '.mw-tpm-sp-error__message' );
+ var obj;
+ for ( var page in data.query.pages ) {
obj = data.query.pages[ page ];
}
if ( obj === undefined ) {
@@ -68,9 +67,8 @@
$errorBox.text( mw.msg( 'pm-old-translations-missing', pageTitle ) ).removeClass( 'hide' );
return $.Deferred().reject();
}
- pageContent = obj.revisions[ 0 ][ '*' ];
- oldTranslationUnits = pageContent.split( '\n\n' );
- return oldTranslationUnits;
+ var pageContent = obj.revisions[ 0 ][ '*' ];
+ return pageContent.split( '\n\n' );
} );
}
@@ -94,10 +92,9 @@
rvdir: 'newer',
titles: pageTitle
} ).then( function ( data ) {
- var timestampFB, dateFB, timestampOld,
- page, obj,
- $errorBox = $( '.mw-tpm-sp-error__message' );
- for ( page in data.query.pages ) {
+ var $errorBox = $( '.mw-tpm-sp-error__message' );
+ var obj;
+ for ( var page in data.query.pages ) {
obj = data.query.pages[ page ];
}
// Page does not exist if missing field is present
@@ -111,10 +108,10 @@
return $.Deferred().reject();
} else {
// FB over here refers to FuzzyBot
- timestampFB = obj.revisions[ 0 ].timestamp;
- dateFB = new Date( timestampFB );
+ var timestampFB = obj.revisions[ 0 ].timestamp;
+ var dateFB = new Date( timestampFB );
dateFB.setSeconds( dateFB.getSeconds() - 1 );
- timestampOld = dateFB.toISOString();
+ var timestampOld = dateFB.toISOString();
mw.log( 'New Timestamp: ' + timestampOld );
return timestampOld;
}
@@ -124,27 +121,26 @@
/**
* Get the translation units created by Translate extension.
*
- * @param {string} pageName
+ * @param {string} page Page name
* @return {jQuery.Promise}
* @return {Function} return.done
* @return {Object[]} return.done.data Array of sUnit Objects
*/
- function getSourceUnits( pageName ) {
+ function getSourceUnits( page ) {
var api = new mw.Api();
return api.get( {
action: 'query',
list: 'messagecollection',
- mcgroup: 'page-' + pageName,
+ mcgroup: 'page-' + page,
mclanguage: 'en',
mcprop: 'definition'
} ).then( function ( data ) {
- var result, i, sUnit, key;
sourceUnits = [];
- result = data.query.messagecollection;
- for ( i = 0; i < result.length; i++ ) {
- sUnit = {};
- key = result[ i ].key;
+ var result = data.query.messagecollection;
+ for ( var i = 0; i < result.length; i++ ) {
+ var sUnit = {};
+ var key = result[ i ].key;
sUnit.identifier = key.slice( key.lastIndexOf( '/' ) + 1 );
sUnit.definition = result[ i ].definition;
sourceUnits.push( sUnit );
@@ -159,12 +155,11 @@
* @param {jQuery} $start The starting node
*/
function shiftRowsUp( $start ) {
- var nextVal,
- $current = $start,
+ var $current = $start,
$next = $start.next();
while ( $next.length ) {
- nextVal = $next.find( '.mw-tpm-sp-unit__target' ).val();
+ var nextVal = $next.find( '.mw-tpm-sp-unit__target' ).val();
$current.find( '.mw-tpm-sp-unit__target' ).val( nextVal );
$current = $next;
$next = $current.next();
@@ -185,10 +180,8 @@
* @return {string} text The text of the last row
*/
function shiftRowsDown( $nextRow, text ) {
- var oldText;
-
while ( $nextRow.length ) {
- oldText = $nextRow.find( '.mw-tpm-sp-unit__target' ).val();
+ var oldText = $nextRow.find( '.mw-tpm-sp-unit__target' ).val();
$nextRow.find( '.mw-tpm-sp-unit__target' ).val( text );
$nextRow = $nextRow.next();
text = oldText;
@@ -205,14 +198,12 @@
*/
function createNewUnit( sourceText, targetText ) {
- var $newUnit, $sourceUnit, $targetUnit, $actionUnit;
-
- $newUnit = $( '<div>' ).addClass( 'mw-tpm-sp-unit row' );
- $sourceUnit = $( '<textarea>' ).addClass( 'mw-tpm-sp-unit__source five columns' )
+ var $newUnit = $( '<div>' ).addClass( 'mw-tpm-sp-unit row' );
+ var $sourceUnit = $( '<textarea>' ).addClass( 'mw-tpm-sp-unit__source five columns' )
.prop( 'readonly', true ).attr( 'tabindex', '-1' ).val( sourceText );
- $targetUnit = $( '<textarea>' ).addClass( 'mw-tpm-sp-unit__target five columns' )
+ var $targetUnit = $( '<textarea>' ).addClass( 'mw-tpm-sp-unit__target five columns' )
.val( targetText ).prop( 'dir', $.uls.data.getDir( langCode ) );
- $actionUnit = $( '<div>' ).addClass( 'mw-tpm-sp-unit__actions two columns' );
+ var $actionUnit = $( '<div>' ).addClass( 'mw-tpm-sp-unit__actions two columns' );
$actionUnit.append(
$( '<span>' ).addClass( 'mw-tpm-sp-action mw-tpm-sp-action--add' )
.attr( 'title', mw.msg( 'pm-add-icon-hover-text' ) ),
@@ -228,27 +219,24 @@
/**
* Display the source and target units alongwith the action icons.
*
- * @param {Array} sourceUnits
+ * @param {Array} units
* @param {Array} translations
*/
- function displayUnits( sourceUnits, translations ) {
- var i, totalUnits, $newUnit, $unitListing,
- sourceText, targetText;
-
- noOfSourceUnits = sourceUnits.length;
+ function displayUnits( units, translations ) {
+ noOfSourceUnits = units.length;
noOfTranslationUnits = translations.length;
- totalUnits = noOfSourceUnits > noOfTranslationUnits ? noOfSourceUnits : noOfTranslationUnits;
- $unitListing = $( '.mw-tpm-sp-unit-listing' );
+ var totalUnits = noOfSourceUnits > noOfTranslationUnits ? noOfSourceUnits : noOfTranslationUnits;
+ var $unitListing = $( '.mw-tpm-sp-unit-listing' );
$unitListing.html( '' );
- for ( i = 0; i < totalUnits; i++ ) {
- sourceText = targetText = '';
- if ( sourceUnits[ i ] !== undefined ) {
- sourceText = sourceUnits[ i ].definition;
+ for ( var i = 0; i < totalUnits; i++ ) {
+ var sourceText = '', targetText = '';
+ if ( units[ i ] !== undefined ) {
+ sourceText = units[ i ].definition;
}
if ( translations[ i ] !== undefined ) {
targetText = translations[ i ];
}
- $newUnit = createNewUnit( sourceText, targetText );
+ var $newUnit = createNewUnit( sourceText, targetText );
$unitListing.append( $newUnit );
}
}
@@ -263,7 +251,10 @@
return translations.map( function ( elem ) {
// Check https://regex101.com/r/oT7fZ2 for details
return elem.match( /(^==.+$|(?:(?!^==).+\n?)+)/gm );
- } );
+ } ).reduce( function ( acc, val ) {
+ // This should be an Array.prototype.flatMap when ES2019 is supported
+ return acc.concat( val );
+ }, [] );
}
/**
@@ -274,9 +265,8 @@
* @return {number} Index of the next unit found, -1 if not.
*/
function getHeaderUnit( startIndex, translationUnits ) {
- var i, regex;
- regex = new RegExp( /^==[^=]+==$/m );
- for ( i = startIndex; i < translationUnits.length; i++ ) {
+ var regex = new RegExp( /^==[^=]+==$/m );
+ for ( var i = startIndex; i < translationUnits.length; i++ ) {
if ( regex.test( translationUnits[ i ] ) ) {
return i;
}
@@ -289,26 +279,24 @@
* Assumption: The source headers and translation headers appear in
* the same order.
*
- * @param {Object[]} sourceUnits
+ * @param {Object[]} units
* @param {string[]} translationUnits
* @return {string[]}
*/
- function alignHeaders( sourceUnits, translationUnits ) {
- var i, regex, tIndex = 0,
- matchText, emptyCount, mergeText;
-
- regex = new RegExp( /^==[^=]+==$/m );
- for ( i = 0; i < sourceUnits.length; i++ ) {
- if ( regex.test( sourceUnits[ i ].definition ) ) {
+ function alignHeaders( units, translationUnits ) {
+ var tIndex = 0;
+ var regex = new RegExp( /^==[^=]+==$/m );
+ for ( var i = 0; i < units.length; i++ ) {
+ if ( regex.test( units[ i ].definition ) ) {
tIndex = getHeaderUnit( tIndex, translationUnits );
- mergeText = '';
+ var mergeText = '';
// search is over
if ( tIndex === -1 ) {
break;
}
// remove the unit
- matchText = translationUnits.splice( tIndex, 1 ).toString();
- emptyCount = i - tIndex;
+ var matchText = translationUnits.splice( tIndex, 1 ).toString();
+ var emptyCount = i - tIndex;
if ( emptyCount > 0 ) {
// add empty units
while ( emptyCount !== 0 ) {
@@ -340,7 +328,7 @@
* Handler for 'Save' button click event.
*/
function saveHandler() {
- var i, content, list = [];
+ var list = [];
$( '.mw-tpm-sp-error__message' ).addClass( 'hide' );
if ( noOfSourceUnits < noOfTranslationUnits ) {
@@ -350,8 +338,8 @@
} else {
$( 'input' ).prop( 'disabled', true );
$( '.mw-tpm-sp-instructions' ).addClass( 'hide' );
- for ( i = 0; i < noOfSourceUnits; i++ ) {
- content = $( '.mw-tpm-sp-unit__target' ).eq( i ).val();
+ for ( var i = 0; i < noOfSourceUnits; i++ ) {
+ var content = $( '.mw-tpm-sp-unit__target' ).eq( i ).val();
content = content.trim();
if ( content !== '' ) {
list.push( createTranslationPage( i, content ) );
@@ -390,16 +378,14 @@
* @param {jQuery.Event} event
*/
function addHandler( event ) {
- var $nextRow, text, $newUnit, $targetUnit;
-
- $nextRow = $( event.target ).closest( '.mw-tpm-sp-unit' ).next();
- $targetUnit = $nextRow.find( '.mw-tpm-sp-unit__target' );
- text = $targetUnit.val();
+ var $nextRow = $( event.target ).closest( '.mw-tpm-sp-unit' ).next();
+ var $targetUnit = $nextRow.find( '.mw-tpm-sp-unit__target' );
+ var text = $targetUnit.val();
$targetUnit.val( '' );
$nextRow = $nextRow.next();
text = shiftRowsDown( $nextRow, text );
if ( text ) {
- $newUnit = createNewUnit( '', text );
+ var $newUnit = createNewUnit( '', text );
$( '.mw-tpm-sp-unit-listing' ).append( $newUnit );
}
noOfTranslationUnits += 1;
@@ -412,9 +398,8 @@
* @param {jQuery.Event} event
*/
function deleteHandler( event ) {
- var sourceText, $rowUnit;
- $rowUnit = $( event.target ).closest( '.mw-tpm-sp-unit' );
- sourceText = $rowUnit.find( '.mw-tpm-sp-unit__source' ).val();
+ var $rowUnit = $( event.target ).closest( '.mw-tpm-sp-unit' );
+ var sourceText = $rowUnit.find( '.mw-tpm-sp-unit__source' ).val();
if ( !sourceText ) {
$rowUnit.remove();
} else {
@@ -431,10 +416,9 @@
* @param {jQuery.Event} event
*/
function swapHandler( event ) {
- var $rowUnit, tempText, nextVal;
- $rowUnit = $( event.target ).closest( '.mw-tpm-sp-unit' );
- tempText = $rowUnit.find( '.mw-tpm-sp-unit__target' ).val();
- nextVal = $rowUnit.next().find( '.mw-tpm-sp-unit__target' ).val();
+ var $rowUnit = $( event.target ).closest( '.mw-tpm-sp-unit' );
+ var tempText = $rowUnit.find( '.mw-tpm-sp-unit__target' ).val();
+ var nextVal = $rowUnit.next().find( '.mw-tpm-sp-unit__target' ).val();
$rowUnit.find( '.mw-tpm-sp-unit__target' ).val( nextVal );
$rowUnit.next().find( '.mw-tpm-sp-unit__target' ).val( tempText );
}
@@ -446,19 +430,18 @@
* @param {jQuery.Event} e
*/
function importHandler( e ) {
- var pageTitle, slashPos, titleObj,
- $errorBox = $( '.mw-tpm-sp-error__message' ),
+ var $errorBox = $( '.mw-tpm-sp-error__message' ),
$messageBox = $( '.mw-tpm-sp-instructions' );
e.preventDefault();
- pageTitle = $( '#title' ).val().trim();
+ var pageTitle = $( '#title' ).val().trim();
if ( pageTitle === '' ) {
$errorBox.text( mw.msg( 'pm-pagetitle-missing' ) ).removeClass( 'hide' );
return;
}
- titleObj = mw.Title.newFromText( pageTitle );
+ var titleObj = mw.Title.newFromText( pageTitle );
$messageBox.addClass( 'hide' );
if ( titleObj === null ) {
$errorBox.text( mw.msg( 'pm-pagetitle-invalid' ) ).removeClass( 'hide' );
@@ -466,7 +449,7 @@
}
pageTitle = titleObj.getPrefixedDb();
- slashPos = pageTitle.lastIndexOf( '/' );
+ var slashPos = pageTitle.lastIndexOf( '/' );
if ( slashPos === -1 ) {
$errorBox.text( mw.msg( 'pm-langcode-missing' ) ).removeClass( 'hide' );
@@ -484,13 +467,13 @@
$errorBox.addClass( 'hide' );
$.when( getSourceUnits( pageName ), getFuzzyTimestamp( pageTitle ) )
- .then( function ( sourceUnits, fuzzyTimestamp ) {
- noOfSourceUnits = sourceUnits.length;
+ .then( function ( units, fuzzyTimestamp ) {
+ noOfSourceUnits = units.length;
splitTranslationPage( fuzzyTimestamp, pageTitle ).done( function ( translations ) {
var translationUnits = splitHeaders( translations );
- translationUnits = alignHeaders( sourceUnits, translationUnits );
+ translationUnits = alignHeaders( units, translationUnits );
noOfTranslationUnits = translationUnits.length;
- displayUnits( sourceUnits, translationUnits );
+ displayUnits( units, translationUnits );
$( '#action-save, #action-cancel' ).removeClass( 'hide' );
$( '#action-import' ).addClass( 'hide' );
$messageBox.text( mw.msg( 'pm-on-import-message-text' ) ).removeClass( 'hide' );
@@ -520,6 +503,7 @@
getSourceUnits: getSourceUnits,
getFuzzyTimestamp: getFuzzyTimestamp,
splitTranslationPage: splitTranslationPage,
+ splitHeaders: splitHeaders,
alignHeaders: alignHeaders
} );
diff --git a/MLEB/Translate/resources/js/ext.translate.special.pagepreparation.js b/MLEB/Translate/resources/js/ext.translate.special.pagepreparation.js
index cdf1aa52..8b1edea9 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.pagepreparation.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.pagepreparation.js
@@ -39,12 +39,12 @@
titles: pageName,
rvdifftotext: pageContent
} ).then( function ( data ) {
- var page, obj, diff;
-
- for ( page in data.query.pages ) {
+ var obj;
+ for ( var page in data.query.pages ) {
obj = data.query.pages[ page ];
}
+ var diff;
if ( obj !== undefined ) {
diff = obj.revisions[ 0 ].diff[ '*' ];
}
@@ -89,16 +89,14 @@
*/
function doCategories( pageContent ) {
return getNamespaceAliases( 14 ).then( function ( aliases ) {
- var i, aliasList, categoryRegex;
-
aliases.push( 'category' );
- for ( i = 0; i < aliases.length; i++ ) {
+ for ( var i = 0; i < aliases.length; i++ ) {
aliases[ i ] = mw.util.escapeRegExp( aliases[ i ] );
}
- aliasList = aliases.join( '|' );
+ var aliasList = aliases.join( '|' );
// Regex: https://regex101.com/r/sJ3gZ4/2
- categoryRegex = new RegExp( '\\[\\[((' + aliasList + ')' +
+ var categoryRegex = new RegExp( '\\[\\[((' + aliasList + ')' +
':[^\\|]+)(\\|[^\\|]*?)?\\]\\]', 'gi' );
pageContent = pageContent.replace( categoryRegex, '\n</translate>\n' +
'[[$1{{#translation:}}$3]]\n<translate>\n' );
@@ -140,15 +138,12 @@
* @return {string}
*/
function addAnchor( headerText, pageContent ) {
- var headerSearchRegex, anchorID, replaceAnchorRegex,
- spanSearchRegex;
-
- anchorID = headerText.replace( ' ', '-' ).toLowerCase();
+ var anchorID = headerText.replace( ' ', '-' ).toLowerCase();
headerText = mw.RegExp.escape( headerText );
// Search for the header having text as headerText
// Regex: https://regex101.com/r/fD6iL1
- headerSearchRegex = new RegExp( '(==+[ ]*' + headerText + '[ ]*==+)', 'gi' );
+ var headerSearchRegex = new RegExp( '(==+[ ]*' + headerText + '[ ]*==+)', 'gi' );
// This is to ensure the tags and the anchor are added only once
if ( pageContent.indexOf( '<span id="' + mw.html.escape( anchorID ) + '"' ) === -1 ) {
@@ -158,13 +153,13 @@
// This is to add back the tags which were removed in cleanupTags()
if ( pageContent.indexOf( '</translate>\n<span id="' + anchorID + '"' ) === -1 ) {
- spanSearchRegex = new RegExp( '(<span id="' + mw.RegExp.escape( anchorID ) + '"></span>)', 'gi' );
+ var spanSearchRegex = new RegExp( '(<span id="' + mw.RegExp.escape( anchorID ) + '"></span>)', 'gi' );
pageContent = pageContent.replace( spanSearchRegex, '\n</translate>\n$1\n</translate>\n' );
}
// Replace the link text with the anchorID defined above
// Regex: https://regex101.com/r/kB5bK3
- replaceAnchorRegex = new RegExp( '(\\[\\[#)' + headerText + '(.*\\]\\])', 'gi' );
+ var replaceAnchorRegex = new RegExp( '(\\[\\[#)' + headerText + '(.*\\]\\])', 'gi' );
pageContent = pageContent.replace( replaceAnchorRegex, '$1' +
anchorID.replace( '$', '$$$' ) + '$2' );
@@ -180,29 +175,26 @@
* @return {string}
*/
function fixInternalLinks( pageContent ) {
+ var searchText = pageContent;
- var normalizeRegex, linkPrefixRegex, sectionLinksRegex,
- match, searchText, namespaces, nsString;
- searchText = pageContent;
-
- normalizeRegex = new RegExp( /\[\[(?!Category)([^|]*?)\]\]/gi );
+ var normalizeRegex = new RegExp( /\[\[(?!Category)([^|]*?)\]\]/gi );
// First convert all links into two-party form. If a link is not having a pipe,
// add a pipe and duplicate the link text
// Regex: https://regex101.com/r/pO9nN2
pageContent = pageContent.replace( normalizeRegex, '[[$1|$1]]' );
- namespaces = getNamespaces();
- nsString = namespaces.join( '|' );
+ var namespaces = getNamespaces();
+ var nsString = namespaces.join( '|' );
// Finds all the links to sections on the same page.
// Regex: https://regex101.com/r/cX6jT3
- sectionLinksRegex = new RegExp( /\[\[#(.*?)(\|(.*?))?\]\]/gi );
- match = sectionLinksRegex.exec( searchText );
+ var sectionLinksRegex = new RegExp( /\[\[#(.*?)(\|(.*?))?\]\]/gi );
+ var match = sectionLinksRegex.exec( searchText );
while ( match !== null ) {
pageContent = addAnchor( match[ 1 ], pageContent );
match = sectionLinksRegex.exec( searchText );
}
- linkPrefixRegex = new RegExp( '\\[\\[((?:(?:special(?!:MyLanguage\\b)|' + nsString +
+ var linkPrefixRegex = new RegExp( '\\[\\[((?:(?:special(?!:MyLanguage\\b)|' + nsString +
'):)?[^:]*?)\\]\\]', 'gi' );
// Add the 'Special:MyLanguage/' prefix for all internal links of valid namespaces and
// mainspace.
@@ -227,9 +219,9 @@
meta: 'siteinfo',
siprop: 'namespacealiases'
} ).then( function ( data ) {
- var alias, aliases = [];
+ var aliases = [];
- for ( alias in data.query.namespacealiases ) {
+ for ( var alias in data.query.namespacealiases ) {
if ( data.query.namespacealiases[ alias ].id === namespaceID ) {
aliases.push( data.query.namespacealiases[ alias ][ '*' ] );
}
@@ -248,23 +240,21 @@
*/
function doFiles( pageContent ) {
return getNamespaceAliases( 6 ).then( function ( aliases ) {
- var i, aliasList, captionFilesRegex, fileRegex;
-
aliases.push( 'file' );
- for ( i = 0; i < aliases.length; i++ ) {
+ for ( var i = 0; i < aliases.length; i++ ) {
aliases[ i ] = mw.RegExp.escape( aliases[ i ] );
}
- aliasList = aliases.join( '|' );
+ var aliasList = aliases.join( '|' );
// Add translate tags for files with captions
- captionFilesRegex = new RegExp( '\\[\\[(' + aliasList + ')(.*\\|)(.*?)\\]\\]', 'gi' );
+ var captionFilesRegex = new RegExp( '\\[\\[(' + aliasList + ')(.*\\|)(.*?)\\]\\]', 'gi' );
pageContent = pageContent.replace( captionFilesRegex,
'</translate>\n[[$1$2<translate>$3</translate>]]\n<translate>' );
// Add translate tags for files without captions
- fileRegex = new RegExp( '/\\[\\[((' + aliasList + ')[^\\|]*?)\\]\\]', 'gi' );
+ var fileRegex = new RegExp( '/\\[\\[((' + aliasList + ')[^\\|]*?)\\]\\]', 'gi' );
pageContent = pageContent.replace( fileRegex, '\n</translate>[[$1]]\n<translate>' );
return pageContent;
@@ -279,9 +269,8 @@
* @return {string} pageContent
*/
function doTemplates( pageContent ) {
- var templateRegex;
// Regex: https://regex101.com/r/wA3iX0
- templateRegex = new RegExp( /^({{[\s\S]*?}})/gm );
+ var templateRegex = new RegExp( /^({{[\s\S]*?}})/gm );
pageContent = pageContent.replace( templateRegex, '</translate>\n$1\n<translate>' );
return pageContent;
@@ -312,8 +301,7 @@
* @return {string} return.done.value The current revision
*/
function getPageContent( pageName ) {
- var obj,
- api = new mw.Api();
+ var api = new mw.Api();
return api.get( {
action: 'query',
@@ -322,9 +310,9 @@
rvlimit: '1',
titles: pageName
} ).then( function ( data ) {
- var page;
+ var obj;
- for ( page in data.query.pages ) {
+ for ( var page in data.query.pages ) {
obj = data.query.pages[ page ];
}
@@ -339,11 +327,10 @@
* @return {Array} Array of valid namespaces
*/
function getNamespaces() {
- var key, namespacesObject, i,
- namespaces = [];
+ var namespaces = [];
- namespacesObject = mw.config.get( 'wgNamespaceIds' );
- for ( key in namespacesObject ) {
+ var namespacesObject = mw.config.get( 'wgNamespaceIds' );
+ for ( var key in namespacesObject ) {
namespaces.push( key );
}
@@ -352,25 +339,24 @@
namespaces.splice( namespaces.indexOf( ns ), 1 );
} );
- for ( i = 0; i < namespaces.length; i++ ) {
+ for ( var i = 0; i < namespaces.length; i++ ) {
namespaces[ i ] = mw.RegExp.escape( namespaces[ i ] );
}
return namespaces;
}
$( function () {
- var pageContent,
- $input = $( '#page' );
+ var $input = $( '#page' );
$( '#action-cancel' ).on( 'click', function () {
document.location.reload( true );
} );
+ var pageContent;
$( '#action-save' ).on( 'click', function () {
- var pageName,
- pageUrl = '';
+ var pageUrl = '';
- pageName = $input.val().trim();
+ var pageName = $input.val().trim();
savePage( pageName, pageContent ).done( function () {
pageUrl = mw.Title.newFromText( pageName ).getUrl( { action: 'edit' } );
$( '.messageDiv' )
@@ -386,9 +372,9 @@
} );
$( '#action-prepare' ).on( 'click', function () {
- var pageName, $messageDiv = $( '.messageDiv' );
+ var $messageDiv = $( '.messageDiv' );
- pageName = $input.val().trim();
+ var pageName = $input.val().trim();
$messageDiv.addClass( 'hide' );
if ( pageName === '' ) {
// eslint-disable-next-line no-alert
diff --git a/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js b/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js
index fc27242a..ab0cee82 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js
@@ -13,12 +13,10 @@ var LanguagesMultiselectWidget = require( './LanguagesMultiselectWidget.js' );
window.LanguagesMultiselectWidget = LanguagesMultiselectWidget;
function configureLanguageInput( $form, $widget ) {
- var widget, $input;
-
/** @type {LanguagesMultiselectWidget} */
- widget = OO.ui.infuse( $widget, { api: new mw.Api() } );
+ var widget = OO.ui.infuse( $widget, { api: new mw.Api() } );
- $input = $( '<input>' ).prop( {
+ var $input = $( '<input>' ).prop( {
type: 'hidden',
name: 'prioritylangs',
value: widget.getValue()
@@ -32,10 +30,9 @@ function configureLanguageInput( $form, $widget ) {
function configurePostLinks( $container ) {
$container.on( 'click', '.mw-translate-jspost', function ( e ) {
- var params,
- uri = new mw.Uri( e.target.href );
+ var uri = new mw.Uri( e.target.href );
- params = uri.query;
+ var params = uri.query;
params.token = mw.user.tokens.get( 'csrfToken' );
$.post( uri.path, params ).done( function () {
location.reload();
@@ -47,21 +44,11 @@ function configurePostLinks( $container ) {
// Init
$( function () {
- var mediaWikiVersion = mw.config.get( 'wgVersion' ),
- $widgets = $( '#mw-translate-SpecialPageTranslation-prioritylangs' );
+ var $widgets = $( '#mw-translate-SpecialPageTranslation-prioritylangs' );
configurePostLinks( $( '#mw-content-text' ) );
if ( $widgets.length ) {
- // On MW 1.34, pre-selected priority languages are not being displayed when using
- // LanguagesMultiselectWidget, which in turn uses MenuTagMultiselectWidget.
- // This could be due to an older version of OOUI.
- // Use a normal textarea and remove the loading input.
- if ( ( /^1\.34\./ ).test( mediaWikiVersion ) ) {
- $widgets.find( '.oo-ui-textInputWidget' ).last().remove();
- return;
- }
-
configureLanguageInput( $( '.mw-tpt-sp-markform' ), $widgets );
}
} );
diff --git a/MLEB/Translate/resources/js/ext.translate.special.searchtranslations.js b/MLEB/Translate/resources/js/ext.translate.special.searchtranslations.js
index e3f5ecb8..2aea5b90 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.searchtranslations.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.searchtranslations.js
@@ -43,9 +43,8 @@
// Make other old browsers happy
if ( !Object.keys ) {
Object.keys = function ( obj ) {
- var keys = [],
- k;
- for ( k in obj ) {
+ var keys = [];
+ for ( var k in obj ) {
if ( Object.prototype.hasOwnProperty.call( obj, k ) ) {
keys.push( k );
}
@@ -55,42 +54,31 @@
}
function showLanguages() {
- var $languages,
- languages,
- ulslanguages = [],
- currentLanguage,
- resultCount,
- $count,
- result,
- i,
+ var ulslanguages = [],
selectedClasss = '',
- languageCode,
quickLanguageList = [],
- unique = [],
- $ulsTrigger,
- uri;
+ unique = [];
- $languages = $( '.facet.languages' );
- languages = $languages.data( 'facets' );
- currentLanguage = $languages.data( 'language' );
+ var $languages = $( '.facet.languages' );
+ var languages = $languages.data( 'facets' );
+ var currentLanguage = $languages.data( 'language' );
if ( !languages ) {
return;
}
if ( currentLanguage !== '' ) {
- uri = new mw.Uri( location.href );
+ var uri = new mw.Uri( location.href );
uri.extend( { language: '', filter: '' } );
addToSelectedBox( getLanguageLabel( currentLanguage ), uri.toString() );
}
- resultCount = Object.keys( languages ).length;
+ var resultCount = Object.keys( languages ).length;
quickLanguageList = quickLanguageList.concat( mw.uls.getFrequentLanguageList() )
.concat( Object.keys( languages ) );
// Remove duplicates from the language list
quickLanguageList.forEach( function ( lang ) {
- result = languages[ lang ];
- if ( result && unique.indexOf( lang ) === -1 ) {
+ if ( languages[ lang ] && unique.indexOf( lang ) === -1 ) {
unique.push( lang );
}
} );
@@ -106,9 +94,9 @@
quickLanguageList.sort( sortLanguages );
- for ( i = 0; i <= quickLanguageList.length; i++ ) {
- languageCode = quickLanguageList[ i ];
- result = languages[ languageCode ];
+ for ( var i = 0; i <= quickLanguageList.length; i++ ) {
+ var languageCode = quickLanguageList[ i ];
+ var result = languages[ languageCode ];
if ( !result ) {
continue;
}
@@ -123,6 +111,9 @@
.addClass( 'row facet-item' )
.append(
$( '<span>' )
+ // The following classes are used here:
+ // * selected
+ // * or no class
.addClass( 'facet-name ' + selectedClasss )
.append( $( '<a>' )
.attr( 'href', result.url )
@@ -135,17 +126,17 @@
);
}
- Object.keys( languages ).forEach( function ( languageCode ) {
- ulslanguages[ languageCode ] = mw.config.get( 'wgTranslateLanguages' )[ languageCode ];
+ Object.keys( languages ).forEach( function ( lang ) {
+ ulslanguages[ lang ] = mw.config.get( 'wgTranslateLanguages' )[ lang ];
} );
mw.translate.addExtraLanguagesToLanguageData( ulslanguages, [ 'SP' ] );
if ( resultCount > 6 ) {
- $ulsTrigger = $( '<a>' )
+ var $ulsTrigger = $( '<a>' )
.text( '...' )
.addClass( 'translate-search-more-languages' );
- $count = $( '<span>' )
+ var $count = $( '<span>' )
.addClass( 'translate-search-more-languages-info' )
.text( mw.msg( 'translate-search-more-languages-info', resultCount - quickLanguageList.length ) );
$languages.append( $ulsTrigger, $count );
@@ -164,42 +155,29 @@
}
function showMessageGroups() {
- var currentGroup,
- groupList,
- $groups;
-
- $groups = $( '.facet.groups' );
+ var $groups = $( '.facet.groups' );
if ( !resultGroups ) {
// No search results
return;
}
- groupList = Object.keys( resultGroups );
- listGroups( groupList, currentGroup, $groups );
+ var groupList = Object.keys( resultGroups );
+ listGroups( groupList, undefined, $groups );
}
function listGroups( groupList, parentGrouppath, $parent, level ) {
- var i,
- $grouSelectorTrigger,
- selectedClass = '',
- group,
- groupId,
- $groupRow,
- uri,
+ var selectedClass = '',
maxListSize = 10,
currentGroup = $( '.facet.groups' ).data( 'group' ),
- resultCount = groupList.length,
- position,
- options,
- grouppath;
+ resultCount = groupList.length;
level = level || 0;
groupList.sort( sortGroups );
if ( level === 0 ) {
groupList = groupList.splice( 0, maxListSize );
}
- grouppath = getParameterByName( 'grouppath' ).split( '|' )[ 0 ];
+ var grouppath = getParameterByName( 'grouppath' ).split( '|' )[ 0 ];
if ( currentGroup && resultGroups[ grouppath ] &&
groupList.indexOf( grouppath ) < 0 &&
level === 0
@@ -208,14 +186,14 @@
groupList = groupList.concat( grouppath );
}
groupList.sort( sortGroups );
- for ( i = 0; i < groupList.length; i++ ) {
- groupId = groupList[ i ];
- group = findGroup( groupId, resultGroups );
+ for ( var i = 0; i < groupList.length; i++ ) {
+ var groupId = groupList[ i ];
+ var group = findGroup( groupId, resultGroups );
if ( !group ) {
continue;
}
- uri = new mw.Uri( location.href );
+ var uri = new mw.Uri( location.href );
if ( parentGrouppath !== undefined ) {
grouppath = parentGrouppath + '|' + groupId;
} else {
@@ -232,10 +210,16 @@
uri.extend( { group: groupId, grouppath: grouppath } );
}
- $groupRow = $( '<div>' )
+ var $groupRow = $( '<div>' )
+ // The following classes are used here:
+ // * facet-level-0
+ // * facet-level-1
+ // * facet-level-2
+ // * facet-level-3
.addClass( 'row facet-item facet-level-' + level )
.append(
$( '<span>' )
+ // Class name documented above
.addClass( 'facet-name ' + selectedClass )
.append( $( '<a>' )
.attr( 'href', uri.toString() )
@@ -252,7 +236,7 @@
}
if ( resultCount > maxListSize && resultCount - groupList.length > 0 && level === 0 ) {
- $grouSelectorTrigger = $( '<div>' )
+ var $grouSelectorTrigger = $( '<div>' )
.addClass( 'rowfacet-item ' )
.append(
$( '<a>' )
@@ -265,6 +249,7 @@
);
$parent.append( $grouSelectorTrigger );
+ var position;
if ( $( document.body ).hasClass( 'rtl' ) ) {
position = {
my: 'right top',
@@ -278,7 +263,7 @@
collision: 'none'
};
}
- options = {
+ var options = {
language: mw.config.get( 'wgUserLanguage' ),
position: position,
onSelect: function ( selectedGroup ) {
@@ -316,13 +301,13 @@
}
function matchOperators( str, callback ) {
- var matches,
- counter = false,
+ var counter = false,
// Add operators for different filters
operatorRegex = [ 'language', 'group', 'filter' ];
operatorRegex.forEach( function ( value ) {
var regex = new RegExp( value + ':(\\S+)', 'i' );
+ var matches;
if ( ( matches = regex.exec( str ) ) !== null ) {
counter = true;
callback( {
diff --git a/MLEB/Translate/resources/js/ext.translate.special.translate.js b/MLEB/Translate/resources/js/ext.translate.special.translate.js
index 1b80061a..1034d7ad 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.translate.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.translate.js
@@ -1,7 +1,9 @@
( function () {
'use strict';
- var state = {
+ var state, hideOptionalMessages = '!optional';
+
+ state = {
group: null,
language: null,
messageList: null
@@ -18,15 +20,13 @@
* @param {Object} group a message group object.
*/
changeGroup: function ( group ) {
- var changes;
-
if ( !checkDirty() ) {
return;
}
state.group = group.id;
- changes = {
+ var changes = {
group: group.id,
showMessage: null
@@ -51,8 +51,8 @@
mw.translate.updateTabLinks( changes );
$( '.tux-editor-header .group-warning' ).empty();
state.messageList.changeSettings( changes );
+ state.groupSelector.updateTargetLanguage( language );
updateGroupInformation( state );
-
},
changeFilter: function ( filter ) {
@@ -98,10 +98,8 @@
*/
updateTabLinks: function ( params ) {
$( '.tux-tab a' ).each( function () {
- var $a, uri;
-
- $a = $( this );
- uri = new mw.Uri( $a.prop( 'href' ) );
+ var $a = $( this );
+ var uri = new mw.Uri( $a.prop( 'href' ) );
uri.extend( params );
$a.prop( 'href', uri.toString() );
} );
@@ -109,12 +107,10 @@
} );
function getActualFilter( filter ) {
- var realFilters, uri;
-
- realFilters = [ '!ignored' ];
- uri = new mw.Uri( window.location.href );
+ var realFilters = [ '!ignored' ];
+ var uri = new mw.Uri( window.location.href );
if ( uri.query.optional !== '1' ) {
- realFilters.push( '!optional' );
+ realFilters.push( hideOptionalMessages );
}
if ( filter ) {
realFilters.push( filter );
@@ -179,15 +175,24 @@
}
function updateGroupWarning( group, language ) {
- var $preferredLanguages, headerMessage, languagesMessage,
- $groupWarning = $( '.tux-editor-header .group-warning' );
+ var $groupWarning = $( '.tux-editor-header .group-warning' );
+
+ if ( group.priority === 'discouraged' ) {
+ $groupWarning.append(
+ $( '<p>' ).append( $( '<strong>' )
+ .text( mw.message( 'tpt-discouraged-translation-header' ).text() )
+ ),
+ $( '<p>' ).append( mw.message( 'tpt-discouraged-translation-content' ).parseDom() )
+ );
+ return;
+ }
if ( !group.prioritylangs || isPriorityLanguage( language, group.prioritylangs ) ) {
return;
}
// Make a comma-separated list of preferred languages
- $preferredLanguages = $( '<span>' );
+ var $preferredLanguages = $( '<span>' );
group.prioritylangs.forEach( function ( languageCode, index ) {
// bidi isolation for language names
$preferredLanguages.append(
@@ -200,6 +205,7 @@
}
} );
+ var headerMessage, languagesMessage;
if ( group.priorityforce ) {
headerMessage = mw.message(
'tpt-discouraged-language-force-header',
@@ -263,10 +269,7 @@
}
$( function () {
- var $translateContainer, $hideTranslatedButton, $messageList,
- filter, uri, position, offset, limit;
-
- $messageList = $( '.tux-messagelist' );
+ var $messageList = $( '.tux-messagelist' );
state.group = $( '.tux-messagetable-loader' ).data( 'messagegroup' );
state.language = $messageList.data( 'targetlangcode' );
@@ -274,9 +277,10 @@
$messageList.messagetable();
state.messageList = $messageList.data( 'messagetable' );
- uri = new mw.Uri( window.location.href );
- filter = uri.query.filter;
- offset = uri.query.showMessage;
+ var uri = new mw.Uri( window.location.href );
+ var filter = uri.query.filter;
+ var offset = uri.query.showMessage;
+ var limit;
if ( offset ) {
limit = uri.query.limit || 1;
// Default to no filters
@@ -304,15 +308,21 @@
} );
// Start loading messages
+ var actualFilter = getActualFilter( filter );
state.messageList.changeSettings( {
group: state.group,
language: state.language,
offset: offset,
limit: limit,
- filter: getActualFilter( filter )
+ filter: actualFilter
} );
+
+ if ( actualFilter.indexOf( hideOptionalMessages ) === -1 ) {
+ $( '#tux-option-optional' ).prop( 'checked', true );
+ }
}
+ var position;
if ( $( document.body ).hasClass( 'rtl' ) ) {
position = {
my: 'right top',
@@ -325,6 +335,7 @@
position: position,
recent: mw.translate.recentGroups.get()
} );
+ state.groupSelector = $( '.tux-breadcrumb__item--aggregate' ).data( 'msggroupselector' );
updateGroupInformation( state );
@@ -341,13 +352,13 @@
$( '.tux-message' ).translateeditor();
}
- $translateContainer = $( '.ext-translate-container' );
+ var $translateContainer = $( '.ext-translate-container' );
if ( mw.translate.canProofread() ) {
$translateContainer.find( '.proofread-mode-button' ).removeClass( 'hide' );
}
- $hideTranslatedButton = $translateContainer.find( '.tux-editor-clear-translated' );
+ var $hideTranslatedButton = $translateContainer.find( '.tux-editor-clear-translated' );
$hideTranslatedButton
.prop( 'disabled', !getTranslatedMessages( $translateContainer ).length )
.on( 'click', function () {
@@ -357,14 +368,13 @@
// Message filter click handler
$translateContainer.find( '.row.tux-message-selector > li' ).on( 'click', function () {
- var newFilter,
- $this = $( this );
+ var $this = $( this );
if ( $this.hasClass( 'more' ) ) {
return false;
}
- newFilter = $this.data( 'filter' );
+ var newFilter = $this.data( 'filter' );
// Remove the 'selected' class from all the items.
// Some of them could have been moved to under the "more" menu,
diff --git a/MLEB/Translate/resources/js/ext.translate.special.translationstash.js b/MLEB/Translate/resources/js/ext.translate.special.translationstash.js
deleted file mode 100644
index d4356923..00000000
--- a/MLEB/Translate/resources/js/ext.translate.special.translationstash.js
+++ /dev/null
@@ -1,256 +0,0 @@
-/*!
- * TranslationStash front-end logic.
- *
- * @author Santhosh Thottingal
- * @license GPL-2.0-or-later
- * @since 2013.10
- */
-
-( function () {
- 'use strict';
-
- var userTranslations = {},
- translationStashStorage = new mw.translate.TranslationStashStorage();
-
- mw.translate.canTranslate = function () {
- // At this page, the new translator can translate
- return true;
- };
-
- function getMessages( messageGroup, language, offset, limit ) {
- var deferred = new mw.Api().get( {
- action: 'query',
- list: 'messagecollection',
- mcgroup: messageGroup,
- mclanguage: language,
- mcoffset: offset,
- mclimit: limit,
- mcprop: 'definition'
- } );
-
- return deferred.promise();
- }
-
- function addMessage( message ) {
- var $messageWrapper, $message,
- $messageTable = $( '.tux-messagelist' ),
- sourceLanguage = $messageTable.data( 'sourcelangcode' ),
- sourceLanguageDir = $.uls.data.getDir( sourceLanguage ),
- targetLanguage = $messageTable.data( 'targetlangcode' ),
- targetLanguageDir = $.uls.data.getDir( targetLanguage ),
- status = message.properties.status,
- statusClass = 'tux-status-' + status,
- statusMsg;
-
- if ( status === 'translated' ) {
- // tux-status-translated
- statusMsg = 'tux-status-' + status;
- }
-
- $messageWrapper = $( '<div>' )
- .addClass( 'row tux-message' );
-
- $message = $( '<div>' )
- .addClass( 'row message tux-message-item ' + status )
- .append(
- $( '<div>' )
- .addClass( 'eight columns tux-list-message' )
- .append(
- $( '<span>' )
- .addClass( 'tux-list-source' )
- .attr( {
- lang: sourceLanguage,
- dir: sourceLanguageDir
- } )
- .text( message.definition ),
- // Bidirectional isolation.
- // This should be removed some day when proper
- // unicode-bidi: isolate
- // is supported everywhere
- $( '<span>' )
- .html( $( document.body ).hasClass( 'rtl' ) ? '&rlm;' : '&lrm;' ),
- $( '<span>' )
- .addClass( 'tux-list-translation' )
- .attr( {
- lang: targetLanguage,
- dir: targetLanguageDir
- } )
- .text( message.translation || '' )
- ),
- $( '<div>' )
- .addClass( 'two columns tux-list-status text-center' )
- .append(
- $( '<span>' )
- .addClass( statusClass )
- // The following messages are used here:
- // * tux-status-optional
- // * tux-status-fuzzy
- // * tux-status-proofread
- // * tux-status-translated
- // * tux-status-saving
- // * tux-status-unsaved
- .text( statusMsg ? mw.msg( statusMsg ) : '' )
- ),
- $( '<div>' )
- .addClass( 'two column tux-list-edit text-right' )
- .append(
- $( '<a>' )
- .attr( {
- title: mw.msg( 'translate-edit-title', message.key )
- } )
- .text( mw.msg( 'tux-edit' ) )
- )
- );
-
- $messageWrapper.append( $message );
- $messageTable.append( $messageWrapper );
- // Attach translate editor to the message
- $messageWrapper.translateeditor( {
- message: message,
- storage: translationStashStorage,
- onSave: updateStats,
- onSkip: function () {
- var $next = this.$editTrigger.next( '.tux-message' );
-
- // If there is text in the skipped message, avoid showing the
- // regular "you have unsaved messages" when navigating away,
- // because there is no way to get back to these messages.
- this.markUnunsaved();
-
- // This can happen when it's
- // the last message in the translation stash
- if ( !$next.length ) {
- // Reload the page to get more messages
- // when we get to the last one
- window.location.reload();
- }
- },
- onReady: function () {
- this.$editor.find( '.tux-editor-skip-button' )
- .text( mw.msg( 'translate-translationstash-skip-button-label' ) );
- }
- } );
- }
-
- /**
- * Updates the translation count at the top of the message list and
- * displays warning when translation limit has been reached.
- * Relies on classes stash-stats and tux-status-translated.
- */
- function updateStats() {
- var count,
- $target = $( '.stash-stats' );
-
- count = $( '.tux-status-translated' ).length;
- if ( count === 0 ) {
- return;
- }
-
- $target.text( mw.msg(
- 'translate-translationstash-translations',
- mw.language.convertNumber( count )
- ) );
-
- if ( count >= mw.config.get( 'wgTranslateSandboxLimit' ) ) {
- // Remove the untranslated message to disallow translation beyond the limit
- $( '.tux-message' ).has( '.untranslated' ).remove();
-
- // Show a message telling that the limit was reached
- $( '.limit-reached' )
- .empty()
- .append( $( '<h1>' ).text( mw.msg( 'tsb-limit-reached-title' ) ) )
- .append( $( '<p>' ).text( mw.msg( 'tsb-limit-reached-body' ) ) )
- .removeClass( 'hide' );
- }
- }
-
- function loadMessages() {
- var $messageTable = $( '.tux-messagelist' ),
- messagegroup = '!sandbox';
-
- $( '<div>' )
- .addClass( 'tux-loading-indicator' )
- .appendTo( $messageTable );
-
- getMessages( messagegroup, $messageTable.data( 'targetlangcode' ) )
- .done( function ( result ) {
- var $untranslated, messages = result.query.messagecollection;
-
- $messageTable.empty();
- messages.forEach( function ( message ) {
- message.properties = {};
- message.properties.status = 'untranslated';
-
- message.group = messagegroup;
- if ( userTranslations[ message.title ] ) {
- message.translation = userTranslations[ message.title ].translation;
- message.properties.status = 'translated';
- }
-
- addMessage( message );
- } );
-
- // Show the editor for the first untranslated message.
- $untranslated = $( '.tux-message' )
- .has( '.tux-message-item.untranslated' )
- .first();
- if ( $untranslated.length ) {
- $untranslated.data( 'translateeditor' ).show();
- }
-
- updateStats();
- } ).fail( function ( errorCode, response ) {
- $messageTable.empty().addClass( 'error' )
- .text( 'Error: ' + errorCode + ' - ' +
- ( response.error && response.error.info || 'Unknown error' )
- );
- } );
- }
-
- $( function () {
- var $messageTable = $( '.tux-messagelist' ),
- $ulsTrigger = $( '.ext-translate-language-selector > .uls' );
-
- // Some links in helpers will navigate away by default. But since the messages
- // will change on this page on every load, we want to avoid that. Force the
- // links to open on new window/tab.
- mw.hook( 'mw.translate.editor.showTranslationHelpers' ).add( function ( helpers, $editor ) {
- $editor.find( 'a' ).prop( 'target', '_blank' );
- } );
-
- $ulsTrigger.uls( {
- ulsPurpose: 'translate-special-translationstash',
- onSelect: function ( language ) {
- var direction = $.uls.data.getDir( language ),
- autonym = $.uls.data.getAutonym( language );
-
- $ulsTrigger
- .text( autonym )
- .attr( {
- lang: language,
- dir: direction
- } );
-
- $messageTable
- .empty()
- .data( {
- targetlangcode: language,
- targetlangdir: direction
- } );
-
- loadMessages();
- }
- } );
- // Get the user translations if any(possibly from an early attempt)
- // and new messages to try.
- translationStashStorage.getUserTranslations()
- .done( function ( translations ) {
- if ( translations.translationstash.translations ) {
- translations.translationstash.translations.forEach( function ( translation ) {
- userTranslations[ translation.title ] = translation;
- } );
- }
- loadMessages();
- } );
- } );
-}() );
diff --git a/MLEB/Translate/resources/js/ext.translate.special.translationstats.js b/MLEB/Translate/resources/js/ext.translate.special.translationstats.js
index 093be515..108d71fc 100644
--- a/MLEB/Translate/resources/js/ext.translate.special.translationstats.js
+++ b/MLEB/Translate/resources/js/ext.translate.special.translationstats.js
@@ -92,20 +92,19 @@ var FormHandler = function () {
};
$( function () {
- var widget, defaultValue, defaultDate,
- $input = $( '#start' ),
+ var $input = $( '#start' ),
formHandler = new FormHandler(),
- $graphContainer = $( '#translationStatsGraphContainer' ),
- graphBuilder;
+ $graphContainer = $( '#translationStatsGraphContainer' );
- defaultDate = new Date();
+ var defaultDate = new Date();
defaultDate.setDate( 1 );
+ var defaultValue;
if ( $input.val() ) {
defaultValue = new Date( $input.val() );
}
- widget = new mw.widgets.datetime.DateTimeInputWidget( {
+ var widget = new mw.widgets.datetime.DateTimeInputWidget( {
formatter: {
format: '${year|0}-${month|0}-${day|0}',
defaultDate: defaultDate
@@ -122,7 +121,7 @@ $( function () {
// Check if the graph container has been loaded
if ( $graphContainer.length !== 0 ) {
- graphBuilder = new mw.translate.TranslationStatsGraphBuilder( $graphContainer );
+ var graphBuilder = new mw.translate.TranslationStatsGraphBuilder( $graphContainer );
graphBuilder.display( formHandler.getAllOptions() );
}
} );
diff --git a/MLEB/Translate/resources/js/ext.translate.statsbar.js b/MLEB/Translate/resources/js/ext.translate.statsbar.js
index 43ba29da..e60ee4a6 100644
--- a/MLEB/Translate/resources/js/ext.translate.statsbar.js
+++ b/MLEB/Translate/resources/js/ext.translate.statsbar.js
@@ -41,12 +41,11 @@
* Listen for the change events and update the statsbar
*/
listen: function () {
- var i,
- statsbar = this,
+ var statsbar = this,
languageStats = mw.translate.languagestats[ this.language ];
statsbar.$statsBar.on( 'change', function ( event, to, from ) {
- for ( i = 0; i < languageStats.length; i++ ) {
+ for ( var i = 0; i < languageStats.length; i++ ) {
if ( languageStats[ i ].group === statsbar.group ) {
// Changing a proofread message does not create a new translation
if ( to === 'translated' && from !== 'proofread' ) {
@@ -115,16 +114,15 @@
},
update: function () {
- var proofread, translated, fuzzy, untranslated,
- stats = this.getStatsForGroup( this.group );
+ var stats = this.getStatsForGroup( this.group );
- proofread = 100 * stats.proofread / stats.total;
+ var proofread = 100 * stats.proofread / stats.total;
// Proofread messages are also translated, so remove those for
// the bar showing only translated count.
- translated = stats.translated - stats.proofread;
+ var translated = stats.translated - stats.proofread;
translated = 100 * translated / stats.total;
- fuzzy = 100 * stats.fuzzy / stats.total;
- untranslated = 100 - proofread - translated - fuzzy;
+ var fuzzy = 100 * stats.fuzzy / stats.total;
+ var untranslated = 100 - proofread - translated - fuzzy;
this.elements.$proofread[ 0 ].style.width = proofread + '%';
this.elements.$translated[ 0 ].style.width = translated + '%';
@@ -147,10 +145,9 @@
},
getStatsForGroup: function ( group ) {
- var i,
- languageStats = mw.translate.languagestats[ this.language ];
+ var languageStats = mw.translate.languagestats[ this.language ];
- for ( i = 0; i < languageStats.length; i++ ) {
+ for ( var i = 0; i < languageStats.length; i++ ) {
if ( languageStats[ i ].group === group ) {
return languageStats[ i ];
}
diff --git a/MLEB/Translate/resources/js/ext.translate.translationstashstorage.js b/MLEB/Translate/resources/js/ext.translate.translationstashstorage.js
deleted file mode 100644
index 17350cf2..00000000
--- a/MLEB/Translate/resources/js/ext.translate.translationstashstorage.js
+++ /dev/null
@@ -1,57 +0,0 @@
-( function () {
- 'use strict';
-
- /**
- * This class can save translation to translation stash.
- *
- * @since 2013.10
- */
- var TranslationStashStorage = function () {
- // No-op for now. Could take api module as param for example.
- };
-
- TranslationStashStorage.prototype = {
- /**
- * Save the translation.
- *
- * @param {string} title The title of the page including language code
- * to store the translation.
- * @param {string} translation The translation of the message
- * @return {jQuery.Promise}
- */
- save: function ( title, translation ) {
- var api = new mw.Api();
-
- return api.postWithToken( 'csrf', {
- action: 'translationstash',
- subaction: 'add',
- title: title,
- translation: translation
- } ).then( function () {
- // Fake normal save API
- return { edit: { result: 'Success' } };
- } );
- },
-
- /**
- * Get the current users translations.
- *
- * @param {string} user User name
- * @return {jQuery.Promise}
- */
- getUserTranslations: function ( user ) {
- var api = new mw.Api();
-
- return api.postWithToken( 'csrf', {
- action: 'translationstash',
- subaction: 'query',
- username: user
- } ).promise();
- }
-
- };
-
- mw.translate = mw.translate || {};
- mw.translate.TranslationStashStorage = TranslationStashStorage;
-
-}() );
diff --git a/MLEB/Translate/resources/js/ext.translate.translationstats.embedded.js b/MLEB/Translate/resources/js/ext.translate.translationstats.embedded.js
index b0ec95fd..ca12fe16 100644
--- a/MLEB/Translate/resources/js/ext.translate.translationstats.embedded.js
+++ b/MLEB/Translate/resources/js/ext.translate.translationstats.embedded.js
@@ -57,11 +57,8 @@ $( function () {
// Create graph and options instances, then display loader
function initGraph( $graphContainer ) {
- var graphBuilder,
- graphOptions;
-
- graphOptions = new EmbeddedHandler( $graphContainer );
- graphBuilder = new mw.translate.TranslationStatsGraphBuilder(
+ var graphOptions = new EmbeddedHandler( $graphContainer );
+ var graphBuilder = new mw.translate.TranslationStatsGraphBuilder(
$graphContainer, graphOptions.getAllOptions()
);
graphBuilder.showLoading();
diff --git a/MLEB/Translate/resources/js/ext.translate.translationstats.graphbuilder.js b/MLEB/Translate/resources/js/ext.translate.translationstats.graphbuilder.js
index f5280041..c81a4c56 100644
--- a/MLEB/Translate/resources/js/ext.translate.translationstats.graphbuilder.js
+++ b/MLEB/Translate/resources/js/ext.translate.translationstats.graphbuilder.js
@@ -12,6 +12,7 @@
reviews: mw.msg( 'translate-statsf-count-reviews' ),
reviewers: mw.msg( 'translate-statsf-count-reviewers' )
}, granularityInfo = {
+ years: mw.msg( 'translate-statsf-scale-years' ),
months: mw.msg( 'translate-statsf-scale-months' ),
weeks: mw.msg( 'translate-statsf-scale-weeks' ),
days: mw.msg( 'translate-statsf-scale-days' ),
@@ -169,23 +170,23 @@
}
function getAxesLabelsAndData( jsonGraphData ) {
- var labelProp, labels = [], graphData = [],
- labelData, i, labelIndex = 0,
- currentValue, maxValue = 0, minValue = 0;
+ var labels = [], graphData = [],
+ labelIndex = 0,
+ maxValue = 0, minValue = 0;
- for ( labelProp in jsonGraphData ) {
+ for ( var labelProp in jsonGraphData ) {
if ( labels.indexOf( labelProp ) === -1 ) {
labels.push( labelProp );
}
- labelData = jsonGraphData[ labelProp ];
+ var labelData = jsonGraphData[ labelProp ];
- for ( i = 0; i < labelData.length; ++i ) {
+ for ( var i = 0; i < labelData.length; ++i ) {
if ( !graphData[ i ] ) {
graphData[ i ] = [];
}
- currentValue = labelData[ i ];
+ var currentValue = labelData[ i ];
graphData[ i ][ labelIndex ] = currentValue;
if ( currentValue < minValue ) {
minValue = currentValue;
@@ -296,16 +297,14 @@
}
function getTableBody( graphData ) {
- var $tbody = $( '<tbody>' ),
- scaleIndex, datasetIndex, $tBodyRow,
- columnValue;
+ var $tbody = $( '<tbody>' );
- for ( scaleIndex = 0; scaleIndex < graphData.axesLabels.length; scaleIndex++ ) {
- $tBodyRow = $( '<tr>' )
+ for ( var scaleIndex = 0; scaleIndex < graphData.axesLabels.length; scaleIndex++ ) {
+ var $tBodyRow = $( '<tr>' )
.append( $( '<td>' ).text( graphData.axesLabels[ scaleIndex ] ) );
- for ( datasetIndex = 0; datasetIndex < graphData.data.length; datasetIndex++ ) {
- columnValue = '';
+ for ( var datasetIndex = 0; datasetIndex < graphData.data.length; datasetIndex++ ) {
+ var columnValue = '';
if (
graphData.data[ datasetIndex ] &&
graphData.data[ datasetIndex ][ scaleIndex ] !== undefined
diff --git a/MLEB/Translate/resources/js/ext.translate.workflowselector.js b/MLEB/Translate/resources/js/ext.translate.workflowselector.js
index b9d86f67..736bcf5d 100644
--- a/MLEB/Translate/resources/js/ext.translate.workflowselector.js
+++ b/MLEB/Translate/resources/js/ext.translate.workflowselector.js
@@ -58,10 +58,9 @@
* @return {jQuery.Promise}
*/
changeState: function ( state ) {
- var params,
- api = new mw.Api();
+ var api = new mw.Api();
- params = {
+ var params = {
action: 'groupreview',
group: this.groupId,
language: this.language,
@@ -85,18 +84,17 @@
* Actually constructs the DOM and displays the selector.
*/
display: function () {
- var instance = this,
- $display, $list;
+ var instance = this;
instance.$container.empty();
if ( !instance.states ) {
return;
}
- $list = $( '<ul>' )
+ var $list = $( '<ul>' )
.addClass( 'tux-dropdown-menu tux-workflow-status-selector hide' );
- $display = $( '<div>' )
+ var $display = $( '<div>' )
.addClass( 'tux-workflow-status' )
.text( mw.msg( 'translate-workflow-state-' ) )
.on( 'click', function ( e ) {
@@ -130,10 +128,9 @@
} );
$list.find( '.changeable' ).on( 'click', function () {
- var state,
- $this = $( this );
+ var $this = $( this );
- state = $this.data( 'state' ).id;
+ var state = $this.data( 'state' ).id;
$display.text( mw.msg( 'translate-workflow-set-doing' ) );
$display.append( $( '<span>' ).addClass( 'tux-workflow-status-triangle' ) );
diff --git a/MLEB/Translate/resources/js/jquery.ajaxdispatcher.js b/MLEB/Translate/resources/js/jquery.ajaxdispatcher.js
index d9fe3b7a..feaac555 100644
--- a/MLEB/Translate/resources/js/jquery.ajaxdispatcher.js
+++ b/MLEB/Translate/resources/js/jquery.ajaxdispatcher.js
@@ -24,19 +24,18 @@
}
function helper( list, maxRetries ) {
- var first, rest, retries, retrier,
- deferred = $.Deferred();
+ var deferred = $.Deferred();
if ( list.length === 0 ) {
deferred.resolve( [] );
return deferred;
}
- first = list.slice( 0, 1 )[ 0 ];
- rest = list.slice( 1 );
+ var first = list.slice( 0, 1 )[ 0 ];
+ var rest = list.slice( 1 );
- retries = 0;
- retrier = function ( result, promise ) {
+ var retries = 0;
+ var retrier = function ( result, promise ) {
if ( !promise.state ) {
return;
}
diff --git a/MLEB/Translate/resources/js/jquery.textchange.js b/MLEB/Translate/resources/js/jquery.textchange.js
deleted file mode 100644
index fd40790c..00000000
--- a/MLEB/Translate/resources/js/jquery.textchange.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*!
- * Trigger a textchange event on text change in input fields.
- * And make it cross browser compatible.
- *
- * @author Santhosh Thottingal, 2013
- * @see https://gist.github.com/mkelly12/424774
- */
-( function () {
- 'use strict';
-
- $.event.special.textchange = {
-
- setup: function () {
- $( this )
- .data( 'lastValue', $( this ).val() )
- .on( 'keyup.textchange', $.event.special.textchange.handler )
- .on( 'cut.textchange paste.textchange input.textchange', $.event.special.textchange.delayedHandler );
- },
-
- teardown: function () {
- $( this ).off( '.textchange' );
- },
-
- handler: function () {
- $.event.special.textchange.triggerIfChanged( $( this ) );
- },
-
- delayedHandler: function () {
- var $element = $( this );
- setTimeout( function () {
- $.event.special.textchange.triggerIfChanged( $element );
- }, 25 );
- },
-
- triggerIfChanged: function ( element ) {
- var current = element.val();
- if ( current !== element.data( 'lastValue' ) ) {
- element.trigger( 'textchange', [ element.data( 'lastValue' ) ] );
- element.data( 'lastValue', current );
- }
- }
- };
-
-}() );
diff --git a/MLEB/Translate/resources/src/.eslintrc.json b/MLEB/Translate/resources/src/.eslintrc.json
new file mode 100644
index 00000000..cfa86a9b
--- /dev/null
+++ b/MLEB/Translate/resources/src/.eslintrc.json
@@ -0,0 +1,5 @@
+{
+ "rules": {
+ "no-implicit-globals": "off"
+ }
+}
diff --git a/MLEB/Translate/resources/css/ext.translate.special.translationstash.css b/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.css
index f451cb53..f451cb53 100644
--- a/MLEB/Translate/resources/css/ext.translate.special.translationstash.css
+++ b/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.css
diff --git a/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.js b/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.js
new file mode 100644
index 00000000..ecec0ca4
--- /dev/null
+++ b/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/index.js
@@ -0,0 +1,252 @@
+/*!
+ * TranslationStash front-end logic.
+ *
+ * @author Santhosh Thottingal
+ * @license GPL-2.0-or-later
+ * @since 2013.10
+ */
+'use strict';
+
+var userTranslations = {},
+ TranslationStashStorage = require( './storage.js' ),
+ translationStorage = new TranslationStashStorage();
+
+mw.translate.canTranslate = function () {
+ // At this page, the new translator can translate
+ return true;
+};
+
+function getMessages( messageGroup, language, offset, limit ) {
+ var deferred = new mw.Api().get( {
+ action: 'query',
+ list: 'messagecollection',
+ mcgroup: messageGroup,
+ mclanguage: language,
+ mcoffset: offset,
+ mclimit: limit,
+ mcprop: 'definition'
+ } );
+
+ return deferred.promise();
+}
+
+function addMessage( message ) {
+ var $messageTable = $( '.tux-messagelist' ),
+ sourceLanguage = $messageTable.data( 'sourcelangcode' ),
+ sourceLanguageDir = $.uls.data.getDir( sourceLanguage ),
+ targetLanguage = $messageTable.data( 'targetlangcode' ),
+ targetLanguageDir = $.uls.data.getDir( targetLanguage ),
+ status = message.properties.status,
+ statusClass = 'tux-status-' + status;
+
+ var statusMsg;
+ if ( status === 'translated' ) {
+ // tux-status-translated
+ statusMsg = 'tux-status-' + status;
+ }
+
+ var $messageWrapper = $( '<div>' )
+ .addClass( 'row tux-message' );
+
+ var $message = $( '<div>' )
+ .addClass( 'row message tux-message-item ' + status )
+ .append(
+ $( '<div>' )
+ .addClass( 'eight columns tux-list-message' )
+ .append(
+ $( '<span>' )
+ .addClass( 'tux-list-source' )
+ .attr( {
+ lang: sourceLanguage,
+ dir: sourceLanguageDir
+ } )
+ .text( message.definition ),
+ // Bidirectional isolation.
+ // This should be removed some day when proper
+ // unicode-bidi: isolate
+ // is supported everywhere
+ $( '<span>' )
+ .html( $( document.body ).hasClass( 'rtl' ) ? '&rlm;' : '&lrm;' ),
+ $( '<span>' )
+ .addClass( 'tux-list-translation' )
+ .attr( {
+ lang: targetLanguage,
+ dir: targetLanguageDir
+ } )
+ .text( message.translation || '' )
+ ),
+ $( '<div>' )
+ .addClass( 'two columns tux-list-status text-center' )
+ .append(
+ $( '<span>' )
+ .addClass( statusClass )
+ // The following messages are used here:
+ // * tux-status-optional
+ // * tux-status-fuzzy
+ // * tux-status-proofread
+ // * tux-status-translated
+ // * tux-status-saving
+ // * tux-status-unsaved
+ .text( statusMsg ? mw.msg( statusMsg ) : '' )
+ ),
+ $( '<div>' )
+ .addClass( 'two column tux-list-edit text-right' )
+ .append(
+ $( '<a>' )
+ .attr( {
+ title: mw.msg( 'translate-edit-title', message.key )
+ } )
+ .text( mw.msg( 'tux-edit' ) )
+ )
+ );
+
+ $messageWrapper.append( $message );
+ $messageTable.append( $messageWrapper );
+ // Attach translate editor to the message
+ $messageWrapper.translateeditor( {
+ message: message,
+ storage: translationStorage,
+ onSave: updateStats,
+ onSkip: function () {
+ var $next = this.$editTrigger.next( '.tux-message' );
+
+ // If there is text in the skipped message, avoid showing the
+ // regular "you have unsaved messages" when navigating away,
+ // because there is no way to get back to these messages.
+ this.markUnunsaved();
+
+ // This can happen when it's
+ // the last message in the translation stash
+ if ( !$next.length ) {
+ // Reload the page to get more messages
+ // when we get to the last one
+ window.location.reload();
+ }
+ },
+ onReady: function () {
+ this.$editor.find( '.tux-editor-skip-button' )
+ .text( mw.msg( 'translate-translationstash-skip-button-label' ) );
+ }
+ } );
+}
+
+/**
+ * Updates the translation count at the top of the message list and
+ * displays warning when translation limit has been reached.
+ * Relies on classes stash-stats and tux-status-translated.
+ */
+function updateStats() {
+ var $target = $( '.stash-stats' );
+
+ var count = $( '.tux-status-translated' ).length;
+ if ( count === 0 ) {
+ return;
+ }
+
+ $target.text( mw.msg(
+ 'translate-translationstash-translations',
+ mw.language.convertNumber( count )
+ ) );
+
+ if ( count >= mw.config.get( 'wgTranslateSandboxLimit' ) ) {
+ // Remove the untranslated message to disallow translation beyond the limit
+ $( '.tux-message' ).has( '.untranslated' ).remove();
+
+ // Show a message telling that the limit was reached
+ $( '.limit-reached' )
+ .empty()
+ .append( $( '<h1>' ).text( mw.msg( 'tsb-limit-reached-title' ) ) )
+ .append( $( '<p>' ).text( mw.msg( 'tsb-limit-reached-body' ) ) )
+ .removeClass( 'hide' );
+ }
+}
+
+function loadMessages() {
+ var $messageTable = $( '.tux-messagelist' ),
+ messagegroup = '!sandbox';
+
+ $( '<div>' )
+ .addClass( 'tux-loading-indicator' )
+ .appendTo( $messageTable );
+
+ getMessages( messagegroup, $messageTable.data( 'targetlangcode' ) )
+ .done( function ( result ) {
+ var messages = result.query.messagecollection;
+
+ $messageTable.empty();
+ messages.forEach( function ( message ) {
+ message.properties = {};
+ message.properties.status = 'untranslated';
+
+ message.group = messagegroup;
+ if ( userTranslations[ message.title ] ) {
+ message.translation = userTranslations[ message.title ].translation;
+ message.properties.status = 'translated';
+ }
+
+ addMessage( message );
+ } );
+
+ // Show the editor for the first untranslated message.
+ var $untranslated = $( '.tux-message' )
+ .has( '.tux-message-item.untranslated' )
+ .first();
+ if ( $untranslated.length ) {
+ $untranslated.data( 'translateeditor' ).show();
+ }
+
+ updateStats();
+ } ).fail( function ( errorCode, response ) {
+ $messageTable.empty().addClass( 'error' )
+ .text( 'Error: ' + errorCode + ' - ' +
+ ( response.error && response.error.info || 'Unknown error' )
+ );
+ } );
+}
+
+$( function () {
+ var $messageTable = $( '.tux-messagelist' ),
+ $ulsTrigger = $( '.ext-translate-language-selector > .uls' );
+
+ // Some links in helpers will navigate away by default. But since the messages
+ // will change on this page on every load, we want to avoid that. Force the
+ // links to open on new window/tab.
+ mw.hook( 'mw.translate.editor.showTranslationHelpers' ).add( function ( helpers, $editor ) {
+ $editor.find( 'a' ).prop( 'target', '_blank' );
+ } );
+
+ $ulsTrigger.uls( {
+ ulsPurpose: 'translate-special-translationstash',
+ onSelect: function ( language ) {
+ var direction = $.uls.data.getDir( language ),
+ autonym = $.uls.data.getAutonym( language );
+
+ $ulsTrigger
+ .text( autonym )
+ .attr( {
+ lang: language,
+ dir: direction
+ } );
+
+ $messageTable
+ .empty()
+ .data( {
+ targetlangcode: language,
+ targetlangdir: direction
+ } );
+
+ loadMessages();
+ }
+ } );
+ // Get the user translations if any(possibly from an early attempt)
+ // and new messages to try.
+ translationStorage.getUserTranslations()
+ .done( function ( translations ) {
+ if ( translations.translationstash.translations ) {
+ translations.translationstash.translations.forEach( function ( translation ) {
+ userTranslations[ translation.title ] = translation;
+ } );
+ }
+ loadMessages();
+ } );
+} );
diff --git a/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/storage.js b/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/storage.js
new file mode 100644
index 00000000..22821aed
--- /dev/null
+++ b/MLEB/Translate/resources/src/ext.translate.specialTranslationStash/storage.js
@@ -0,0 +1,52 @@
+'use strict';
+
+/**
+ * This class can save translation to translation stash.
+ *
+ * @since 2013.10
+ */
+var TranslationStashStorage = function () {
+ // No-op for now. Could take api module as param for example.
+};
+
+TranslationStashStorage.prototype = {
+ /**
+ * Save the translation.
+ *
+ * @param {string} title The title of the page including language code
+ * to store the translation.
+ * @param {string} translation The translation of the message
+ * @return {jQuery.Promise}
+ */
+ save: function ( title, translation ) {
+ var api = new mw.Api();
+
+ return api.postWithToken( 'csrf', {
+ action: 'translationstash',
+ subaction: 'add',
+ title: title,
+ translation: translation
+ } ).then( function () {
+ // Fake normal save API
+ return { edit: { result: 'Success' } };
+ } );
+ },
+
+ /**
+ * Get the current users translations.
+ *
+ * @param {string} user User name
+ * @return {jQuery.Promise}
+ */
+ getUserTranslations: function ( user ) {
+ var api = new mw.Api();
+
+ return api.postWithToken( 'csrf', {
+ action: 'translationstash',
+ subaction: 'query',
+ username: user
+ } ).promise();
+ }
+};
+
+module.exports = TranslationStashStorage;
diff --git a/MLEB/Translate/resources/src/ve-translate/.eslintrc.json b/MLEB/Translate/resources/src/ve-translate/.eslintrc.json
new file mode 100644
index 00000000..1d9cfb0a
--- /dev/null
+++ b/MLEB/Translate/resources/src/ve-translate/.eslintrc.json
@@ -0,0 +1,5 @@
+{
+ "globals": {
+ "ve": "readonly"
+ }
+}
diff --git a/MLEB/Translate/resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js b/MLEB/Translate/resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js
new file mode 100644
index 00000000..1d000e11
--- /dev/null
+++ b/MLEB/Translate/resources/src/ve-translate/ve.ce.MWTranslateAnnotationNode.js
@@ -0,0 +1,31 @@
+/*!
+ * VisualEditor ContentEditable MWTranslateAnnotationNode class.
+ */
+
+/**
+ * ContentEditable MediaWiki translate annotation node.
+ *
+ * @class
+ * @abstract
+ * @extends ve.ce.MWAnnotationNode
+ *
+ * @constructor
+ * @param {ve.dm.MWTranslateAnnotationNode} model Model to observe
+ * @param {Object} [config] Configuration options
+ */
+ve.ce.MWTranslateAnnotationNode = function VeCeMWTranslateAnnotationNode() {
+ // Parent constructor
+ ve.ce.MWTranslateAnnotationNode.super.apply( this, arguments );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ce.MWTranslateAnnotationNode, ve.ce.MWAnnotationNode );
+
+/* Static members */
+
+ve.ce.MWTranslateAnnotationNode.static.name = 'mwTranslateAnnotation';
+
+/* Registration */
+
+ve.ce.nodeFactory.register( ve.ce.MWTranslateAnnotationNode );
diff --git a/MLEB/Translate/resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js b/MLEB/Translate/resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js
new file mode 100644
index 00000000..d2e8d898
--- /dev/null
+++ b/MLEB/Translate/resources/src/ve-translate/ve.dm.MWTranslateAnnotationNode.js
@@ -0,0 +1,58 @@
+/*!
+ * VisualEditor DataModel MWTranslateAnnotationNode class.
+ */
+
+/**
+ * DataModel MediaWiki translate annotation node.
+ *
+ * @class
+ * @abstract
+ * @extends ve.dm.MWAnnotationNode
+ *
+ * @constructor
+ * @param {Object} [element] Reference to element in linear model
+ * @param {ve.dm.Node[]} [children]
+ */
+ve.dm.MWTranslateAnnotationNode = function VeDmMWTranslateAnnotationNode() {
+ // Parent constructor
+ ve.dm.MWTranslateAnnotationNode.super.apply( this, arguments );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.dm.MWTranslateAnnotationNode, ve.dm.MWAnnotationNode );
+
+/* Static members */
+
+ve.dm.MWTranslateAnnotationNode.static.name = 'mwTranslateAnnotation';
+
+ve.dm.MWTranslateAnnotationNode.static.matchRdfaTypes = [
+ 'mw:Annotation/translate',
+ 'mw:Annotation/translate/End',
+ 'mw:Annotation/tvar',
+ 'mw:Annotation/tvar/End'
+];
+
+/* Methods */
+
+ve.dm.MWTranslateAnnotationNode.static.toDataElement = function ( domElements ) {
+ // 'Parent' method
+ var element = ve.dm.MWTranslateAnnotationNode.super.static.toDataElement.call( this, domElements );
+
+ element.type = 'mwTranslateAnnotation';
+ return element;
+};
+
+ve.dm.MWTranslateAnnotationNode.prototype.getWikitextTag = function () {
+ var map = {
+ 'mw:Annotation/translate': '<translate>',
+ 'mw:Annotation/translate/End': '</translate>',
+ 'mw:Annotation/tvar': '<tvar>',
+ 'mw:Annotation/tvar/End': '</tvar>'
+ };
+ return map[ this.getAttribute( 'type' ) ];
+};
+
+/* Registration */
+
+ve.dm.modelRegistry.register( ve.dm.MWTranslateAnnotationNode );
diff --git a/MLEB/Translate/resources/src/ve-translate/ve.ui.MWTranslateAnnotationContextItem.js b/MLEB/Translate/resources/src/ve-translate/ve.ui.MWTranslateAnnotationContextItem.js
new file mode 100644
index 00000000..a69a0953
--- /dev/null
+++ b/MLEB/Translate/resources/src/ve-translate/ve.ui.MWTranslateAnnotationContextItem.js
@@ -0,0 +1,64 @@
+/*!
+ * VisualEditor MWTranslateAnnotationContextItem class.
+ */
+
+/**
+ * Context item for a MWTranslateAnnotation
+ *
+ * @class
+ * @extends ve.ui.MWAnnotationContextItem
+ *
+ * @constructor
+ * @param {ve.ui.Context} context Context item is in
+ * @param {ve.dm.Model} model Model item is related to
+ * @param {Object} config Configuration options
+ */
+ve.ui.MWTranslateAnnotationContextItem = function VeUiMWTranslateAnnotationContextItem() {
+ // Parent constructor
+ ve.ui.MWTranslateAnnotationContextItem.super.apply( this, arguments );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.MWTranslateAnnotationContextItem, ve.ui.MWAnnotationContextItem );
+
+/* Static Properties */
+
+ve.ui.MWTranslateAnnotationContextItem.static.name = 'mwTranslateAnnotation';
+
+ve.ui.MWTranslateAnnotationContextItem.static.modelClasses = [
+ ve.dm.MWTranslateAnnotationNode
+];
+
+/* Methods */
+
+ve.ui.MWTranslateAnnotationContextItem.prototype.getLabelMessage = function () {
+ var map = {
+ 'mw:Annotation/translate': 'visualeditor-annotations-translate-start',
+ 'mw:Annotation/translate/End': 'visualeditor-annotations-translate-end',
+ 'mw:Annotation/tvar': 'visualeditor-annotations-tvar-start',
+ 'mw:Annotation/tvar/End': 'visualeditor-annotations-tvar-end'
+ };
+
+ var type = this.model.getAttribute( 'type' );
+ // eslint-disable-next-line mediawiki/msg-doc
+ var msg = mw.message( map[ type ] );
+ return msg.text();
+};
+
+ve.ui.MWTranslateAnnotationContextItem.prototype.getDescriptionMessage = function () {
+ var type = this.model.getAttribute( 'type' );
+ if ( type.indexOf( '/End', type.length - 4 ) !== -1 ) {
+ return '';
+ }
+ var map = {
+ 'mw:Annotation/translate': 'visualeditor-annotations-translate-description',
+ 'mw:Annotation/tvar': 'visualeditor-annotations-tvar-description'
+ };
+
+ // eslint-disable-next-line mediawiki/msg-doc
+ var msg = mw.message( map[ type ] );
+ return msg.parseDom();
+};
+
+ve.ui.contextItemFactory.register( ve.ui.MWTranslateAnnotationContextItem );