Wikipedia:WikiProject User scripts/Scripts/Language Converter
This script adds a menu at the top of pages and let you change the spellings from/to Britsh/American English based in lists of words (en-US and en-GB), editable by anyone.
You can see the changes directly in the dictionary pages, for example, or accessing articles where there are words in the lists (like Belgium and others).
Features
Dictionaries
The conversion between English variants is done based on the following dictionaries (which are based on this list and still needs to be reviewed by native English speakers):
Both dictionaries are also displayed side by side on this page.
All users can help to improve the dictionaries used by this script editing the corresponding page. All dictionaries use the same syntax to define the conversion rules:
*original expression: converted expression//comments or <ref>Notes about this rule, if necessary</ref>
On this example, "converted expression" is the expression to which "original expression" should be converted (and this is an expression which is present in various articles). The text after "//" will be ignored when converting the page, so it is possible to use this space to add relevant notes about specific rules, to clarify its purpose or help future editors of the dictionary.
If necessary, it is possible to disable a rule (without completely removing it from the dictionary) by changing the "*" by ":". This is useful when a user notice a rule which causes false positives, and the rule can be further discussed on the dictionary talk page and eventually removed. It is also possible to define some regular expressions in the configuration of the script for pre-converting the text.
Avoiding conversion on specific places
It is possible to avoid the conversion of the text of some HTML elements by adding the class "no-conversion" to them. This is useful to avoid false positives in some places.
Local dictionaries
In addition to the global dictionaries, each page can have a local dictionary which will be used through that page. The format is as follows (this can be added to a template similar to this, for easy of use and/or tracking purposes)
<div id="lang-conv" style="display:none;" >
<div id="local-dic-GB">
* some: conversion rule
* another: conversion rule // This is a comment related to this rule
</div><div id="local-dic-US">
* one more: conversion rule
</div></div>
Installation
To install this user script, add the following code to your common.js. It will import the content of the JavaScript and the CSS used by the script.
JavaScript
// Keep the line below. It is used to check the global usage of the script at [[Special:GlobalUsage/User:He7d3r/Tools/LanguageConverter.js]]
// [[File:User:He7d3r/Tools/LanguageConverter.js]] (see [[phab:T35355]])
mw.loader.load( '//pt.wikibooks.org/w/index.php?title=Utilizador:He7d3r/Tools/LanguageConverterForEnglish.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//pt.wikibooks.org/w/index.php?title=Utilizador:He7d3r/Tools/LanguageConverterForEnglish.css&action=raw&ctype=text/css', 'text/css' );
See also
- WP:ENGVAR
- phab:T33015 - Convert between English language variants in display of pages
- Wikipedia:Village pump (proposals)#Script to compensate for nationality differences in articles
- Script documentation on Portuguese Wikisource (in Portuguese)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.