cqas/doc/md/translations.md
Arija A. e935e47683
Add natural language translations.
Signed-off-by: Arija A. <ari@ari.lt>
2025-10-07 17:36:51 +03:00

1 KiB

CQaS Translations

CQaS supports an extensible architecture of translations, hereby you can learn how to learn how to create your own CQaS translations and add new strings.

Translating CQaS

To translate CQaS:

  1. Create a file in lang/<language code>.py and create a STRINGS constant mapping common IDs (see lang/en.py to natural language templates):
from typing import Dict, Tuple, Final

__all__: Tuple[str] = ("STRINGS",)

STRINGS: Final[Dict[str, str]] = {
    "cqas_welcome": "PYTHON CODE QUALITY & SECURITY ANALYSIS REPORT",
    "analysis_complete": "Analysis completed in %s",
    "report_generated": "Report generated by the CQaS analyser v%s",
    "sec_analysis_header": "DETAILED SECURITY ANALYSIS",
    "sec_issues_by_sev": "Security Issues by Severity",
    ...
}
  1. Open lang/__init__.py, import your language at the top of the file and register the language in the LANGS dictionary.

Add Your Own Strings

To add your own strings to CQaS simply create a custom key name, add it to lang/en.py, and use the s() function.