Skip to content

Commit

Permalink
Add translations and expiration time
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschuppi81 committed Sep 10, 2024
1 parent a9e1468 commit 640c7d3
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/onegov/org/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def load_custom_event_tags(self) -> list[str] | None:
def custom_texts(self) -> dict[str, str] | None:
return self.cache.get_or_create(
'custom_texts', self.load_custom_texts,
expiration_time=3600
)

def load_custom_texts(self) -> dict[str, str] | None:
Expand All @@ -378,9 +379,8 @@ def load_custom_texts(self) -> dict[str, str] | None:
Example customtexts.yml:
```yaml
custom texts:
Custom admission course agreement: Ich erkläre mich bereit, den
Zulassungskurs des Obergerichts des Kantons Zürich zu absolvieren
(Kostenbeteiligung Dolmetscher:in CHF 300).
(en) Custom admission course agreement: I agree to attend the ..
(de) Custom admission course agreement: Ich erkläre mich bereit, ..
```
"""
Expand Down
9 changes: 8 additions & 1 deletion src/onegov/town6/locale/de_CH/LC_MESSAGES/onegov.town6.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: OneGov Cloud 1.0\n"
"POT-Creation-Date: 2024-07-09 08:40+0200\n"
"POT-Creation-Date: 2024-09-10 07:32+0200\n"
"PO-Revision-Date: 2021-03-03 16:24+0100\n"
"Last-Translator: Lukas Burkhard <lukas.burkhard@seantis.ch>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -2193,6 +2193,13 @@ msgstr ""
msgid "New Note"
msgstr "Neue Notiz"

msgid "Error: No custom texts found"
msgstr "Fehler: Keine benutzerdefinierten Texte gefunden"

#, python-format
msgid "Error: No custom text found for '${key}'"
msgstr "Fehler: Kein benutzerdefinierter Text gefunden für '${key}'"

#~ msgid "Subscribe to Selection as RSS"
#~ msgstr "Hashtags abonnieren"

Expand Down
9 changes: 8 additions & 1 deletion src/onegov/town6/locale/fr_CH/LC_MESSAGES/onegov.town6.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: OneGov Cloud 1.0\n"
"POT-Creation-Date: 2024-07-09 08:40+0200\n"
"POT-Creation-Date: 2024-09-10 07:32+0200\n"
"PO-Revision-Date: 2021-03-03 14:04+0100\n"
"Last-Translator: Lukas Burkhard <lukas.burkhard@seantis.ch>\n"
"Language-Team: French\n"
Expand Down Expand Up @@ -2198,6 +2198,13 @@ msgstr ""
msgid "New Note"
msgstr "Nouveau commentaire"

msgid "Error: No custom texts found"
msgstr "Erreur: Aucun texte personnalisé n'a été trouvé"

#, python-format
msgid "Error: No custom text found for '${key}'"
msgstr "Erreur : Aucun texte personnalisé n'a été trouvé pour '${key}'"

#~ msgid "Subscribe to Selection as RSS"
#~ msgstr "S'abonner aux hashtags"

Expand Down
7 changes: 7 additions & 0 deletions src/onegov/town6/locale/it_CH/LC_MESSAGES/onegov.town6.po
Original file line number Diff line number Diff line change
Expand Up @@ -2187,6 +2187,13 @@ msgstr ""
msgid "New Note"
msgstr "Nuova nota"

msgid "Error: No custom texts found"
msgstr "Errore: Nessun testo personalizzato trovato"

#, python-format
msgid "Error: No custom text found for '${key}'"
msgstr "Errore: Nessun testo personalizzato trovato per '${key}'"

#~ msgid "Subscribe to Selection as RSS"
#~ msgstr "Iscriversi agli hashtag"

Expand Down
5 changes: 3 additions & 2 deletions src/onegov/translator_directory/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from onegov.gis import Coordinates
from onegov.gis.utils import MapboxRequests, outside_bbox
from onegov.translator_directory import log
from onegov.translator_directory import _


from typing import TYPE_CHECKING
Expand Down Expand Up @@ -252,7 +253,7 @@ def get_custom_text(request: 'OrgRequest', key: str) -> str:
custom_texts = request.app.custom_texts

if not custom_texts:
return 'No custom texts found'
return _('Error: No custom texts found')

return custom_texts.get(

Check warning on line 258 in src/onegov/translator_directory/utils.py

View check run for this annotation

Codecov / codecov/patch

src/onegov/translator_directory/utils.py#L258

Added line #L258 was not covered by tests
key, f'No custom text found for \'{key}\'')
key, _(f'Error: No custom text found for \'{key}\''))
1 change: 0 additions & 1 deletion tests/onegov/town6/test_views_newsletter.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,6 @@ def test_newsletter_schedule(client):
send.form.submit().follow()


# tschupre
def test_newsletter_test_delivery(client):
client.login_editor()

Expand Down
30 changes: 30 additions & 0 deletions town6-pages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
https://ebikon.ch
https://hoechweid.ch
https://schuldienste-rontal.ch
https://bibliothek-ebikon.ch
https://gesellschaft.ebikon.ch
https://jufa.ebikon.ch
https://schule-ebikon.ch
https://ersigen.onegovcloud.ch
https://gersau.ch
https://feuerwehr-horw.onegovcloud.ch
https://musikschule-horw.ch
https://schulen-horw.onegovcloud.ch

https://kdsb.ch

https://meggen.ch
https://badi.meggen.ch
https://benzeholz.ch
https://gewerbe-meggen.ch
https://tourismus-meggen.ch
https://musikschule-meggen.ch
https://meggenhorn.ch
https://ottenbach.ch
https://reservation.neuenkirch.ch
https://programmnachhaltigkeitstage.bern.ch
https://lauerz.ch
https://duerrenaesch.onegovcloud.ch
https://besenbueren.ch
https://pvkbern.onegovcloud.ch
https://wvgm.onegovcloud.ch

0 comments on commit 640c7d3

Please sign in to comment.