Skip to content

TilsynForUniversellUtforming/qualweb-locale

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@qualweb/locale

Translation module for QualWeb reports.

How to install

  $ npm i @qualweb/locale --save

Language support

If you want a translation on your own language, follow these steps:

  1. Make a copy of src/locales/en.json and rename it to use the lang code (check 639-1 column)
  2. Translate the modules you want
  3. Update the README.md language support table
  4. Make a pull request with the changes
Language Code Modules support
act-rules wcag-techniques best-practices
English en Full Full Full
Finnish fi Full none none
Swedish sv Full none none
Norwegian Nynorsk nn Full none none
Norwegian Bokmål nb Full none none

How to run

The best way to have a translated report is by using the @qualweb/core module, and passing the locale code you want in the options. If you really want to use this package separately bear in mind that the variables in the sentences wont be translated and some meaning can be lost.

'use strict';

import locales, { translateReport } from '@qualweb/locale';

async () => {
  // EvaluationReport only. EARL report is not currently supported. If you need a EARL report, convert the evaluation report after the translation. Check https://github.com/qualweb/earl-reporter
  const report = 'Evaluation report obtained from @qualweb/cli or @qualweb/core';

  const translatedReport = translateReport(report, 'en');
  // OR
  const translatedReport = translateReport(report, locales.en);
  // OR
  const ownLocale = {
    // If you have a compatible locale object
  };
  const translatedReport = translateReport(report, ownLocale);

  console.log(translatedReport);
};

License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 57.0%
  • JavaScript 43.0%