User talk:Ebrahim/ArticleTranslator.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

JUST COPY THIS ON YOUR COMMON.JS[edit]

window.articleTranslatorConf = {
    'homeWiki': 'YOUR_HOME_WIKI_LANGUAGE_CODE'
};
importScript('User:Ebrahim/ArticleTranslator.js');

About this tool[edit]

This tool is useful for translating wikipedia links according to interwikis also it has some statistics options:

  1. Translating links in Read mode (adding target wiki links near the original)
  2. Translating links in edit mode (replacing target links instead of original one)
  3. Counting number of interwikis that are linked to pages that are not in target wiki (by pressing + button near the page title)
  4. Search words translation in Google translation and Google search engine (by pressing = button near the page title)
  5. Constructing list of pages that are not in target wiki and sort it according to number of interwikis and number of Special:WhatLinksHere (by pressing + button near the page title)

For more information, if you know Persian see fa:ویکی‌پدیا:راهنمای ابزار کمک مترجم otherwise use Google translation :)

Customizing[edit]

Using this code

For using this code you can customize it with this variables and you should put this code in Special:Mypage/common.js

window.articleTranslatorConf = {
    'homeWiki': 'fa',
    'fromLang': 'en',
    'translatorBarFormat': '$1translate$2 links from $3 to $4 ($5)',
    'templateTranslatorText': 'Template translation',
    'removeLinksAliasesText': 'Remove Links Aliases',
    'doneText': 'Done!',
    'enableTemplateTranslation': true,
    'removeLinksAliases': true,
    'enableNeedingShow': false,
    'name': 'Name',
    'interwikiCount': 'Interwiki Count',
    'linkedTo': 'Linked to',
    'listOfUnavailablePagesOn': 'List of not available pages on'
};

Every parameter (line) is optional and if you don't specify it, it will fallback to script defaults. For example if you just want to change the home wiki, this would be enough:

window.articleTranslatorConf = {
    'homeWiki': 'fr'
};

Here is a sample for this gadget translation/localization.

Disable on special pages[edit]

Hi Ebraminio!

Could you change the script so it is not enabled on special pages? Helder 11:16, 16 November 2013 (UTC)[reply]

Hi Helder.wiki. It is very nice for me that you are using the script! :) IMHO special pages are also good to have the feature generally and disabling the script there is making users flexibility less so I think it is better to leave this on :) But if you don't like this enabled on a special special page(!) please bring a example about it. Thank you :) –ebraminiotalk 23:48, 9 January 2014 (UTC)[reply]

TfD that may be of interest[edit]

This script is part of the discussion on Wikipedia:Templates for discussion/Log/2016 March 18#Template:English to urdu wikipedia —PC-XT+ 05:23, 19 March 2016 (UTC) 22:42, 19 March 2016 (UTC)[reply]

Script showing up in Category:Pages using invalid self-closed HTML tags[edit]

Your script, and copies of it, are showing up in Category:Pages using invalid self-closed HTML tags. Can you please fix it by changing both instances of <span id="..." /> to <span id="..."></span>? Let me know if you have any questions. Thanks. – Jonesey95 (talk) 20:17, 31 October 2017 (UTC)[reply]

Jonesey95: Done. Thanks :) −ebrahimtalk 21:10, 27 November 2017 (UTC)[reply]

Script Not working[edit]

First, this script is nice, but there is a problem, we use it in sd.wikipedia, but suddenly it stopped working, don't know what happened, it will be great help if you solve this problem for us. if you want to search for the script in sd.wikipedia, just type, MediaWiki:Tourwiki - Thanks in advance. Arslanali (talk) 15:12, 25 October 2018 (UTC)[reply]

Ar language[edit]

Hello. I want to use this tool to translate links from en to ar, not fa. What should I write in User:Avocato/common.js?--Avocato (talk) 12:43, 17 May 2019 (UTC)[reply]

User:Avocato: Hi! You will need something like this,
window.articleTranslatorConf = {
  homeWiki: 'ar', // home wiki, which language you want links to be translated to by default
  fromLang: mw.config.get('wgPageContentLanguage'), // from language, which language you want links to be translated from by default, usually the wiki you are in anyway
  translatorBarFormat: '$1translate$2 links from $3 to $4 $5', // translate what is in quotes except $1 $2 $3 $4 $5 which are placeholders
  templateTranslatorText: 'Template translation', // translate what is in quotes
  removeLinksAliasesText: 'Remove Links Aliases', // translate what is in quotes
  interwikiCount: 'Language links count', // translate what is in quotes
  linkedTo: 'Linked to', // translate what is in quotes
  listOfUnavailablePagesOn: 'List of not present pages on' // translate what is in quotes
};
importScript('User:Ebrahim/ArticleTranslator.js');

But if you are using this in English Wikipedia anyway, what you got already is ok. Thanks :) −ebrahimtalk 12:35, 11 May 2021 (UTC)[reply]

user-select[edit]

@Ebrahim: when you enable, a phrase is added after the page the title threads something like "translate links from en to fa". If you triple-click on the page title to select it, this phrase is also selected which is not desirable. The solution is to make sure <span id="translatorBar"> has the user-select CSS property set to none.

I think the best approach is to create a page called User:Ebrahim/ArticleTranslator.css on enwiki, then use importStylesheet at the top of fa:MediaWiki:Tofawiki.js to load this CSS page. The content of the CSS page should be:

span#translatorBar, span#translatorBar * {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

We use a similar one in fa:MediaWiki:Gadget-close.css for that same reason. hujiTALK 16:49, 11 March 2020 (UTC)[reply]

This is fixed eventually however needed some more workaround in order to make it work in all the different browsers (this was alone was breaking Safari that's why I didn't apply it immediately). −ebrahimtalk 12:35, 11 May 2021 (UTC)[reply]

A tool with a similar function[edit]

Hi, do you know about Wikipedia:Lacmus? JWBTH (talk) 17:01, 26 May 2023 (UTC)[reply]

Interesting, thanks for sharing 😊 −ebrahimtalk 06:13, 14 April 2024 (UTC)[reply]