User talk:Ohconfucius/EngvarB

From Wikipedia, the free encyclopedia
Jump to: navigation, search

OBJECTIVE: The discussion here concerns any discussion involving the development of the Engvar script. These were originally posted to my talk page but are preserved here as a record of its evolution.

Postings concerning the script but involving minor bug reports – ones that do not result in significant upgrade – will be included if I believe may be useful for future reference.

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

ENGVAR script[edit]

G'day! Just a quick note: it appears that your script does not recognise "urbanized" when converting to the -ise spelling. Would you be able to correct this? Cheers, Hayden120 (talk) 11:37, 19 July 2010 (UTC)

  • Usually, the word 'urbanized', like '~ized/~ization', will be transformed. I have just tested it, and it seems to work as intended. However, I suspect that the instance where it did not convert was due to its being within a <ref> template, where these conversions are best avoided - we try to keep quotes and their spellings 'verbatim'. I presume you are referring to this text. I ran the code, and indeed 'industrialized' was converted but 'urbanized' apparently missed. For the moment, I cannot explain this inconsistency. I would have to examine the code more precisely, and maybe make a tweak to it based on the findings. Ohconfucius ¡digame! 01:48, 20 July 2010 (UTC)
    • I think that the protection code would treat the whole citation as a single string, and act on one 'z-word' instance only. It would have protected the first instance (ie 'urbanized') and not the second instance (ie 'industrialized'), so that when the conversion code acted, it changed 'industrialized' to 'industrialised', leaving 'urbanized' untouched. I have now modified the code to catch a second instance. Thank you for your feedback. Ohconfucius ¡digame! 02:10, 20 July 2010 (UTC)
Ah, I see. I didn't notice that those words were inside a citation; I would have left them if I did. I'll change them back. Thanks, Hayden120 (talk) 03:01, 20 July 2010 (UTC)
I just had the same problem again, here, for "neutralises". It was the third instance of the spelling in a quotation. Would you please be able to alter the script so it does not modify citations? Many thanks, Hayden120 (talk) 10:25, 30 July 2010 (UTC)

User:Ohconfucius/EngvarB.js[edit]

Suggestion I suggest that you make the script ignore text within category names to keep this from happening (scroll to the bottom, of course.) —Justin (koavf)TCM☯ 15:26, 24 July 2010 (UTC)

Suggestion: Read the documentation: it is very clear that this sort of thing is going to happen, and any editor who uses the script needs to be vigilant, as I was - I manually reverted the category (scroll to the bottom, of course). Radiopathy •talk• 18:39, 24 July 2010 (UTC)
  • Thanks for alerting me. Problem is now fixed. Ohconfucius ¡digame! 21:58, 24 July 2010 (UTC)
  • @ Radiopathy: I noticed that you have a monobook.js and vector.js, and that Engvar.js is imported into the monobook. Just to inform you it can be used in the new skin too. Ohconfucius ¡digame! 22:07, 24 July 2010 (UTC)
Thanks...now what does that mean?!? Radiopathy •talk• 22:25, 24 July 2010 (UTC)
  • I don't know whether you're using the new skin or old, or both, but you import 'User:Smith609/toolbox.js' into your vector file (new skin) and 'User:Ohconfucius/EngvarB.js' into your monobook file. To save you from changing to old skin just to use EngvarB, you can import it into your vector file too. Ohconfucius ¡digame! 22:31, 24 July 2010 (UTC)
Responses @Ohconfucius: Thanks. @Radiopathy Why wouldn't he make this change? —Justin (koavf)TCM☯ 05:38, 25 July 2010 (UTC)
Addendum @Radiopathy: You did it again; this time, I fixed it. —Justin (koavf)TCM☯ 05:46, 25 July 2010 (UTC)
  • I've just checked the script on the John Lennon article, and the problem I was notified of has definitely been fixed. I presume Radiopathy merely forgot to refresh the browser cache. Ohconfucius ¡digame! 01:23, 26 July 2010 (UTC)

Did you change the script?[edit]

It makes the changes and tags the article, but I don't get the "difs" so that I can see what changes took place and edit if necessary. Radiopathy •talk• 01:16, 30 July 2010 (UTC)

  • Yes, I'm sorry I did make a couple of tweaks, and forgot to re-enable the diff-preduction. Now reinstated. Ohconfucius ¡digame! 16:16, 1 August 2010 (UTC)
Glitching again. Radiopathy •talk• 13:58, 2 August 2010 (UTC)
Where's the glitch? Have you got a diff for me? Ohconfucius ¡digame! 03:12, 3 August 2010 (UTC)

Simplifying ENGVAR script[edit]

Hi!!!

I was looking at your script and I think you could simplify it a lot if you use an array to store the "substitution rules". I did this in another script I use at pt.wikisource for OCR corrections and it seems that the same principle apply here. You could use something like this for the rules:

	var table = {
		'aluminum':	'$1aluminium',
		'artifact':	'$1artefact',
		...
	};

and then do a loop through it:

	for (var word in table) {
		regex_function1(word, table[word]);
	}

The regex_function1 would be created with the code which is currently used explicitly in each row of your code. For example:

function regex_function1(w1, w2) {
	var regex1 = new RegExp('([^\\w\\d\\-\\/])' + w1, 'g')
	txt.value=txt.value.replace(regex1, w2);
}

What do you think?

By the way, did you notice my previous comment?

Have a nice week! Helder (talk) 13:56, 2 August 2010 (UTC)

  • Thanks for pinging me again. Indeed, I did miss your last posting, probably because somebody posted at around the same time. I had wondered how I could simplify the script, and will try out the code you suggested, and will feedback to you. Cheers! Ohconfucius ¡digame! 14:03, 2 August 2010 (UTC)
    • I've implemented your suggestion from last time, and it works fine. I would however mention that the strings such as '[^\w\d\-\/]' are very much needed, and cannot be replaced by '\W' or '\b' as these words often crop up in urls. One possible simplification here that I haven't tried is replacing '[^\w\d\-\/]' with [ ]. Unfortunately, I also found the the '\b' character behaves strangely in this flavour of regex - it seems to be recognised as having a "physical existence" just like any other character, so needs to be in a bracket and retained. As for the above suggestion, I have looked at your portuguese code. I am wondering why the need for several tables within the same function? Thanks in advance for your help. Ohconfucius ¡digame! 04:52, 5 August 2010 (UTC)
      • Hello! I use more than one table at pt.wikisource because I'm testing two kinds of conversions: those which apply only when the string is a "whole word" and those which are always applied. For example, I want to convert 'for' => 'fôr', but not 'forte' => 'fôrte', so I use something similar to your \w (I've set a variable containing all the letters 'A-Za-zÁÀÂÃÇÉÊÍÓÒÔÕÚáàâãçéêíóòôõú' which can be in a word). In other cases, it is not a problem if the string is converted even if it is contained in other word (like 'compreendid' =>'comprehendid', which is useful for conversion of 'compreendido', 'compreendida', 'compreendidos', 'compreendidas'). I'm also trying to implement a way of adding automatically conversion rules for words with first letter in upper case so that I only need to add the lower case rule (for example, 'For' => 'Fôr' doesn't need to be added since the table already contain 'for' => 'fôr'). But this is still a little buggy =/
      • You can move codes like (<.+?>[^<]+?), ([^<]+?<\/.+?>), (\[Category:[^\]]*?), etc... (which appears in lots of lines) to outside your table and put it only inside a loop (or a function). This could make the code more understandable and easy to update... =) (note that I did this for ([^\\w\\d\\-\\/]) in the example above). This is another reason why I use more than one table... Helder (talk) 21:48, 5 August 2010 (UTC)

∂˚˚•ˆ∆´¬¬®–…¬˚ßg[edit]

It missed "color" here and "flavored" here. Radiopathy •talk• 02:55, 5 August 2010 (UTC)

  • thanks for the feedback. 'color' (as opposed to 'colors' or 'colored') is a word which is often used in html formatting, so conversion is deliberately avoided so as to reduce the incidence of false positives. Similarly, words which are preceded by hypens are deliberately protected because the form '-word' is very frequently used in urls. As the string '-flavored' can be quite typical, I will try and find a work-around for both these cases if I can. Ohconfucius ¡digame! 03:03, 5 August 2010 (UTC)
  • OK, currently, I cannot see a way of easily transforming 'color' without creating false positives, so I have not done anything about that. However, I have modified the script for the hyphenated words '-colored', '-flavored', '-humored', which should now be transformed. Clear your cache and try it out. Ohconfucius ¡digame! 04:27, 5 August 2010 (UTC)

Rye Toe! I tried it on Flavored liquor (I didn't save it, of course) and it got every instance. Radiopathy •talk• 04:46, 5 August 2010 (UTC)

  • I think using this version is a better test, because it catches the hyphened variety. The script, before my change just earlier, should have worked on the instances of Flavored liquor. ;-) Ohconfucius ¡digame! 04:50, 5 August 2010 (UTC)

I couldn't get it to do Mother's Little Helper again, but it worked great on 'lemon-flavored' at Lemonade. Radiopathy •talk• 04:57, 5 August 2010 (UTC)

You may like to look on the Runescape Wikia AWB typo list. (Uses British English.) Probably stuff you already have, but FWIW. Rich Farmbrough, 18:02, 22 August 2010 (UTC).

Category:Use British English[edit]

Hi, what's your intention with Category:Use British English? It is categorized as a cleanup category (i.e. category of pages that have some kind of a problem that should be fixed), but from the descriptions it seems to me that it should just list articles written in British English. Also, it says that {{EngvarB}} will add an article to that category, but that's not the the case (at least currently). Svick (talk) 08:43, 21 August 2010 (UTC)

  • The original intention was to do just that. But now my idea may be a bit unorthodox – now I think it could be used as a status monitor of all articles written in British English, and not as a cleanup as such. Bearing in mind the possibility of erroneous tagging if done by bot, articles need to be tagged manually. And bearing in mind article evolution, I would be sending a bot around to clean up spelling after, say, 12 months have elapsed. The bot would correct any new introductions since the last visit, and would also put the visit date on the template. I haven't worked out how to add tagged articles to the categories; I am in exchanges with Rich Farmbrough on the subject. Ohconfucius ¡digame! 13:13, 21 August 2010 (UTC)
    Ok. Thanks for the explanation. Svick (talk) 19:50, 21 August 2010 (UTC)
    Note that I created the Category:Use British English from August 2010, and set up the template to categorise appropriately. There are only about 1000 articles with EngvarB. Rich Farmbrough, 17:43, 22 August 2010 (UTC).
    Thanks, Rich --Ohconfucius ¡digame! 23:23, 22 August 2010 (UTC)
    Incidentally appropriate wording for the dated categories can go in Template:Monthly_clean_up_category/Messages/Use_British_English. Rich Farmbrough, 15:26, 23 August 2010 (UTC).

Thanks, I've just created Category:Use dmy dates --Ohconfucius ¡digame! 15:37, 23 August 2010 (UTC)

Scripts...[edit]

Hi!!!

How is everything?

You probably will like to know that at fr.wikisource they have a script (fr:s: oldwikisource:MediaWiki:Modernisation.js) which is used for modernization of texts written in old dialects. The script allow the reader to click in a menu in the sidebar to see the modernized version of text, based on a table of "old word" : "new word" pairs available at fr:s:Wikisource:Dictionnaire.

You can test it acessing, for example, the page fr:s:La Cigale et la Fourmi and clicking at "Texte modernisé" in the sidebar (then the text of the page will change accordingly to the dictionary - but since there is an image in the beginning of the page, it may be a good idea to see the page in full screen mode to notice the changes happening ;-) ).

I found this when I proposed a similar feature (from MediaWiki) at multilingual wikisource: Using LanguageConverter syntax at Wikisources.

Best regards =) Helder (talk) 22:08, 31 August 2010 (UTC)

  • Thanks for your message. Interesting discussions indeed about Engvar and translations! Unfortanately, I cannot access any demonstration: I tried going to Modernisation.js, and the page is blank. It's rather bizarre as I cannot access it nor see its history. I see the word list (dictionnaire), but see no sidebar buttom to transform (BTW, I have imported the same script as in your vector file). Maybe they have disabled it temporarily. But based on the discussion, I already get a pretty good idea of what they are trying to do there even without the demonstration.
My mistake: the script is here: oldwikisource:MediaWiki:Modernisation.js. Helder (talk) 17:45, 3 September 2010 (UTC)
  • As to your Engvar script modifications, I may have mentioned to you previously that I never succeeded in getting the last module to work. I have played with it a bit, although I shall soon be overwriting the existing EngvarB.js code with test1.js code, which is with the old Function Simple. I presume your version of the script must work for you, and am a bit mystified and frustrated why I cannot get the script to even load once the final module (function Simple) is substituted. Furthermore, because I have been a naughty boy, I have a prohibition from running automation on en.WP, so until I successfully appeal it, this continues to severely limit my ability to fully test the script with tangible results; I cannot save the changes. :-( More on that anon. Regards, --Ohconfucius ¡digame! 08:40, 3 September 2010 (UTC)
I'll try to take a look next week... Helder (talk) 17:45, 3 September 2010 (UTC)
This change seems to be working. I've changed the order of some lines, so that those which starts with "([ \|\[])" can be in a loop. The others are in another loop, and working. Give it a try =) Helder (talk) 23:24, 13 September 2010 (UTC)
  • Thanks for your update. The script is working a lot better now. But I've been experiencing problems with it apparently running out of steam, as it were, before the job is finished. The process seems to grind to a halt prematurely on both British and Oxford buttons, so the unprotect function isn't engaged; no diff, and tagging with {{EngvarB}}. It's about as far as I am technically able to offer to you as a bug report. --Ohconfucius ¡digame! 10:07, 14 September 2010 (UTC)
After you described the problem I remembered that my second test above also didn't had the summary. So, I looked at firefox console and noticed an error was happening in the loops. The problem was the need of double backslashes when defining the regexes inside strings.
In the latest version, it was added also code for try/catch errors in the loops. This way, you'll be notified if it was added some really broken regex to the tables ;-)
Now it is working (I hope!). Helder (talk) 13:04, 14 September 2010 (UTC)
  • Wow, thanks for that. I'll say I would never have found the bug – I was expecting the script to stopped at or close to the point of error, and certainly not after it had done most of the conversion, where the code was already bugged up. I'll report back later, after I've run a few tests on real articles. Cheers, --Ohconfucius ¡digame! 14:00, 14 September 2010 (UTC)

Another script[edit]

Hi!

I think you may like to test this script (together with this css). The script will add a menu at the top of pages and let you change the spellings from/to Britsh/American English based in lists of words (which currently are at Dictionary/en-US and /en-GB), editable by anyone.

You can see what happens in the dictionary pages, for example, or accessing articles where there are words in the lists (like Belgium and others). I don't know much of English, so the tables were just an adaptation of this table and may need revision by native English speakers ;-) Helder (talk) 16:32, 27 September 2010 (UTC)

  • Hey, that's a really neat idea of a script. There are a few glitches, though, these are easily detected when looking at, say, Barack Obama. Somehow, I feel that the dictionary list may be too comprehensive for its own good, as it contains many ambiguous words which are probably better off not translated – words like 'Vice President' becoming 'Vise President', and 'pin their hopes' becoming 'prong their hopes'. Thanks also for drawing my attention to Ubuntu project, and Greasemonkey. --Ohconfucius ¡digame! 04:47, 28 September 2010 (UTC)
    Indeed: when I found the script at oldwikisource:MediaWiki:Modernisation.js and the French table at s:fr:Project:Dictionnaire used for modernization of old French texts, I really liked to know that it was possible to do that also with javascript (I was aware of Language Converter from MediaWiki, but it is made in PHP). Since then I've tried to adapt it for a more general use (like conversion to en-GB/en-US variants of English, or pt-PT/pt-BR variants of portuguese, and also modernization of Portuguese texts at s:pt:).
    Don't take those tables very seriously... They are merely illustrative and were not reviewed... (and actually I'm not that good in English to do so... =/) Feel free to update them, removing or adding things in the tables, or to share the idea with anyone which may be interested... I'll probably work with the script only at Portuguese projects, but if it is useful for English too it is just a matter of making the tables good enough (the script is essentially a "parser" for the tables. So, if they are good, the script has good results, but if not... oh well).
    The adapted version of the script has some configuration variables which can be adjusted to fit your specific needs. For example, you can remove the highlight of converted words (or customize it in CSS...)
    BTW, you have added some things which may not be useful to you... The script only needs the part below "var ws_alphabet", as in my diffs. But if you want to add more buttons to your toolbar, there are some tips at usability:Toolbar_customization/Library ;-).
    Best regards, Helder (talk) 12:26, 28 September 2010 (UTC)
  • Thanks. YOu've given me plenty to play with and think about. ;-) --Ohconfucius ¡digame! 03:08, 29 September 2010 (UTC)
  • Also, I kind of like how all the links to scripts are highlighted. ;-) --Ohconfucius ¡digame! 04:44, 30 September 2010 (UTC)
Me too ;-) Helder (talk) 11:44, 30 September 2010 (UTC)

Protect words[edit]

I noticed this amongst my scripts, but I have no idea what it is. Radiopathy •talk• 03:16, 29 September 2010 (UTC)

  • Thanks for pointing that out. I'm sorry for the confusion it may have caused. I had upgraded the script, and that was a button I use to test proper functioning of the protect mechanism, to make sure that certain words, or words inside Categories, quotations etc, don't get acted upon by the script. As it is no longer mentioned in the documentation, I have now disabled it. --Ohconfucius ¡digame! 03:28, 29 September 2010 (UTC)

What key is this in?[edit]

Look at this! It actually looked this way in the article, too! Radiopathy •talk• 19:44, 5 October 2010 (UTC)

  • Most of my compositions are in the key of D. Looks like the protection somehow didn't get reversed. I will look into the problem and get back. --Ohconfucius ¡digame! 02:47, 6 October 2010 (UTC)
  • I should point out that that was the date script, not ENGVAR. Radiopathy •talk• 02:51, 6 October 2010 (UTC)
  • OK, thanks for the clarification. No wonder I couldn't replicate the problem. However, it does look like the ENgvar missed a few words. Need to get to the bottom of it. --Ohconfucius ¡digame! 02:55, 6 October 2010 (UTC)
  • I immediately assumed it was the ENgvar script because of the way the music note appeared in 'surprised' which I have to protect from conversion. The appearance must be because the MOSNUM script somehow interacted with the Engvar script. So far, I cannot see why or how it would have done so – none of the functions share the same name. Anyway, sorry to bore you with the detail... I have made a patch which should deal with the problem for now. --Ohconfucius ¡digame! 03:15, 6 October 2010 (UTC)

Watch this[edit]

The ENGVAR script is 'unwatching' pages that I run it on! Radiopathy •talk• 14:15, 13 November 2010 (UTC)

  • I'll get onto it... d'you know if is this recent?

BTW, I've been informed elsewhere that the Mediawiki software occasionally drops watchlisted items. --Ohconfucius ¡digame! 14:27, 13 November 2010 (UTC)

I noticed that some of my watched articles were no longer on my watchlist, so I ran the script on Golden Slumbers today, and the page was unwatched after I saved. Radiopathy •talk• 14:30, 13 November 2010 (UTC)
  • Tx. I'll run some diagnostics. Ohconfucius ¡digame! 14:31, 13 November 2010 (UTC)
  • I am please to inform you that the problem has now been addressed. You were absolutely correct that the code un-watchlists since I know not when. So please check to see what other articles it may have delisted.

Musical notes[edit]

Hello. I was testing your EngvarB script for the first time on Humour and something surprising happened. I'm not sure if I'm doing something wrong but nothing was changed except those two instances of "surprise". Please help! Thank you. McLerristarr | Mclay1 05:41, 15 November 2010 (UTC)

Also, I was wondering where I could find a complete list of the changes as I'm not particularly good at reading code. Thanks. McLerristarr | Mclay1 06:05, 15 November 2010 (UTC)

One more thing, I recently created the page Wikipedia:Manual of Style (spelling)/Words ending with "-ise" or "-ize" and I was wondering if you could tell me if I've missed any exceptions. Thanks. McLerristarr | Mclay1 06:07, 15 November 2010 (UTC)

  • Thanks for your query. I had this problem reported to me by Radiopathy a while back, and thought I had fixed the problem. I know what it is due to, but the problem does not replicate when I run the script on the article you cited. I need to dig further. My initial guess was that the script may have stalled in the protection loop, before the conversions actually take place. If the browser allows the script to execute properly, you should see the diff of the changes appear once it has finished. Can you please confirm that this was the case, to help with diagnostics? I am also baffled as to why it didn't convert the instance of humor in the opening sentence when I executed it just now, but that's a problem unrelated to yours.

    I was in the process of creating a proper and comprehensive test page, but I got sidetracked. The closest I have to one is at the bottom of my script documentation here. More anon. --Ohconfucius ¡digame! 06:18, 15 November 2010 (UTC)

    • When I click "BRITISH spelling", it appears to do nothing. It says "Error on page" in the status bar at the bottom of the browser. When I manually view the diff, all it's done is added musical notes in the two instances of "surprise". I also tried it on The Beatles and it added a musical note in compromise. It appears to be doing it in words that end in "-ise" in American English too. By the way, I'm using Internet Explorer 8.0.7600.16385 (the latest version) on Windows 7. McLerristarr | Mclay1 06:29, 15 November 2010 (UTC)
      • OK, thanks. That confirmed my suspicion that the script stalled. It does appear to do so with some browsers that execute javascript slowly, and sometimes crash, like yours appeared to do. I have never tried it on IE. The only way to be sure the script has executed properly is if you see that the {{EngvarB}} tag (or {{EngvarOx}}) tag has been inserted. The diff is the last step which confirms its completion. When using Firefox on my Mac, I sometimes get a 'script stalled' message, but it asks me whether to continue; it gets there eventually. I also use FF and Chrome on Windows, and the script generally works fine. Safari seems to execute the script the fastest, though. SO I would recommend you try that. --Ohconfucius ¡digame! 06:36, 15 November 2010 (UTC)
        • Thank you. I will download Safari. I'm getting sick of Internet Explorer anyway. The drop down menu for recent edit summaries works better but other than that, Safari is a lot better for editing Wikipedia (I use it on my other computer). McLerristarr | Mclay1 06:50, 15 November 2010 (UTC)
      • Just a supplementary to your list, I presume you have seen this. A table similar to yours exists somewhere, but I have yet to relocate it. Furthermore, I'm not sure it is possible to create a complete list of -ize words. I have come across many variants where the American-created word (or so I believe) out of any given noun does not enjoy any degree of common usage in British English... I have never seen British write words like 'journalize', burglarize', 'routinize', as they generally prefer to use 'to make a journal entry', or 'to have been burgled' --Ohconfucius ¡digame! 06:36, 15 November 2010 (UTC)
        • Yes, I am aware that Americans tend to make up a lot of words so I was planning on keeping the list small. It is the lists of exceptions that I want to be exhaustive because I don't thin kthere are too many. I have read spelling differences page but as far as I'm aware there's no lists of words ending in "-ise" or "-our", just a few examples and a list of other miscellaneous spelling differences. McLerristarr | Mclay1 06:48, 15 November 2010 (UTC)

I tried it using Safari and it worked but it did not correct "humor" in the first sentence of Humour. It also wanted to add the EngvarB template even though it already had one. By the way, wouldn't it be best if it added {{Use British English}} instead? That way it avoids the redirect that bots and AWB will waste time correcting and it may be of benefit to unaware editors. McLerristarr | Mclay1 07:49, 15 November 2010 (UTC)

  • Great! I'm glad the most significant problem has been solved. I'll work on the other two you mentioned. Cheers, --Ohconfucius ¡digame! 07:56, 15 November 2010 (UTC)
    • Well, not really solved, just avoided by not using Internet Explorer. I tried it again on Humour and it got every instance of "humor" except the first one. However, some of the changed instances were in wikilinks and another in a citation template. Is it possible to avoid those? McLerristarr | Mclay1 11:06, 15 November 2010 (UTC)
      • It should be avoiding the instance within the citation template; also I thought I had a fix for the one inside the piped links, so those need to be investigated. IN my view, it's not desirable to ignore instances within wikilinks. In most cases, it's a problem which redirects were put into place to solve. As for the one in the external links, it's a very ordinary text string, so it's unavoidable, I'm afraid - the only way I know to avoid those for the moment would be potentially to put them inside a citation template; another solution may be for me to write an extra chunk of code to protect url strings of the type '[http://www.google.com/humor google humor]' - something I'm hoping to avoid because it already enormously slows down script execution. --Ohconfucius ¡digame! 11:13, 15 November 2010 (UTC)
      • Update:
        1. The code does not convert the bolded 'honor' because the single quote marks render it into a protected string. I don't propose to change that to avoid false positives.
        2. I have now revised the code, which should now protect instances of words within citation templates, within the title field viz: '|titie= this is any string containing the non-British variant |'
        3. As said above, I do not propose to protect the ordinary string of the 'Further reading' references. I would suggest that in order to avoid conversion, one could substitute the quote marks with {{q}}, so anything within the template will be protected; alternatively, simply substitute the space preceding the word to be protected by a nbsp. Ohconfucius ¡digame! 15:53, 15 November 2010 (UTC)
        • Excellent. One more question, is text inside a {{sic}} template protected? McLerristarr | Mclay1 00:52, 16 November 2010 (UTC)
          • It wasn't, but is now, thanks to your suggestion. I note, however, someone designing the template had the foresight of preventing automation on such words - if you insert the '|' (pipe symbol). --Ohconfucius ¡digame! 01:52, 16 November 2010 (UTC)
          • Re the above 'Further reading' line: another way of protecting any given word is to capitalise the first letter. --Ohconfucius ¡digame! 01:56, 16 November 2010 (UTC)

I hate to be a pain but it's correcting words in URLs and file names. Try it on Airplane! – it's a good one for testing. McLerristarr | Mclay1 03:15, 16 November 2010 (UTC)

  • Not at all. Thanks for the help in pointing out the problems. I trust that you are deliberately finding articles to test the script on, and not actually trying to convert Airplane! to British English!

    After trying for the last hour or so, I haven't yet managed to cure the problem of the changes to 'image=airplane!.jpg'. I may have to go deeper into the code. I haven't yet tried to cure the problem of {{rottentomatoes|airplane}} although I'm tempted to say that latter one is probably better dealt with by capitalisation. --Ohconfucius ¡digame! 05:00, 16 November 2010 (UTC)

    • Thank you. Yes, I am only testing. At the moment, Safari is coming up with about 100 error boxes when I use the script. After clicking OK a hundred times the script works fine. Is that happening to you too?
      • Sorry, that was due to my last edit, where I tried adding some code to protect interwikis. I'm going back to the drawing board with that. --Ohconfucius ¡digame! 05:15, 16 November 2010 (UTC)
        • No, it's still doing it. Perhaps it was the edit before? McLerristarr | Mclay1 05:25, 16 November 2010 (UTC)
          • Try again. I've reverted all today's changes, and disabled changes to 'aeroplane'. Ohconfucius ¡digame! 05:31, 16 November 2010 (UTC)
            • The error boxes have stopped but now the template isn't adding and it's putting musical notes in again. I'm so glad I'm not the one programming this. :P McLerristarr | Mclay1 05:59, 16 November 2010 (UTC)
              • This isn't very interactive. Why don't you email me with your skype handle if you have one? --Ohconfucius ¡digame! 06:07, 16 November 2010 (UTC)
                • Well, I have Skype but I've never used it before and have no idea how to but I could give it a go. How do you send emails with Wikipedia (never done that before either)? McLerristarr | Mclay1 06:26, 16 November 2010 (UTC)
                  • On the sidebar here on my userpage or talk page, there is a button 'email this user'. Just click on it, and a new page will appear, telling you what to do. If you are on hotmail or gmail, I can chat with you using those if you send me yours. --Ohconfucius ¡digame! 06:30, 16 November 2010 (UTC)
    • Also, just a suggestion: currently the edit summary is the same for Oxford spelling as it is for standard British. Could the edit summary be slightly different? McLerristarr | Mclay1 05:13, 16 November 2010 (UTC)

Airplane ->aeroplane[edit]

I think I've now resolved that particular issue, as well as instances within {{sic}}, and as image parameters within infoboxes. --Ohconfucius ¡digame! 07:05, 16 November 2010 (UTC)

Hoorah!. It's not getting the URLs or the Rotten Tomatoes template either. Excellent! However, it also needs to avoid language templates, mainly {{Lang}} and {{Lang-en-US}}. McLerristarr | Mclay1 07:10, 16 November 2010 (UTC)
  • Oh, you're killing me... :-( --Ohconfucius ¡digame! 07:17, 16 November 2010 (UTC)
  • Seriously, I can do that easily enough, but do you think there's a utility? I mean, there are only three articles using that template. Also, the more complex the code, the harder it makes maintenance, so perhaps I won't put that in until it becomes an issue. --Ohconfucius ¡digame! 07:30, 16 November 2010 (UTC)
  • {{lang-en-US}} and {{lang-en-GB}} are not used often because they look awkward really and, in fact, I don't support their use. But {{lang}} is used a lot, or at least should be. It should be used anywhere a foreign word is used and on pages where American or British variants are given so definitely needs to be implemented on pages such as American and British English spelling differences if it is not already. I noticed when testing the script on humour that several of the foreign language interwiki links spelt "humour" as "humor". Correcting foreign languages which spell the same as American could be avoid if the words were in a language template like they should be (interwiki links will be avoided anyway though). McLerristarr | Mclay1 15:21, 16 November 2010 (UTC)

You may wish to see this. I have no idea what it did, but apparently the script now removes non-existant musical notes. McLerristarr | Mclay1 15:29, 16 November 2010 (UTC)

  • The notes are used as a unique protection string, and I have never seen urls using the musical notes. Seeing that these are positioned within words which are subject to script action, and in the exact places of insertion, I suspect they may have been left by a previous incomplete script execution possibly by my friend Radiopathy, who frequently uses the script. As a unique character was chosen for protect, the removal relies on a very simple line of code. Checking the urls confirms that the correct urls are indeed without the notes, so I don't think this is a problem within articles. --Ohconfucius ¡digame! 15:40, 16 November 2010 (UTC)

Aircraft[edit]

I'm not sure I agree on changing "aeroplane" and "airplane" to "aircraft". Aircraft is a much broader term that also includes zeppelins and the like. Fixed-wing aircraft is the compromise but that sounds awkward in general text, but so does just "aircraft". "They travelled by aircraft to America", "He caught an aircraft at noon" etc. If a page is written entirely in British English, I see no reason why "aeroplane" can't be used. McLerristarr | Mclay1 12:28, 15 November 2010 (UTC)

Suggestion for adding templates[edit]

Instead of adding {{EngvarB}} or {{EngvarOx}}, should the script add {{Use British English}} or {{Use British (Oxford) English}} instead? GoingBatty (talk) 02:38, 16 November 2010 (UTC)

Oxford English[edit]

Hey, I was using the Oxford script on The Hobbit and it wanted to covert a few words ending in "-ise" to "-ize" which should end in "-ise" in Oxford English. Is there a way around this problem? I noticed you mentioned it in the script documentation. If it's just a matter of listing all the exceptions, then Wikipedia:Manual of Style (spelling)/Words ending with "-ise" or "-ize"#Words never ending with "-ize" maybe of some help, otherwise sorry for telling you about something you already know. McLerristarr | Mclay1 01:47, 17 November 2010 (UTC)

  • I have been concentrating on 'standard' British English spellings, and the Oxford spelling is admittedly a poor cousin (actually stemming from my own preference for s-words in general). Unlike the conversion to -ise, which is more refined (more lines to distinguish the different cases), the code which converts to -ize is a bit crude. I would gladly add more words to the protected list, and make more refinements with your help. --Ohconfucius ¡digame! 01:59, 17 November 2010 (UTC)
  • I've just looked at the code again. Right now, it will convert to -ization only if the stem is five letters or more; to -ize only if preceded by vowel+consonant(not-s). Thus, of the words on your above list, only 'compromise', 'devise'/revise', 'improvise', premise/promise', 'televise' will be converted. The code has been adjusted accordingly for these. --Ohconfucius ¡digame! 02:57, 17 November 2010 (UTC)
    • Thank you. Just wondering, at the top of the script it reads "PLEASE READ THE DOCUMENTATION at User:Ohconfucius/EngvarB (click on the link above) before using." but there is no link above. Is it just me? McLerristarr | Mclay1 04:41, 17 November 2010 (UTC)
      • It should be displaying the properly within a bluish template, which says "This script seems to have a documentation page at User:Ohconfucius/EngvarB." --Ohconfucius ¡digame! 04:44, 17 November 2010 (UTC)
        • Yeah, I thought it used to say that but it doesn't anymore. Oh, well, all I have to do is copy and paste and link in the sentence. McLerristarr | Mclay1 04:51, 17 November 2010 (UTC)

British English categories[edit]

I've created two more sub-categories: Category:All Wikipedia articles written in British English and Category:All Wikipedia articles written in British (Oxford) English. I've updated the templates and progress boxes. The categories do not have many items in them yet according to my Wikipedia, could be to do something to do with the cache or it could be Wikipedia being slow. Eventually though, every article tagged with one of the templates will be added to the respective category as well as the dated category. McLerristarr | Mclay1 05:34, 17 November 2010 (UTC)

Clean-up[edit]

The British English script currently changes "cleanup" to "clean-up" in {{Cleanup}} and as a parameter of {{Multiple issues}}. Could this be avoided? McLerristarr | Mclay1 07:31, 22 November 2010 (UTC)

  • I've just protected the string. Try now. --Ohconfucius ¡digame! 07:50, 22 November 2010 (UTC)
    • Works perfectly. Thank you. Although, by testing it I noticed that the rules do not work when preceded by * or # so listed items are not corrected. McLerristarr | Mclay1 08:03, 22 November 2010 (UTC)
      • Thanks for the feedback. As I don't quite understand what you mean, please could you give me the exact strings/situations still causing the problems? I need to have this to create the most precise protection without giving rise to false positives. Cheers, --Ohconfucius ¡digame! 08:07, 22 November 2010 (UTC)
        • Try using the script on this page. It doesn't correct list items unless the there is a space between the bullet point and the text. McLerristarr | Mclay1 08:33, 22 November 2010 (UTC)
          • Yes, at present, the words need to be preceded by a space or an opening square bracket to be converted. I wrote those cases to avoid false positives. The hash character (#) could cause problems, as it is used within wikilinks to denote sections, so I need to have a think how to deal with these examples. --Ohconfucius ¡digame! 08:39, 22 November 2010 (UTC)

Missing rules and incorrect changes[edit]

Hey, just a few things I've discovered through using your great script. Currently, the Oxford script is incorrectly changing "arise" but is not changing "bastardise", "philosophise", "standardise" or "synthesise". Both scripts do not correct "aging" ("ageing"), "counterclockwise" ("anticlockwise" – make sure Oxford doesn't catch the ending), "breathalyze" ("breathalyse"), "cataloged" ("catalogued"), "cataloging" ("cataloguing"), "encyclopedia" ("encyclopaedia"), "encyclopedic" ("encyclopaedic" – but not in maintenance templates), "aerie" ("eyrie"), "gotten" ("got"), "licorice" ("liquorice"), "louver" ("louvre"), "math" ("maths"), "molt" ("moult"), "mollusk" ("mollusc"), "ocher" ("ochre"), "omelette" ("omelet"), "phony" ("phoney") and "specialty" ("speciality"). They're the main ones but not all of them. I've complied a (currently incomplete) list of British and American terms and spellings at User:Mclay1/Britishisms. It's useful for testing the scripts, although not all the list items can be corrected due to ambiguity. In some cases, an American spelling is more common in British English (e.g. "gramme"/"gram") or vice versa but in those cases I've only listed one spelling. Feel free to add to or correct the list if you want. McLerristarr | Mclay1 16:18, 22 November 2010 (UTC)

  • Thanks for your comprehensive test notes. Enhancements dealt with as follows:

    changing "arise" but is not changing "bastardise", "philosophise", "standardise" or "synthesise". Both scripts do not correct "aging" ("ageing"), "counterclockwise" ("anticlockwise" – make sure Oxford doesn't catch the ending), "breathalyze" ("breathalyse"), "cataloged" ("catalogued"), "cataloging" ("cataloguing"), "encyclopedia" ("encyclopaedia"), "encyclopedic" ("encyclopaedic" – but not in maintenance templates), "aerie" ("eyrie"), "gotten" ("got"), "licorice" ("liquorice"), "louver" ("louvre"), "math" ("maths"), "molt" ("moult"), "mollusk" ("mollusc"), "ocher" ("ochre"), "omelet" ("omelette"), "phony" ("phoney") and "specialty" ("speciality").

    I figured that words like "math", "phony" and "gotten" are vernacular and likely to be used only in quotes, and conversion risks creating false positives; "Licorice" appears to be an acceptable British spelling, so I will not treat this. --Ohconfucius ¡digame! 17:34, 22 November 2010 (UTC)

    • Thanks a lot. According to Oxford Dictionaries Online, which is where I'm getting a lot of the words from, "licorice" is the US spelling. McLerristarr | Mclay1 00:06, 23 November 2010 (UTC)
      • I have now tweaked the code. You now have 'liquorice'; instances preceded by '*' will also now be converted- we just need to be on the lookout for false positives... --Ohconfucius ¡digame! 02:30, 23 November 2010 (UTC)
        • I should point out that I have not added contexts to my list yet so in some cases, nouns and verbs are spelt differently in British English. For example annex (verb) and annexe (noun), which you seem to have added to your script. McLerristarr | Mclay1 16:04, 23 November 2010 (UTC)
          • While I have tried to build in context in some instances (ie practice vs practising, color vs coloured), I was not aware of any issues with annexe, as I have been accustomed to seeing it in all contexts. So I'm glad I have the assistance of somebody more scholarly in refining the script spellings ;-) --Ohconfucius ¡digame! 01:34, 24 November 2010 (UTC)

Suggestion for adding templates[edit]

I originally (maybe improperly) posted this question on User talk:Ohconfucius/EngvarB but didn't receive an answer. Instead of adding {{EngvarB}} or {{EngvarOx}}, should the script add {{Use British English}} or {{Use British (Oxford) English}} instead to avoid template redirects? GoingBatty (talk) 03:21, 1 December 2010 (UTC)

  • Thanks for the reminder. I did indeed see it and apologise for not responding. The change involves a piece of code I borrowed, and I am seeking assistance how to adapt it to do the job you suggested. In the meantime, you may be aware that Smackbot passes by regularly and replaces the redirects, which include {{cn}}, with the proper dated maintenance template. --Ohconfucius ¡digame! 03:45, 1 December 2010 (UTC)
    • Thanks for the response. Didn't realize SmackBot was fixing these - guess I found some that the bot hadn't fixed yet. Good luck with adapting the code! GoingBatty (talk) 04:20, 1 December 2010 (UTC)
      • I believe the Rich Farmbrough (talk · contribs), the operator of SmackBot, makes periodic trawling runs through mainspace to correct such. Anyway, you're right that there's no reason not to build the template into the code. --Ohconfucius ¡digame! 04:23, 1 December 2010 (UTC)

User:Ohconfucius/EngvarB.js[edit]

I fixed some bugs in your script, per your request. Hopefully it is now working as you desire. By the way, it looks like you have hard-coded the date in the script. Would you like to make this automatic based on the current month and year? Hopefully I didn't make a mess of anything. Thanks! Plastikspork ―Œ(talk) 01:42, 7 December 2010 (UTC)

To see how you can get the current month name, see [1]. To get the current year, you can use [2]. Plastikspork ―Œ(talk) 01:50, 7 December 2010 (UTC)
  • The script is now tagging once again. What it does now:
    on clicking the 'British English' button in an article without any tag, the script task is performed and the tag {{EngvarB|date=December 2010}} is inserted.
    on clicking the 'British (Oxford)' button in an article without any tag, the script task is performed and the tag {{EngvarOx|date=December 2010}} is inserted.
    on clicking the 'British English' button repeatedly, the tag {{EngvarB|date=December 2010}} is inserted repeatedly.
    on clicking the 'British (Oxford)' button repeatedly, the tag {{EngvarOx|date=December 2010}} is inserted repeatedly.
  • What I would like it to do:
    on clicking the 'British English' button, insert the tag {{Use British English|date=December 2010}}.
    on clicking the 'British English' button repeatedly, there should only be a single {{EngvarB|date=December 2010}} tag at the end of the operation.
    on clicking the 'British (Oxford)' button repeatedly, there should only be a single {{EngvarOx|date=December 2010}} tag at the end of the operation.
    on clicking the 'British (Oxford)' button in an article already tagged with {{EngvarB|date=Month Year}}, {{EngvarOx|date=Month Year}} or {{Use British English|date=Month Year}} or similar permutations, the sole tag is updated to {{Use British (Oxford) English|date=Newmonth Newyear}}.
    on clicking the 'British English' button in an article already tagged with {{EngvarB|date=Month Year}}, {{EngvarOx|date=Month Year}} or {{Use British English|date=Month Year}}, the tag is updated to {{Use British English|date=Newmonth Newyear}}.

It doesn't matter so much if it inserts EngvarB or EngvarOx, but I would like it not to keep reinserting tags when they already exist; also it is undesirable to have (both) contradictory tags on the same article. Thanks in advance for your help. --Ohconfucius ¡digame! 02:49, 7 December 2010 (UTC)

I believe I see what you mean. There are a couple solutions. (1) You can check for the tag before inserting one, or (2) you can remove duplicate tags, or (3) you can do both. I will think about it, and see if I can code something up. Plastikspork ―Œ(talk) 02:58, 7 December 2010 (UTC)
Okay, try it now. Plastikspork ―Œ(talk) 03:55, 7 December 2010 (UTC)
  • Seems to work fine now. Many thanks.

    I have a side question: for some reason, some (and only some) of my script buttons -particularly the British English buttons (which are in their own little 'Script' section in the sidebar along with 'Custom regex'), and some others - disappear intermittently, although the script remains callable through a hook (Ohc_ENGVARplus) I placed in my vector file. I wouldn't say this is 'normal' or expected, but have you noticed similar behaviour? Could it perhaps be due to an error in the script somewhere? Ohconfucius ¡digame! 04:25, 7 December 2010 (UTC)

Hello! Sorry for delay in answering your comment. If I understood correctly what was said above, the script is already working as desired. Is it needed anything else?

I have a suggestion about this edit: it seems possible to simplify the code using for example {{Use British English|{{subst:DATE}}}} (see for example Template:Clarify). The result would be this. Helder 18:34, 7 December 2010 (UTC)

  • Thanks, I will try that on my other scripts.

    I have noticed that scripts do sometimes work even when there are syntax errors, and have a query/problem OF intermittent faulty loading (above) which is leading me to suspect there may be a bug in one of my scripts. What ways do you use to test? Someone suggested I tried using Firefly to test/debug the code, but I don't find it very intuitive to use, so I didn't bother. --Ohconfucius ¡digame! 01:38, 8 December 2010 (UTC)

    You can try Firebug for debugging. Helder 09:47, 8 December 2010 (UTC)
    Thanks. --Ohconfucius ¡digame! 09:51, 8 December 2010 (UTC)

'Paradize'[edit]

Hello, this new scripting all seems to be working fine for me. Can you please edit the Oxford script to prevent it from changing "paradise" to "paradize"? McLerristarr | Mclay1 07:03, 7 December 2010 (UTC)

Robbie Robertson[edit]

When tagging something Oxford English, could you provide your reasons? I'm not sure a Canadian-Native American born musician who had his big break backing a very American singer and thereafter spent most of his time in the States deserves the privilege! --John (User:Jwy/talk) 13:19, 21 December 2010 (UTC)

  • I was intending on running my script, which merely changes spelling but not the vernacular, on all Canadian articles; you must excuse the tagging. The 'Oxford' label may seem counter-intuitive at first glance, but according to my reading, Canadian English spelling is identical in most respects to Oxford English, so applying this particular WP:ENGVAR fix seemed appropriate to me. I hope this is a satisfactory explanation. your further feedback would be most welcome. --Ohconfucius ¡digame! 15:04, 21 December 2010 (UTC)
According to the Canadian English page, "Words such as realize and paralyze are usually spelled with -ize or -yze rather than -ise or -yse." Isn't that contrary to the a key Oxford distinction? And I haven't looked, but would suggest if you haven't your run this by the Wikiproject_canada. There is probably more subtlety required. --John (User:Jwy/talk) 15:22, 21 December 2010 (UTC)
It appears that z-words in Oxford and Canadian English are spelt the same. --Ohconfucius ¡digame! 15:48, 21 December 2010 (UTC)
Oh sorry, I thought Oxford was in the -ise camp. Cheers. --John (User:Jwy/talk) 16:06, 21 December 2010 (UTC)
Just for your FYI U.S. Spelling versus British and Canadian Spellings See also :Wikipedia talk:Canadian Wikipedians' notice board#WP:ENGVAR.Moxy (talk) 03:51, 22 December 2010 (UTC)
  • OK, thanks. Very useful. Looks like I may be opening up a new can of worms. ;-) --Ohconfucius ¡digame! 03:54, 22 December 2010 (UTC)

Engvar script - adding functions[edit]

from Plastikspork's talk page Hi Plastikspork,

I could once again do with your expert help in adding functionalities to my Engvar script, the test version of which is here. I am attempting to add functionality for Canadian English, consisting of two additional functions. I have separately tested the two modules, and find that they work as intended. I lost the sidebar buttons since going to the latest version. The current version lacks the menu buttons, but still can be called. Note that function insert_Engvar(v1) has not yet been updated for the Canadian code. Cheers, --Ohconfucius ¡digame! 03:13, 23 December 2010 (UTC)

You caught me just as I was packing for holiday. I may have some time, depending on how the packing goes. Plastikspork ―Œ(talk) 03:41, 23 December 2010 (UTC)
This can wait till after the hols. Have a good one! --Ohconfucius ¡digame! 03:43, 23 December 2010 (UTC)
Happy New Year! Hope you had a good break. It seems that I have the sidebar buttons. However, the Canadian button currently sits in the middle and displays as 'British spelling'; the article is tagged {{Use British English|etc after activation although the underlying changes are as per Canadian, as written in the regex rules. --Ohconfucius ¡digame! 08:14, 3 January 2011 (UTC)
So this is for the test version? I will see if it does the same thing for me. Plastikspork ―Œ(talk) 01:41, 4 January 2011 (UTC)
Yes, this is the test version. The 'main version' does not yet incorporate the rules for Canadian English. Once it is working, I will copy it over. --Ohconfucius ¡digame! 02:06, 4 January 2011 (UTC)
Okay, did my change work? It looked like the link to case "C" was using "BRITISH" for the text. Plastikspork ―Œ(talk) 02:22, 4 January 2011 (UTC)
  • The button in the sidebar now says 'CANADIAN spelling' instead of 'BRITISH spelling', but the tag inserted still says 'Use British English'. --Ohconfucius ¡digame! 02:31, 4 January 2011 (UTC)
Try it now. It seems to be working. The only oddity is what it does to the edit summary if you repeatedly push the various buttons. I could fix that as well, but it would require removing prior edit summary before adding a new one. Plastikspork ―Œ(talk) 05:13, 4 January 2011 (UTC)
  • Magnifique! Merci beaucoup! The problem is curious, though. I'll play with it a bit first. --Ohconfucius ¡digame! 06:09, 4 January 2011 (UTC)

Engvar script notes[edit]

Haven't tried a full modification to the script yet, but to implement Australian English tagging, a good approach seems to be in updating function rmflinks() to add a regexTool line for Australia, which would call with a new "A" (Australian) parameter (SetEnglish("A")). The SetEnglish() function would add a case like this:

case 'A': Ohc_ENGVARprotectwords(); Ohc_ENGVARSimple(); zwords(); Ohc_ENGVARAedit_summary(); break;

Then add a case in function insert_Engvar(v) under the switch (v):

        case 'A':
           // Replace British/British (Oxford)/Canadian with Australian
           txt = txt.replace( reB, '');
           txt = txt.replace( reOx, '');
           txt = txt.replace( reC, '');
           // Prepend Australian template if not already tagged
           if( txt.search(reB) == -1 ) {
               txt = '\r\n' + txt;
           }
           break;

(You will likely need to add a "reA" for Aus Eng, and txt.replace that in the other cases)

Also note the call to a new edit summary function for Australia:

function Ohc_ENGVARAedit_summary(){
       //Add a tag to the summary box
        setoptions(minor='true');
        setreason('[[WP:ENGVAR|all Australian spelling]] by [[WP:EngvarB|script]]', 'append');
      // doaction('diff');
}


That involves a few updates, but shouldn't be excessively complicated to expand to add an Australian update, which could initially just call the British spelling fixes until some Aus-specific spelling differences emerge. Dl2000 (talk) 20:57, 11 September 2011 (UTC)

  • Thanks, I'll take that for a spin. More anon. --Ohconfucius ¡digame! 06:58, 12 September 2011 (UTC)

Script bug report[edit]

Seems it's adding BrEng tags on top of AusEng's Dl2000 (talk) 00:15, 29 October 2011 (UTC)

OK, just took a look at the routine in question, though I haven't had a chance to try any script tests yet. However, I noticed that you assigned reB first to the Australian regexp, but then wrote that over with the British one. What is needed is a separate reA variable for the Australian regexp. Then it would be applied to cases other than itself. Also, in each case, all other variants should be substituted. The coding could be changed to something like this (though I haven't tested this yet, and it may be subject to formatting issues, suggested changes in blue):
function insert_Engvar(v){
        // Add a template to the article identifying English variant
        var box = document.editform.wpTextbox1;
        var txt = box.value;
 
        // Build a string with "Month YYYY"
       var dateobj=new Date();
       var month=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
       var datestr= month[dateobj.getMonth()] + ' ' + dateobj.getFullYear();

       // Matches Use Australian English or EngvarA
       var reA = new RegExp('{{[_ ]*(?:[Uu]se[_ ]+Australian[_ ]+English|[Ee]ngvarA)[_ ]*(?:|\\|[ ]*date[ ]*=[^{}\\|]*)[ ]*}}', 'gi');
       // Matches Use British English or EngvarB
       var reB = new RegExp('{{[_ ]*(?:[Uu]se[_ ]+British[_ ]+English|[Ee]ngvarB)[_ ]*(?:|\\|[ ]*date[ ]*=[^{}\\|]*)[ ]*}}', 'gi');
       // Matches Use British (Oxford) English or EngvarOx
       var reOx = new RegExp('{{[_ ]*(?:[Uu]se[_ ]+British[_ ]+\\(Oxford\\)[_ ]+English|[Ee]ngvarOx)[_ ]*(?:|\\|[ ]*date[ ]*=[^{}\\|]*)[ ]*}}', 'gi');
       // Matches Use Canadian English or EngvarC
       var reC = new RegExp('{{[_ ]*(?:[Uu]se[_ ]+Canadian[_ ]+English|[Ee]ngvarC)[_ ]*(?:|\\|[ ]*date[ ]*=[^{}\\|]*)[ ]*}}', 'gi');

       switch (v) {
           case 'A':
           // Replace existing variants with Australian
           txt = txt.replace( reOx, '{{Use Australian English|date=' + datestr + '}}');
           txt = txt.replace( reB, '{{Use Australian English|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{Use Australian English|date=' + datestr + '}}');
           // Prepend Australian template if not already tagged
           if( txt.search(reA) == -1 ) {
               txt = '{{Use Australian English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
          case 'Ox':
           // Replace with British (Oxford)
           txt = txt.replace( reA, '{{Use British (Oxford) English|date=' + datestr + '}}');
           txt = txt.replace( reB, '{{Use British (Oxford) English|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{Use British (Oxford) English|date=' + datestr + '}}');
           // Prepend British (Oxford) template if not already tagged
           if( txt.search(reOx) == -1 ) {
               txt = '{{Use British (Oxford) English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
        case 'B':
           // Replace with British
           txt = txt.replace( reA, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reOx, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{Use British English|date=' + datestr + '}}');
           // Prepend British template if not already tagged
           if( txt.search(reB) == -1 ) {
               txt = '{{Use British English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
        case 'C':
           // Replace with Canadian
           txt = txt.replace( reA, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reB, '{{Use Canadian English|date=' + datestr + '}}');
           txt = txt.replace( reOx, '{{Use Canadian English|date=' + datestr + '}}');
           // Prepend Canadian template if not already tagged
           if( txt.search(reC) == -1 ) {
               txt = '{{Use Canadian English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
       }

        box.value = txt;
}

Dl2000 (talk) 03:52, 29 October 2011 (UTC)

  • Ah yes, silly me. I had meant to create 'ReA' and not a second 'ReB'. Ohconfucius ¡digame! 04:12, 29 October 2011 (UTC)
    • I have now created a button for Australian English. The vocabulary engine for this is identical to British English. My question is that, when I run the 'British' script button on an article you processed using Australian, how can I get the script recognise the Aus template and update it, and not to insert British template? --Ohconfucius ¡digame! 05:05, 29 October 2011 (UTC)
      • Hmmm... seems the script is designed to override existing templates. Sometimes that may come in handy e.g. to fix British articles mistagged as another variant. However, to have the script respect an existing variant tag, you'd likely need separate button, one to stop if an existing format is applied, and another to override. One way might be to add an override parameter to the function (insert_Engvar(v, override)) - a 1/true override value would run the function as it does now; 0/false on a variant would check if another variant tag exists in the article, and if so, stop the conversion e.g. run British without override, first test if reA, reC or reOx are present, if so return out of the function; otherwise, proceed to tidy up for British English. Not sure how to signal that the function stopped on an existing tag, though, other than not to make any changes (perhaps append an edit summary code?). I haven't had a chance to work on scripting the concept out yet, though. Dl2000 (talk) 14:50, 29 October 2011 (UTC)
        • Not to worry for now, it's not urgent. Please just come back when you think of how to do it. Cheers, --Ohconfucius ¡digame! 14:53, 29 October 2011 (UTC)
          • Check this function out:
// type - the full word of the English variant type to be tagged to
function Dl2_EngTag(type) {
    var txt=document.editform.wpTextbox1;
 
    // If there's an existing tag, prompt to override
    langvars = new Array("American", "Australian", "British (Oxford)", "British", "Canadian", "Indian", "Irish", "Pakistani" );
    var curryyyymm = Dl2_CurrMY();
 
    for (i = 0; i < langvars.length; i++)
    {
        var rxTemp = new RegExp('{{[_ ]*(?:[Uu]se[_ ]+' + langvars[i] + '[_ ]+English|[Ee]ngvarB)[_ ]*(?:|\\|[ ]*date[ ]*=[^{}\\|]*)[ ]*}}', 'gi');
        if ((langvars[i] != type) && (txt.value.search(rxTemp) >= 0))
        {
            if (confirm(langvars[i] + ' English tag already exists - override?'))
            {
                var newtag='{{Use ' + type + ' English|date='+curryyyymm+'}}';
                txt.value=txt.value.replace(rxTemp, newtag);
            }
            else
            {
                return;
            }
        }
    }
 
    // add tag if not already present (or changed above)
    var rxpdd = new RegExp("{{Use " + type + " English", "gi");
    var dflagfound = txt.value.search(rxpdd);
    if (dflagfound == -1)
    {
        txt.value='{{Use ' + type + ' English|date='+curryyyymm+'}}\r\n'+txt.value;
    }
}
This is called with the full language name e.g. Dl2_EngTag("British"). The key is in the langvars array, which is a list of the full variant names, which are looped through in the first section to check for existing language tags. If a different tag is found that the variant to be applied, the script will prompt to override and change the tag - OK/Cancel. The last part will add a new tag if none was available. Updating a single langvars array should be better to maintain that having to update numerous cases. Dl2000 (talk) 21:55, 29 October 2011 (UTC)

The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Annex/annexe[edit]

EngvarB (Oxford) is correcting annex to annexe. However international standards (ISO/IEC) [3] written in British Oxford English use the annex spelling, furthermore the Oxford dictionary [4] suggests both are correct. However annexe is listed as chiefly British, I suggest we always use annex per MOS:COMMONALITY. Lmatt (talk) 20:20, 2 January 2012 (UTC)

Part of policy?[edit]

I thought this was part of MOS. If it works as a subpage of Ohconfucius, why complain? It just seems "unusual." Student7 (talk) 16:26, 11 January 2014 (UTC)

Words to avoid[edit]

The policy mentions ise vs ize compromises. I would think that a list of "words to avoid" might be in order. Americans/Canadians should be careful about using the word "napkin" for example, meaning an article of hygiene in British, but they should use "serviette" (or whatever) instead.

British should really avoid using words with an unnecessary "st" at the end, like "amongst," "whilst," for example. These sound "funny/humorous" to an American (and probably Canadian) ear. It's hard to take the article seriously after encountering these words. "Among" and "while" are equally valid and don't put off an American audience. When I've tried to get editors to change in the past, they became quite annoyed! Even though this would improve readability. I'm sure there are many other words on all sides. Student7 (talk) 16:26, 11 January 2014 (UTC)