Respec: Linter rule to check for non-en-US english in IDL

Created on 6 Feb 2019  路  18Comments  路  Source: w3c/respec

See this Twitter thread:
https://twitter.com/marcosc/status/1093151940769341440?s=20

In W3C docs/specs, we should check WebIDL attributes and operation identfiers are in US English.

I wonder if there is some way of doing it? Need to research.

Most helpful comment

I think this might be impossible to do reliably... @CodHeK, before looking at code, check if it's even possible at all without an actual real dictionary. I just don't think it is, because, for example:

attribute Laser laser;

So we would need some kind of dictionary lookup.... unless there is some actual Dictionary API on the web we would use, but that seems a bit extreme.

All 18 comments

@marcoscaceres can I try this ?

@marcoscaceres That's a WebExtensions API but ReSpec is not an extension 馃槄

Oh whoops... totally missed that. I was wondering how I'd missed that API... would have been a "too good to be true" addition to the web :)

@marcoscaceres can we use this: https://www.npmjs.com/package/languagedetect ?

@CodHeK I don't think we want to add a 200+ KiB dependency. Condition: It should be small enough.

@saschanaz could you please help me find where the WebIDL attributes and operation identfiers are ?

@saschanaz I am just trying to understand what the issue is about and see if we could do anything ...

@saschanaz what are the attributes/identifier here which need to be checked for the language ?

@CodHeK data.name should be checked there as that presents IDL identifiers. I think data.name is enough.

You mean the variable name at L119

I think this might be impossible to do reliably... @CodHeK, before looking at code, check if it's even possible at all without an actual real dictionary. I just don't think it is, because, for example:

attribute Laser laser;

So we would need some kind of dictionary lookup.... unless there is some actual Dictionary API on the web we would use, but that seems a bit extreme.

I got two packages, typo-js (83kb) and check-word (3kb) they both seem pretty lightweight, we could use them I guess .

https://github.com/cfinke/Typo.js

https://www.npmjs.com/package/check-word

ok, 83kb is way too massive... and looks like check-word doesn't give us the precision :(

https://github.com/S0c5/node-check-word/blob/master/index.js#L8

check-word is not 3 KiB as its dictionaries are already 37 MiB.

it has the whole dictionary. That's awesome :) lol..

I think I'm going to close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoscaceres picture marcoscaceres  路  4Comments

saschanaz picture saschanaz  路  5Comments

marcoscaceres picture marcoscaceres  路  3Comments

noamr picture noamr  路  3Comments

saschanaz picture saschanaz  路  6Comments