Language Support
html2rss recognizes words such as “read more”, “sponsored”, “advertisement”, “related” and “comments” to tell real articles from page furniture. It reads these words in the page’s own language.
Supported languages
Section titled “Supported languages”29 languages:
| Code | Language | Code | Language | Code | Language |
|---|---|---|---|---|---|
ar |
Arabic | hi |
Hindi | ro |
Romanian |
cs |
Czech | hu |
Hungarian | ru |
Russian |
da |
Danish | id |
Indonesian | sv |
Swedish |
de |
German | it |
Italian | th |
Thai |
el |
Greek | ja |
Japanese | tr |
Turkish |
en |
English | ko |
Korean | uk |
Ukrainian |
es |
Spanish | nl |
Dutch | vi |
Vietnamese |
fa |
Persian | no |
Norwegian | zh |
Chinese |
fi |
Finnish | pl |
Polish | ||
fr |
French | pt |
Portuguese | ||
he |
Hebrew |
Chinese covers Simplified and Traditional text in one list. A regional tag such as de-AT or zh-Hant-TW uses its main language.
How the page language is chosen
Section titled “How the page language is chosen”html2rss takes the first of these:
channel.languagein your config- the
Content-Languageresponse header (upper or lower case; only the two-letter main tag counts) - the
langattribute of the page’s root element
channel: url: https://example.de language: de # override when the page declares none or the wrong oneauto_source: {}Quote Norwegian in YAML: language: "no". An unquoted no is read as false and fails validation. The tags nb (Bokmål) and nn (Nynorsk) use the Norwegian list.
A word that is also a common word or name in some language, such as the Swedish share label “dela” (also a surname), counts only on a page in that language. If the language is blank or not in the list, every language’s words apply.
Text and encodings
Section titled “Text and encodings”- Right-to-left text. Invisible direction marks in Arabic, Hebrew and Persian text are ignored, so they no longer break title and sponsorship matching.
- Chinese encodings. Pages labeled
gbkorbig5decode the way browsers decode them. - Unknown encodings. A page that declares a character set Ruby cannot convert is cleaned up instead of failing.
Help improve a language
Section titled “Help improve a language”No native speaker has reviewed the word lists of these 18 languages: Arabic (ar), Chinese (zh), Czech (cs), Danish (da), Finnish (fi), Greek (el), Hebrew (he), Hindi (hi), Hungarian (hu), Indonesian (id), Korean (ko), Norwegian (no), Persian (fa), Romanian (ro), Thai (th), Turkish (tr), Ukrainian (uk) and Vietnamese (vi). If you read one of them, please check its file. You may spot a missing “read more”, a wrong “sponsored”, or a word that misfires.
Each language is one small Ruby file: lib/html2rss/vocabulary/<code>.rb in the html2rss repository. For example, de.rb is German.
- Open the file on GitHub.
- Click the pencil (Edit) button. GitHub explains how editing files works.
- Change the words and propose the change as a pull request.
You do not need a local Ruby setup.
Add a new language
Section titled “Add a new language”Developers can add a language by following CONTEXT.md in the html2rss repository (section “Vocabulary”):
- Write
lib/html2rss/vocabulary/<code>.rbagainst the concept list of an existing language. - Add it to
Vocabulary::PAGE_ONLY. New languages start there, so their words apply only on a page in that language. - Run the report against a folder of saved pages with a
manifest.tsv:
# from the html2rss repositorymake language-check CODE=<code> PAGES=<dir of saved pages + manifest.tsv>The report lists how feeds and link classification change, which words hit on your pages, and the memory cost. It decides nothing; a person reads the differences.
