Preamble

Within-article consistency of spelling variety

By long-standing convention and as detailed at the Manual of Style, a Wikipedia article needs to consistently use one variety of English. Because editors come from all over the English-speaking world, articles are vulnerable to creeping inconsistency in spelling. These inconsistencies are often difficult to identify quickly, and this script has been developed as an aid to the careful manual oversight of spelling.

The variety is prescribed where an article is related to one of the seven ancestral English-speaking countries; in other cases, the existing variety used in an article—where this is clear—is retained for the sake of stability. according to the EU style guide for publications, British English is the official code of English to be employed for the European Union. This appears to imply that the relevant code for en.WP articles about the EU and its member states ought to be in British English.

Scope

The EngvarB script is at User:Ohconfucius/script/EngvarB.js.

The script adds a non-displaying template ((EngvarB)), ((EngvarOx)), ((EngvarC)) and ((EngvarU)) depending on the conversion used. This tagging allows for easy future maintenance for anybody armed with this script or a suitable AWB module, such as mine (available here).

See also

Credits

This javascript tool is my own work; invaluable assistance has been received from Helder.wiki, and subsequently from Lordtobi, to reorganise and rewrite this code.

Feedback is appreciated at User Talk:Ohconfucius. Please report false negatives as well as false positives. You will find an archive of my talk page exchanges specific to this script on the talk page to this.

Installing the script

  1. Open your common.js in edit mode (alternatively, go to your user page and append "/common.js" to the end of the URL and open the page in edit mode).
    • If you prefer to load this only on a specific skin, such as monobook, open your monobook.js in edit mode.
    • If you make a straight copy of this script, instead of "importing" it, you may not benefit from the enhancements and bug-fixes that are made from time to time. In the latter case, you may choose to watchlist this page so you will know when to update your copy for modifications to this script.
  2. Copy the following code onto the JavaScript page you have chosen in the previous step:
    importScript('User:Ohconfucius/script/EngvarB.js'); // [[User:Ohconfucius/script/EngvarB.js]]
    
  3. Save the page and (re-)load it – refresh the cache by following the instructions at the top of your JavaScript page.
  4. Bookmark the script page. This will be your cue to purge the cache on your browser for any updates to take effect.

Disclaimer: Use at your own risk and make sure you check the edit changes before you save.

Actions and test

Use of the Safari browser is highly recommended. The script may take a long time to execute because of the complexities (mainly in the number of lines) of protection mechanism, but I have found it consistently executes much faster in Safari than Firefox, but feel free to give me your feedback on that issue. One instance of failure of execution has been reported.

Once you are in edit mode, there are two sidebar buttons in the toolbox in the left margin, revealed by clicking on the small triangle marked "scripts"

  • Flip Convert function – changes unit order in output of ((convert)), rendering of Imperial units first.
  • AMERICAN function – converts occurrences in the body of the text to American English spelling (with z-words, 'our', and others)
  • COMMONWEALTH function – converts occurrences in the body of the text to Commonwealth English (without z-words), inserts ((EngvarB)) template.
  • BRITISH (Oxford) function – converts occurrences in the body of the text to Oxford English spelling (with some z-words)
  • CANADIAN function – converts occurrences in the body of the text to Canadian English spelling (with z-words, and others)

Known limitations

Known conflicts

It has been reported that a possible conflict may exist with User:BrandonXLF/FloatSide.js, causing the EngvarB not to load.

See also