User:Ohconfucius/EngvarB
This user page needs to be updated. The reason given is: {{EngvarB}} is now deprecated per this discussion and some of templates described below don't exist (e.g., {{EngvarU}}) or have different preferred names now. Please help update this user page to reflect recent events or newly available information. Relevant discussion may be found on the talk page. (November 2024) |
Please leave a . |
Preamble
[edit]- 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 ought to be in British English.
Scope
[edit]The EngvarB script is at User:Ohconfucius/script/EngvarB.js.
- It ensures consistency where Commonwealth English is already predominantly used in an article or should be based on WP:TIES. Its dictionary is limited, and the script may be used on articles about Bangladeshi, Hong Kong, Irish, Indian, Malaysian, Pakistani, New Zealand, Singaporean, or South African subjects. It will convert instances of non-British words detected to 'British spelling', on the basis of American and British English spelling differences. The script must never be used on an article which is already tagged for a national variety of English.
- The script buttons cater for different major codes of English, and it is compatible with:
- Oxford English spelling (OED); that is, users have the option of leaving -iza-, -ize-, and -izi- words untouched; the other option being to change the "s" forms to the "z" forms. (note that 'analyze', 'paralyze' are pure Americanisms, and will be converted to the s-forms regardless of the option chosen)
- Canadian English where -iza-, -ize-, and -izi- words untouched; and -isa-, -ise-, and -isi words are converted to American code. -our words ('Favour', 'colour') are default for this code.
- American English where -iza-, -ize-, and -izi- words untouched; and -isa-, -ise-, and -isi words are converted to American code. See American and British English spelling differences
- Words within blockquotes, references, image names, categories and quote boxes are protected.
- Because simple or double quotation-marks (' or ") are ambiguous, and it is close to impossible to identify pairing, anything bounded by them is treated as plain text. In other words, instances of American spelling occurring between such quote marks are processed and not ignored: a string such as "anemic rigor" will be changed to "anaemic rigour".
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
[edit]- Oxford spelling
- Wikipedia:Manual of Style (spelling)/Words ending with "-ise" or "-ize"
- User:Mclay1/Britishisms
- Wikipedia:WikiProject User scripts/Scripts/Language Converter/Dictionary/en-GB
- User:Ohconfucius/U.S. Spelling versus British and Canadian Spellings
- User:Angr/Unified English Spelling – for interest only
Credits
[edit]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
[edit]- 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.
- 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]]
- Save the page and (re-)load it – refresh the cache by following the instructions at the top of your JavaScript page.
- 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.
- If you have automatic userscript installation enabled, you can simply visit User:Ohconfucius/script/EngvarB.js and click "Install" at the top of the page.
Actions and test
[edit]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
[edit]- Upper-case words, usually denoting proper nouns or headings, are left untouched;
- Instances of words immediately preceded by spaces ( ), square brackets ([), pipe symbols (|) and asterisks (*) will be converted; instances wrapped within single or double quotes (', ") will remain untouched.
- Words that have ambiguous spellings are not changed; 'center' and 'color' are unaltered, as are used in html and formatting parameters. However, words using these as a stem, where unambiguous, are expected to be changed by the script.
- Complex nested structures (for example, infoxes or citation templates with other templates embedded) may cause the script to fail to perform properly.
- Due to uncontrolled template proliferation, false positives may be caused by unanticipated non-protection of certain template parameter names.
- The script is not a replacement for diligent reading and copyediting to remove words or expressions in perceived American code never used in British vernacular (for example, "to date [somebody]"; "accountabilization" or other similar verbs ending in "ize" that are made into nouns by concatenating "ation").
- Please notify me if you come across instances where:
- "color", when used in formatting, has been changed to "colour".
- "gray", when used in formatting, has been changed to "grey".
Known conflicts
[edit]It has been reported that a possible conflict may exist with User:BrandonXLF/FloatSide.js, causing the EngvarB not to load.
See also
[edit]