generated from MinBZK/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9df2c7e
commit beaba71
Showing
21 changed files
with
568 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import logging | ||
from enum import Enum | ||
|
||
from fastapi import Request | ||
|
||
from amt.core.internationalization import get_current_translation | ||
from amt.schema.publication_category import PublicationCategory | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class PublicationCategories(Enum): | ||
IMPACTVOL_ALGORITME = "impactvol algoritme" | ||
NIET_IMPACTVOL_ALGORITME = "niet-impactvol algoritme" | ||
HOOG_RISICO_AI = "hoog-risico AI" | ||
GEEN_HOOG_RISICO_AI = "geen hoog-risico AI" | ||
VERBODEN_AI = "verboden AI" | ||
UITZONDERING_VAN_TOEPASSING = "uitzondering van toepassing" | ||
|
||
|
||
def get_publication_category(key: PublicationCategories | None, request: Request) -> PublicationCategory | None: | ||
""" | ||
Given the key and translation, returns the translated text. | ||
:param key: the key | ||
:param request: request to get the current language | ||
:return: a Publication Category model with the correct translation | ||
""" | ||
|
||
if key is None: | ||
return None | ||
|
||
translations = get_current_translation(request) | ||
_ = translations.gettext | ||
# translations are determined at runtime, which is why we use the dictionary below | ||
keys = { | ||
PublicationCategories.IMPACTVOL_ALGORITME: _("Impactful algorithm"), | ||
PublicationCategories.NIET_IMPACTVOL_ALGORITME: _("Non-impactful algorithm"), | ||
PublicationCategories.HOOG_RISICO_AI: _("High-risk AI"), | ||
PublicationCategories.GEEN_HOOG_RISICO_AI: _("No high-risk AI"), | ||
PublicationCategories.VERBODEN_AI: _("Forbidden AI"), | ||
PublicationCategories.UITZONDERING_VAN_TOEPASSING: _("Exception of application"), | ||
} | ||
return PublicationCategory(id=key.name, name=keys[key]) | ||
|
||
|
||
def get_publication_categories(request: Request) -> list[PublicationCategory | None]: | ||
return [get_publication_category(p, request) for p in PublicationCategories] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-10-16 09:55+0200\n" | ||
"POT-Creation-Date: 2024-10-16 10:41+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -17,27 +17,27 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Babel 2.16.0\n" | ||
|
||
#: amt/api/ai_act_profile.py:23 | ||
#: amt/api/ai_act_profile.py:24 | ||
msgid "Type" | ||
msgstr "" | ||
|
||
#: amt/api/ai_act_profile.py:25 | ||
#: amt/api/ai_act_profile.py:26 | ||
msgid "Is the application open source?" | ||
msgstr "" | ||
|
||
#: amt/api/ai_act_profile.py:27 | ||
#: amt/api/ai_act_profile.py:28 | ||
msgid "Publication Category" | ||
msgstr "" | ||
|
||
#: amt/api/ai_act_profile.py:29 | ||
#: amt/api/ai_act_profile.py:30 | ||
msgid "Is there a systemic risk?" | ||
msgstr "" | ||
|
||
#: amt/api/ai_act_profile.py:31 | ||
#: amt/api/ai_act_profile.py:32 | ||
msgid "Is there a transparency obligation?" | ||
msgstr "" | ||
|
||
#: amt/api/ai_act_profile.py:33 | ||
#: amt/api/ai_act_profile.py:34 | ||
msgid "Role" | ||
msgstr "" | ||
|
||
|
@@ -82,7 +82,7 @@ msgstr "" | |
msgid "Home" | ||
msgstr "" | ||
|
||
#: amt/api/navigation.py:46 amt/site/templates/projects/index.html.j2:7 | ||
#: amt/api/navigation.py:46 amt/site/templates/parts/project_search.html.j2:9 | ||
msgid "Projects" | ||
msgstr "" | ||
|
||
|
@@ -138,6 +138,30 @@ msgstr "" | |
msgid "Instruments" | ||
msgstr "" | ||
|
||
#: amt/api/publication_category.py:36 | ||
msgid "Impactful algorithm" | ||
msgstr "" | ||
|
||
#: amt/api/publication_category.py:37 | ||
msgid "Non-impactful algorithm" | ||
msgstr "" | ||
|
||
#: amt/api/publication_category.py:38 | ||
msgid "High-risk AI" | ||
msgstr "" | ||
|
||
#: amt/api/publication_category.py:39 | ||
msgid "No high-risk AI" | ||
msgstr "" | ||
|
||
#: amt/api/publication_category.py:40 | ||
msgid "Forbidden AI" | ||
msgstr "" | ||
|
||
#: amt/api/publication_category.py:41 | ||
msgid "Exception of application" | ||
msgstr "" | ||
|
||
#: amt/core/exceptions.py:20 | ||
msgid "" | ||
"An error occurred while configuring the options for '{field}'. Please " | ||
|
@@ -239,7 +263,7 @@ msgstr "" | |
msgid "An error occurred. Please try again later" | ||
msgstr "" | ||
|
||
#: amt/site/templates/layouts/base.html.j2:11 | ||
#: amt/site/templates/layouts/base.html.j2:1 | ||
msgid "Algorithmic Management Toolkit (AMT)" | ||
msgstr "" | ||
|
||
|
@@ -270,6 +294,7 @@ msgstr "" | |
#: amt/site/templates/pages/assessment_card.html.j2:7 | ||
#: amt/site/templates/pages/model_card.html.j2:6 | ||
#: amt/site/templates/pages/system_card.html.j2:4 | ||
#: amt/site/templates/parts/filter_list.html.j2:66 | ||
#: amt/site/templates/projects/details_info.html.j2:32 | ||
msgid "Last updated" | ||
msgstr "" | ||
|
@@ -312,6 +337,37 @@ msgstr "" | |
msgid "Algorithm Management Toolkit" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:16 | ||
msgid " ago" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:25 | ||
msgid "result" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:26 | ||
msgid "results" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:28 | ||
msgid "for" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:58 | ||
msgid "" | ||
"No projects match your selected filters. Try adjusting your filters or " | ||
"clearing them to see more projects." | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:64 | ||
#: amt/site/templates/projects/new.html.j2:23 | ||
msgid "Project name" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/filter_list.html.j2:65 | ||
msgid "Phase" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/footer.html.j2:10 | ||
msgid "About us" | ||
msgstr "" | ||
|
@@ -338,6 +394,22 @@ msgstr "" | |
msgid "Everyone is welcome to make comments and suggestions." | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/project_search.html.j2:14 | ||
msgid "New project" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/project_search.html.j2:29 | ||
msgid "Find project..." | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/project_search.html.j2:48 | ||
msgid "Select lifecycle" | ||
msgstr "" | ||
|
||
#: amt/site/templates/parts/project_search.html.j2:59 | ||
msgid "Select publication category" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/details_base.html.j2:24 | ||
msgid "Does the algorithm meet the requirements?" | ||
msgstr "" | ||
|
@@ -490,22 +562,10 @@ msgstr "" | |
msgid "Edit measure" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/index.html.j2:12 | ||
msgid "New project" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/index.html.j2:28 | ||
msgid "Find project..." | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:7 | ||
msgid "Create a new project" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:23 | ||
msgid "Project name" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:26 | ||
msgid "Your project name here" | ||
msgstr "" | ||
|
Binary file not shown.
Oops, something went wrong.