-
Notifications
You must be signed in to change notification settings - Fork 23
Choice of artefacts language #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
41ee3dd
f8a40da
4739926
e1efe19
8a94547
acc78a3
8d911c1
de26b53
d368978
7ee2087
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| from osa_tool.operations.analysis.repository_report.response_validation import YesNoPartial | ||
|
|
||
| TRANSLATIONS = { | ||
| "English": { | ||
|
Comment on lines
+3
to
+4
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Нам обязательно для каждого языка и модуля заполнять эти значения? Если добавится поддержка китайского, то нужно будет ключ - значение и для него прописывать? Я думаю может это ЛЛМке на откуп отдать? Если у нас появятся другие значения, то как их добавлять? Может в конфиг или еще куда-то это вынести, а не в константой? |
||
| "report_header": "Repository Analysis Report", | ||
| "statistics": "Statistics", | ||
| "values": "Values", | ||
| "stars_count": "Stars Count", | ||
| "forks_count": "Forks Count", | ||
| "issues_count": "Issues Count", | ||
| "metric": "Metric", | ||
| "readme_presence": "README Presence", | ||
| "license_presence": "License Presence", | ||
| "documentation_presence": "Documentation Presence", | ||
| "examples_presence": "Examples Presence", | ||
| "requirements_presence": "Requirements Presence", | ||
| "tests_presence": "Tests Presence", | ||
| "description_presence": "Description Presence", | ||
| "repository_name": "Repository Name", | ||
| "owner": "Owner", | ||
| "created_at": "Created at", | ||
| "repository_structure": "Repository Structure", | ||
| "compliance": "Compliance", | ||
| "missing_files": "Missing Files", | ||
| "organization": "Organization", | ||
| "readme_analysis": "README Analysis", | ||
| "quality": "Quality", | ||
| "documentation": "Documentation", | ||
| "test_present": "Test present", | ||
| "documentation_quality": "Document quality", | ||
| "outdated_content": "Outdated content", | ||
| "key_shortcomings": "Key Shortcomings", | ||
| "recommendations": "Recommendations", | ||
| "readme_quality": "text", | ||
| "project_description": "Project description", | ||
| "installation": "Installation", | ||
| "usage_examples": "Usage examples", | ||
| "contribution_guidelines": "Contribution guidelines", | ||
| "license_specified": "License specified", | ||
| "badges_present": "Badges present", | ||
| "summary_header": "OSA Work Summary", | ||
| "what_have_been_done": "What have been done", | ||
| "report_by_tasks": "Report by tasks", | ||
| "yes": "Yes", | ||
| "no": "No", | ||
| "partial": "Partial", | ||
| "report": "Report", | ||
| "translate_dirs": "Translate dirs", | ||
| "convert_notebooks": "Convert notebooks", | ||
| "translate_readme": "Translate readme", | ||
| "ensure_license": "Ensure license", | ||
| "community_docs": "Community docs", | ||
| "docstring": "Docstring", | ||
| "ignore_list": "Ignore list", | ||
| "incremental": "Incremental", | ||
| "target_files": "Target files", | ||
| "readme": "Readme", | ||
| "refine_readme": "Refine readme", | ||
| "requirements": "Requirements", | ||
| "organize": "Organize", | ||
| "about": "About", | ||
| "validate_paper": "Validate paper", | ||
| "validate_doc": "Validate doc", | ||
| "author": "Author", | ||
| "generate_workflows": "Generate workflows", | ||
| "include_tests": "Include tests", | ||
| "include_black": "Include black", | ||
| "include_pep8": "Include pep8", | ||
| "include_autopep8": "Include autopep8", | ||
| "include_fix_pep8": "Include fix pep8", | ||
| "include_pypi": "Include pypi", | ||
| "python_versions": "Python versions", | ||
| "pep8_tool": "Pep8 tool", | ||
| "use_poetry": "Use poetry", | ||
| "include_codecov": "Include codecov", | ||
| }, | ||
| "Russian": { | ||
| "report_header": "Отчет об анализе репозитория", | ||
| "statistics": "Статистика", | ||
| "values": "Значения", | ||
| "stars_count": "Количество звезд", | ||
| "forks_count": "Количество форков", | ||
| "issues_count": "Количество issues", | ||
| "metric": "Метрика", | ||
| "readme_presence": "Наличие README", | ||
| "license_presence": "Наличие лицензии", | ||
| "documentation_presence": "Наличие документации", | ||
| "examples_presence": "Наличие примеров", | ||
| "requirements_presence": "Наличие requirements", | ||
| "tests_presence": "Наличие тестов", | ||
| "description_presence": "Наличие описания", | ||
| "repository_name": "Имя репозитория", | ||
| "owner": "Владелец", | ||
| "created_at": "Создан", | ||
| "repository_structure": "Структура репозитория", | ||
| "compliance": "Соответствие стандартам", | ||
| "missing_files": "Отсутствующие файлы", | ||
| "organization": "Организация", | ||
| "readme_analysis": "Анализ README", | ||
| "quality": "Качество", | ||
| "documentation": "Документация", | ||
| "test_present": "Наличие тестов", | ||
| "documentation_quality": "Качество документации", | ||
| "outdated_content": "Устаревший контент", | ||
| "key_shortcomings": "Ключевые недостатки", | ||
| "recommendations": "Рекомендации", | ||
| "readme_quality": "текст", | ||
| "project_description": "Описание проекта", | ||
| "installation": "Установка", | ||
| "usage_examples": "Примеры использования", | ||
| "contribution_guidelines": "Руководство по внесению вклада", | ||
| "license_specified": "Лицензия указана", | ||
| "badges_present": "Наличие бейджей", | ||
| "summary_header": "Сводка работы OSA", | ||
| "what_have_been_done": "Что было сделано", | ||
| "report_by_tasks": "Отчет по задачам", | ||
| "yes": "Да", | ||
| "no": "Нет", | ||
| "partial": "Частично", | ||
| "report": "Отчет", | ||
| "translate_dirs": "Перевод директорий", | ||
| "convert_notebooks": "Конвертация ноутбуков", | ||
| "translate_readme": "Перевод README", | ||
| "ensure_license": "Обеспечение наличия лицензии", | ||
| "community_docs": "Документы сообщества", | ||
| "docstring": "Строки документации", | ||
| "ignore_list": "Список исключений", | ||
| "incremental": "Инкрементальный режим", | ||
| "target_files": "Целевые файлы", | ||
| "readme": "Файл README", | ||
| "refine_readme": "Улучшение README", | ||
| "requirements": "Требования (зависимости)", | ||
| "organize": "Организация структуры", | ||
| "about": "Раздел «О проекте»", | ||
| "validate_paper": "Проверка статьи (paper)", | ||
| "validate_doc": "Проверка документации", | ||
| "author": "Автор", | ||
| "generate_workflows": "Генерация рабочих процессов (workflows)", | ||
| "include_tests": "Включить тесты", | ||
| "include_black": "Использовать Black", | ||
| "include_pep8": "Использовать PEP8", | ||
| "include_autopep8": "Использовать autopep8", | ||
| "include_fix_pep8": "Включить автоисправление PEP8", | ||
| "include_pypi": "Интеграция с PyPI", | ||
| "python_versions": "Версии Python", | ||
| "pep8_tool": "Инструмент проверки PEP8", | ||
| "use_poetry": "Использовать Poetry", | ||
| "include_codecov": "Интеграция с Codecov", | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| class ReportTranslationManager: | ||
| def __init__(self, target_language): | ||
| self.target_language = target_language if target_language in TRANSLATIONS.keys() else "English" | ||
|
|
||
| def get(self, key: str) -> str | None: | ||
| return TRANSLATIONS[self.target_language].get(key) | ||
|
|
||
| def yes_no_partial(self, key: YesNoPartial) -> str | None: | ||
| if key == YesNoPartial.YES: | ||
| return self.get("yes") | ||
| elif key == YesNoPartial.NO: | ||
| return self.get("no") | ||
| elif key == YesNoPartial.PARTIAL: | ||
| return self.get("partial") | ||
| return None | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the model returns Useful? React with 👍 / 👎. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For non-English reports this blanket instruction applies to every JSON value, including
structure.missing_files, which is later joined directly into the PDF. That can cause the model to translate concrete repository paths or filenames such astests/requirements.txt, so the report can name files that do not actually exist instead of preserving the missing artifact names verbatim. Add an explicit exception for file, directory, package, and operation identifiers.Useful? React with 👍 / 👎.