30 lines
1 KiB
Markdown
30 lines
1 KiB
Markdown
# 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):
|
|
|
|
```py
|
|
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",
|
|
...
|
|
}
|
|
```
|
|
|
|
2. 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.
|