Home/Projects/Haq/Languages and translation
Read in your language

हिन्दीবাংলাEspañolFrançaisDeutschMore languages

Opens Google Translate, which sends this page's text to Google. The English is the reference. The Haq app itself has Hindi, Bengali, Spanish, French and German built in, offline.

Languages and translation

Haq's built-in Hindi, Bengali, Spanish, French and German, and optional machine translation through a LibreTranslate server you choose.

Legal information, not legal advice Haq shows what the law says and where to go. Only the police and courts decide what an offence is. Check every result and act at your own discretion.

Haq works in two layers.

Built in, offline. Every page comes in English, Hindi (हिन्दी) and Bengali (বাংলা), including Home's "Did you know?" facts, the demo, the privacy check's rules and fix tips, the Community page and screen-reader labels: the labels and buttons, and also the text the rule packs draw, such as the Report routes, platform rules, law titles and notes, scheme details, documents, how to apply and grievance routes. Names, phone numbers and web addresses stay as they are, and what you type is never changed. Pick a language with the EN · हि · বা switch at the top of any page. Nothing is sent anywhere, and the choice is remembered on that device.

Machine translation, optional. For another language, or to check a page with a second translation (see Reading Haq in any other language below for the easier option, your browser's own Translate), press Translate the whole page (it appears once you pick Hindi or Bengali; the server is set under the ⚙ settings button). Haq sends the page's text to a LibreTranslate server and shows the result.

What is and isn't sent#

  • Sent: the text Haq shows on the page, such as rule titles, routes and scheme descriptions.
  • Never sent: anything you typed, your drafts, your file names and files, and quotes from your own privacy notice.

English stays the reference text. Machine translation can get legal terms wrong, so check names of laws, deadlines and amounts against the English before you act.

Choosing a server#

LibreTranslate is free and open source. You can:

  • Run your own (recommended for privacy) on an https:// address, and add that address to the Content-Security-Policy as described below.
  • Use libretranslate.com, which needs an API key.

The hosted Haq only allows https://libretranslate.com, so that every connection is encrypted. To use another server, such as a LibreTranslate on your own computer (http://localhost:5000) or your own https:// server, add it to connect-src in app/_headers and in the <meta> tag of each page, then run or deploy your own copy of Haq.

Reading Haq in any other language#

Every page has a small i button next to the ⚙ settings button. It explains, in plain words and in each built-in language, the three ways to read Haq in your language:

  1. Hindi, Bengali, Spanish, French and German are built in. Tap हि, বা, ES, FR or DE at the top (on a phone, pick from the language menu). They work without internet, and nothing is sent anywhere.

  2. For any other language, use your phone's or browser's own Translate. It is the easiest way and needs no setup:

    • Chrome on a phone: tap ⋮ at the top right, then Translate, and pick your language.
    • Chrome or Edge on a computer: right-click the page and choose Translate.
    • Safari on iPhone: tap aA in the address bar, then Translate (where the iPhone offers it).

    The browser's Translate may send the page's text to the company behind the browser, so the i button suggests using it to read and turning it off before typing personal details.

  3. Haq's own page translation keeps typed details private. Open ⚙ Translation settings, add a LibreTranslate server and its API key, and press Translate the whole page. Anything the person typed, or a file name they picked, is left out of what is sent. A key can be bought from libretranslate.com, or someone technical can run a free LibreTranslate server (it is open source).

Whichever way is used, the English text is the reference: if something matters, check the English.

How the built-in translation works#

  • Fixed page text uses data-i18n keys: Hindi and Bengali in app/i18n.js; Spanish, French and German in app/i18n-es.js, app/i18n-fr.js and app/i18n-de.js (strings).
  • Text that scripts draw is looked up by its English wording in app/i18n-text.js for Hindi and Bengali, the text block of app/i18n-es.js, -fr.js and -de.js, and each pack's i18n block (schemes, compliance map). Daily facts carry each language in the pack itself. A small observer swaps any text that matches, including text that appears later, and puts the English back when English is chosen. Typed text, textarea, pre and the printable FIR are never touched.
  • The FIR information PDF is for Indian police, so it stays in English for Spanish, French and German. For Hindi and Bengali it is bilingual: every item label is in English with the chosen language beside it, the request to the officer is in English with a translation, and the rights and digital FIR steps are in the chosen language.

Tone#

Haq speaks to one person, plainly. Spanish uses tú, German du (as Apple's German pages do), French vous, Hindi आप and Bengali আপনি. Quotes the person says to an officer stay polite ("Bitte geben Sie mir…"). tests do not check tone, so reviewers should.

Offering the browser's language#

Browsers' own "Translate this page?" prompts are often turned off or blocked. So the first time someone opens Haq, it reads the browser's preferred languages on the device (navigator.languages) and, if the first one is Hindi, Bengali, Spanish, French or German, shows a small box at the top of the page in that language: "¿Leer Haq en español?" with Yes and No. For any other non-English language it offers the i help instead. The box goes away for good once the person picks a language or says no (haq.langOffer in local storage). Nothing is sent.

Typing in any language#

On Report, words people type are matched in all six languages: English and Hinglish, Hindi, Bengali, Spanish, French and German. Accents are optional ("agresion" matches "agresión"). See the Report module.

Adding a language#

  1. Copy app/i18n-de.js to app/i18n-xx.js and translate strings (keyed by data-i18n key) and text (keyed by the English).
  2. Import it in app/i18n.js and app/i18n-text.js, and add it to LANGS and SHORT in app/i18n.js, and to the service worker's file list in app/sw.js.
  3. Add the language to each pack's translations: daily facts (packs/awareness/india.json and global.json), schemes (packs/benefits/india.json i18n) and the compliance map (scripts/map_i18n_eu.py or a new file, then run scripts/make_map_pack.py).
  4. Add typed words to text_hints in packs/report/india.json.
  5. Run the tests; tests/test_map.mjs fails until every map line is translated.

Coming next#

  • More Indian languages for the built-in labels. Translations from native speakers are welcome, and corrections to the Spanish, French and German too.
  • Bhashini, the Government of India's language platform, as a second translation option. It needs a registered API key, so it will be opt-in like LibreTranslate.

Haq is free to use. © Abhisek Goswami, all rights reserved. Suggestions, translations, legal reviews and feedback are welcome.

Still need help?

Email me directly and I'll reply myself, usually within two working days. Please don't include personal details of your case.