Validator Localization PackagesWhat is localization package?Localization package is a script that tunes Validator up for your country. The script can enable/disable checks, set params and exceptions, translate user interface and messages.
There are two types of localization packages:
1. Built-in or
default packages (come bundled with Validator).
2. External or
user packages (the subject of this document):
a) user packages
with params and translationsb) user packages
just with paramsUser packages have higher priority, so they can override default options.
How to create a localization package?1. Position WME over
your country.2. Switch WME to
your language to get options and translations
or switch WME to "English" to get a package just with options.
3. Make sure any previous version of your script is
ENABLED.4. Prepare your country ISO
Alpha-2 country code:
list of codes (example: ES)
5. In Validator click
Settings->About->(magic wand) and answer the questions if any.
6. The generated package is a
Greasemonkey/Tampermonkey script ready for installation.
Copy and paste it into a new .user.js file or directly paste into the Greasemonkey/Tampermonkey.
Example filename: Validator-Spain.user.js
How to tune up/translate the package?1. Open the .user.js file in a text editor. You can create a Google document and share the file among few editors/translators.
2. Search (Ctrl+F) for string "TODO:" and translate/check the marked strings. Please also remove the "TODO" marker. Example:
- Code: Select all
"report.link.forum": "TODO: forum", -> "report.link.forum": "foro",
3. To enable a check, add/change the following line:
- Code: Select all
"101.enabled": true,
To disable the check:
- Code: Select all
"101.enabled": false,
4. For some checks you can also set params. Have a look at the complete list of validations for the list of params and their description:
forum linkFor example, to create a custom check 'Street name with a dot (excluding Ramps)', add the following lines:
- Code: Select all
"130.enabled": true,
"130.severity": "warning",
"130.params": {
"titleEN": "Street name with a dot",
"problemEN": "There is a dot in the street name (excluding Ramps)",
"solutionEN": "Expand the abbreviation or remove the dot",
"template": "${type}:${street}",
"regexp": "D/^[^4][0-9]?:.*\\./",
},
*Note: use D at the beginning of RegExp to enable debugging on JS console.
*Note: do not forget to escape backslashes in strings, i.e. use "\\" instead of "\".
How to install the package?The Wizard generates
Greasemonkey/Tampermonkey script ready for installation.
You can copy and paste it directly into the Greasemonkey/Tampermonkey.
To add the script in Chrome/Tampermonkey:Install Tampermonkey for Chrome:
Web Storea) copy your script to the clipboard (Ctrl+C)
b) click Tampermonkey icon in Chrome
c) from the drop-down menu select "Add a new script"
d) in the script editor select all (Ctrl+A) and paste your script instead (Ctrl+V)
e) click "Save" (not "Save to disc")
To add the script in Firefox/Greasemonkey:Install Greasemonkey for Firefox:
Add-Onsa) copy your script to the clipboard (Ctrl+C)
b) click Greasemonkey icon in Firefox
c) from the drop-down menu select "New user script"
d) click "Use script from clipboard" button
e) click "Save"
Reload the page, click Tampermonkey/Greasemonkey icon and make sure your script is there.
How to distribute the package?The generated package is a
Greasemonkey/Tampermonkey script ready for installation. There are two ways to distribute your localization package:
1. Your local community maintain/distribute the package. Let me know when your package is ready, so I put a link to your package on the Validator main page.
So you need two scripts installed: "Validator" and "Validator for your country".2. Alternatively, on your request I can import the whole package back into the Validator. So your package becomes a default built-in package bundled with Validator.
How to update the package?1. It is OK if Validator version does not match your localization pack version. In case your localization package miss a string or an option, Validator will use english strings/default options instead.
2. Make sure the previous version of your script is installed and enabled, so you see your translations.
3. In Validator click
Settings->About->Wizard, answer the questions if any and generate updated localization pack.
Note that all your translations will be preserved in this updated script and all new/changed strings will be marked with "TODO".
See "How to create a localization package?" section above for more details.