Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Timo Ludwig <timo.ludwig@tuerantuer.org>
  • Loading branch information
JoeyStk and timobrembeck committed Mar 21, 2023
1 parent a1e58f9 commit 6b54ffb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion integreat_cms/cms/templates/languages/language_form.html
Expand Up @@ -62,7 +62,7 @@ <h3 class="font-bold text-black">
<i class="h-5" icon-name="alert-triangle"></i>
{# djlint:off #}
{% blocktranslate trimmed with link="href='https://www.deepl.com/de/docs-api/translate-text/translate-text/' target='_blank' class='underline'" %}
For some languages, DeepL needs a correct BCP47 code (for example English or Portuguese).
For some languages, DeepL needs a correct BCP47 tag (for example English or Portuguese).
For more information, please checkout the <a {{ link }}>DeepL documentation</a>.
{% endblocktranslate %}
{# djlint:on #}
Expand Down
6 changes: 3 additions & 3 deletions integreat_cms/deepl_api/utils.py
Expand Up @@ -47,7 +47,7 @@ def check_availability(request, target_language):
and source_language.slug in deepl_config.supported_source_languages
and (
target_language.slug in deepl_config.supported_target_languages
or target_language.bcp47_code in deepl_config.supported_target_languages
or target_language.bcp47_tag.lower() in deepl_config.supported_target_languages
)
)

Expand All @@ -58,12 +58,12 @@ def get_target_language_key(self, target_language):
:param target_language: the target language
:type target_language: ~integreat_cms.cms.models.abstract_content_translation.AbstractContentTranslation
:return: target_language_key which is 2 characters long for all languages except English and Portugese where the BCP code is transmitted
:return: target_language_key which is 2 characters long for all languages except English and Portugese where the BCP tag is transmitted
:rtype: str
"""
deepl_config = apps.get_app_config("deepl_api")
for code in [target_language.slug, target_language.bcp47_tag]:
if code in deepl_config.supported_target_languages:
if code.lower() in deepl_config.supported_target_languages:
return code
return None

Expand Down
6 changes: 3 additions & 3 deletions integreat_cms/locale/de/LC_MESSAGES/django.po
Expand Up @@ -5130,13 +5130,13 @@ msgstr "oder"
#: cms/templates/languages/language_form.html
#, python-format
msgid ""
"For some languages, DeepL needs a correct BCP47 code (for example English or "
"For some languages, DeepL needs a correct BCP47 tag (for example English or "
"Portuguese). For more information, please checkout the <a %(link)s>DeepL "
"documentation</a>."
msgstr ""
"Für einige Sprachen benötigt DeepL den korrenten BCP47 Code (zum Beispiel "
"Für einige Sprachen benötigt DeepL den korrekten BCP47-Tag (zum Beispiel "
"für Englisch oder Portugiesisch). Für weitere Informationen lesen Sie bitte "
"<a %(link)s> die DeepL documentation</a>."
" die <a %(link)s>DeepL Dokumentation</a>."

#: cms/templates/languages/language_form.html
msgid "Translations"
Expand Down

0 comments on commit 6b54ffb

Please sign in to comment.