diff --git a/crochet/locale/en/LC_MESSAGES/django.po b/crochet/locale/en/LC_MESSAGES/django.po index 60fce59..52b5eb6 100644 --- a/crochet/locale/en/LC_MESSAGES/django.po +++ b/crochet/locale/en/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: crochet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-07-20 09:18+0000\n" +"POT-Creation-Date: 2026-07-20 10:32+0000\n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -47,35 +47,33 @@ msgstr "Create pattern" msgid "¿Seguro que quieres eliminar este patrón? No podrás deshacerlo." msgstr "Are you sure you want to delete this pattern? This cannot be undone." -#: crochet/templates/crochet/account_home.html:34 +#: crochet/templates/crochet/account_home.html:37 msgid "Patrón sin título" msgstr "Untitled pattern" -#: crochet/templates/crochet/account_home.html:37 +#: crochet/templates/crochet/account_home.html:41 #, python-format msgid "Actualizado el %(date)s" msgstr "Updated on %(date)s" -#: crochet/templates/crochet/account_home.html:40 -#: crochet/templates/crochet/pattern.html:33 -msgid "Ver patrón" -msgstr "View pattern" +#: crochet/templates/crochet/account_home.html:44 +#: crochet/templates/crochet/pattern.html:143 +#: crochet/templates/crochet/pattern.html:189 +msgid "Vista previa" +msgstr "Preview" -#: crochet/templates/crochet/account_home.html:41 -msgid "Editar" -msgstr "Edit" - -#: crochet/templates/crochet/account_home.html:45 +#: crochet/templates/crochet/account_home.html:48 +#: crochet/templates/crochet/pattern.html:38 msgid "Eliminar" msgstr "Delete" -#: crochet/templates/crochet/account_home.html:54 +#: crochet/templates/crochet/account_home.html:57 msgid "Todavía no tienes ningún patrón." msgstr "You don't have any patterns yet." #: crochet/templates/crochet/account_settings.html:4 #: crochet/templates/crochet/account_settings.html:18 -#: crochet/templates/crochet/base.html:50 +#: crochet/templates/crochet/base.html:52 msgid "Ajustes de la cuenta" msgstr "Account settings" @@ -84,21 +82,21 @@ msgid "Volver a mis patrones" msgstr "Back to my patterns" #: crochet/templates/crochet/base.html:39 -msgid "Idioma" -msgstr "Language" +msgid "Cambiar idioma" +msgstr "Change language" -#: crochet/templates/crochet/base.html:54 +#: crochet/templates/crochet/base.html:56 msgid "Cerrar sesión" msgstr "Log out" -#: crochet/templates/crochet/base.html:60 +#: crochet/templates/crochet/base.html:62 #: crochet/templates/crochet/home.html:24 #: crochet/templates/registration/login.html:4 #: crochet/templates/registration/login.html:14 msgid "Iniciar sesión" msgstr "Log in" -#: crochet/templates/crochet/base.html:61 +#: crochet/templates/crochet/base.html:63 #: crochet/templates/registration/register.html:29 msgid "Registrarme" msgstr "Sign up" @@ -172,14 +170,14 @@ msgstr "Couldn't save. Please try again." msgid "Guardar" msgstr "Save" +#: crochet/templates/crochet/pattern.html:33 +msgid "Ver patrón" +msgstr "View pattern" + #: crochet/templates/crochet/pattern.html:34 msgid "Exportar a PDF" msgstr "Export to PDF" -#: crochet/templates/crochet/pattern.html:38 -msgid "Eliminar patrón" -msgstr "Delete pattern" - #: crochet/templates/crochet/pattern.html:45 msgid "Guardado" msgstr "Saved" @@ -291,11 +289,6 @@ msgstr "Landscape" msgid "Secciones" msgstr "Sections" -#: crochet/templates/crochet/pattern.html:143 -#: crochet/templates/crochet/pattern.html:189 -msgid "Vista previa" -msgstr "Preview" - #: crochet/templates/crochet/pattern.html:152 msgid "Colapsar todo" msgstr "Collapse all" @@ -491,3 +484,12 @@ msgstr "" #: crochet/views.py:24 msgid "Este patrón todavía no tiene contenido." msgstr "This pattern doesn't have any content yet." + +#~ msgid "Idioma" +#~ msgstr "Language" + +#~ msgid "Editar" +#~ msgstr "Edit" + +#~ msgid "Eliminar patrón" +#~ msgstr "Delete pattern" diff --git a/crochet/locale/es/LC_MESSAGES/django.po b/crochet/locale/es/LC_MESSAGES/django.po index 91a97a8..f183df7 100644 --- a/crochet/locale/es/LC_MESSAGES/django.po +++ b/crochet/locale/es/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: crochet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-07-20 09:18+0000\n" +"POT-Creation-Date: 2026-07-20 10:32+0000\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -47,35 +47,33 @@ msgstr "" msgid "¿Seguro que quieres eliminar este patrón? No podrás deshacerlo." msgstr "" -#: crochet/templates/crochet/account_home.html:34 +#: crochet/templates/crochet/account_home.html:37 msgid "Patrón sin título" msgstr "" -#: crochet/templates/crochet/account_home.html:37 +#: crochet/templates/crochet/account_home.html:41 #, python-format msgid "Actualizado el %(date)s" msgstr "" -#: crochet/templates/crochet/account_home.html:40 -#: crochet/templates/crochet/pattern.html:33 -msgid "Ver patrón" +#: crochet/templates/crochet/account_home.html:44 +#: crochet/templates/crochet/pattern.html:143 +#: crochet/templates/crochet/pattern.html:189 +msgid "Vista previa" msgstr "" -#: crochet/templates/crochet/account_home.html:41 -msgid "Editar" -msgstr "" - -#: crochet/templates/crochet/account_home.html:45 +#: crochet/templates/crochet/account_home.html:48 +#: crochet/templates/crochet/pattern.html:38 msgid "Eliminar" msgstr "" -#: crochet/templates/crochet/account_home.html:54 +#: crochet/templates/crochet/account_home.html:57 msgid "Todavía no tienes ningún patrón." msgstr "" #: crochet/templates/crochet/account_settings.html:4 #: crochet/templates/crochet/account_settings.html:18 -#: crochet/templates/crochet/base.html:50 +#: crochet/templates/crochet/base.html:52 msgid "Ajustes de la cuenta" msgstr "" @@ -84,21 +82,21 @@ msgid "Volver a mis patrones" msgstr "" #: crochet/templates/crochet/base.html:39 -msgid "Idioma" +msgid "Cambiar idioma" msgstr "" -#: crochet/templates/crochet/base.html:54 +#: crochet/templates/crochet/base.html:56 msgid "Cerrar sesión" msgstr "" -#: crochet/templates/crochet/base.html:60 +#: crochet/templates/crochet/base.html:62 #: crochet/templates/crochet/home.html:24 #: crochet/templates/registration/login.html:4 #: crochet/templates/registration/login.html:14 msgid "Iniciar sesión" msgstr "" -#: crochet/templates/crochet/base.html:61 +#: crochet/templates/crochet/base.html:63 #: crochet/templates/registration/register.html:29 msgid "Registrarme" msgstr "" @@ -163,12 +161,12 @@ msgstr "" msgid "Guardar" msgstr "" -#: crochet/templates/crochet/pattern.html:34 -msgid "Exportar a PDF" +#: crochet/templates/crochet/pattern.html:33 +msgid "Ver patrón" msgstr "" -#: crochet/templates/crochet/pattern.html:38 -msgid "Eliminar patrón" +#: crochet/templates/crochet/pattern.html:34 +msgid "Exportar a PDF" msgstr "" #: crochet/templates/crochet/pattern.html:45 @@ -282,11 +280,6 @@ msgstr "" msgid "Secciones" msgstr "" -#: crochet/templates/crochet/pattern.html:143 -#: crochet/templates/crochet/pattern.html:189 -msgid "Vista previa" -msgstr "" - #: crochet/templates/crochet/pattern.html:152 msgid "Colapsar todo" msgstr "" diff --git a/crochet/templates/crochet/account_home.html b/crochet/templates/crochet/account_home.html index 595e3b5..d0e650f 100644 --- a/crochet/templates/crochet/account_home.html +++ b/crochet/templates/crochet/account_home.html @@ -22,23 +22,26 @@
{% for pattern in patterns %}
-
- {% if pattern.cover_image_thumbnail %} - - {% else %} - 🧶 - {% endif %} -
+ +
+ {% if pattern.cover_image_thumbnail %} + + {% else %} + 🧶 + {% endif %} +
+
-

- {% if pattern.page_settings.title %}{{ pattern.page_settings.title }}{% else %}{% trans 'Patrón sin título' %}{% endif %} -

+ +

+ {% if pattern.page_settings.title %}{{ pattern.page_settings.title }}{% else %}{% trans 'Patrón sin título' %}{% endif %} +

+

{% blocktrans with date=pattern.updated_at|date:'d/m/Y' %}Actualizado el {{ date }}{% endblocktrans %}

- {% trans 'Ver patrón' %} - {% trans 'Editar' %} + {% trans 'Vista previa' %}
{% csrf_token %} diff --git a/crochet/templates/crochet/base.html b/crochet/templates/crochet/base.html index 4b9d6aa..1a1b303 100644 --- a/crochet/templates/crochet/base.html +++ b/crochet/templates/crochet/base.html @@ -27,20 +27,22 @@ 🧶 Crochet
- {% get_current_language as CURRENT_LANGUAGE %} {% get_available_languages as AVAILABLE_LANGUAGES %} - + + {% if user.is_authenticated %} diff --git a/crochet/templates/crochet/pattern.html b/crochet/templates/crochet/pattern.html index a685b1d..27e930c 100644 --- a/crochet/templates/crochet/pattern.html +++ b/crochet/templates/crochet/pattern.html @@ -35,7 +35,7 @@ {% csrf_token %} - +
diff --git a/crochet/templatetags/crochet_i18n.py b/crochet/templatetags/crochet_i18n.py index 61d9c05..960dad2 100644 --- a/crochet/templatetags/crochet_i18n.py +++ b/crochet/templatetags/crochet_i18n.py @@ -3,6 +3,12 @@ from django.urls import translate_url as django_translate_url register = template.Library() +# Mismos idiomas que LANGUAGES en config/settings/base.py. +LANGUAGE_FLAGS = { + 'es': '🇪🇸', + 'en': '🇬🇧', +} + @register.simple_tag def translate_url(path, lang_code): @@ -13,3 +19,8 @@ def translate_url(path, lang_code): # prefijo (p.ej. /es/patron//editar/ frente a # /en/pattern//edit/). return django_translate_url(path, lang_code) + + +@register.filter +def language_flag(lang_code): + return LANGUAGE_FLAGS.get(lang_code, '') diff --git a/crochet/tests/test_views.py b/crochet/tests/test_views.py index 98116b2..91cc3c6 100644 --- a/crochet/tests/test_views.py +++ b/crochet/tests/test_views.py @@ -56,7 +56,7 @@ class HomeViewTests(TestCase): class LanguageSwitcherTests(TestCase): def test_home_page_switcher_offers_the_same_page_in_english(self): response = self.client.get('/es/') - self.assertContains(response, '