From e6fc1b86fcdb4f99c00d4218fcaa5eab6f64c4cb Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 5 Feb 2014 11:59:50 +0100 Subject: [PATCH 1/1] Translatable chunks. --- .../catalogue/locale/pl/LC_MESSAGES/django.mo | Bin 12297 -> 11366 bytes .../catalogue/locale/pl/LC_MESSAGES/django.po | 178 +++++++++--------- .../templates/catalogue/audiobook_list.html | 5 +- .../templates/catalogue/book_list.html | 7 +- .../templates/catalogue/daisy_list.html | 5 +- apps/chunks/migrations/0001_initial.py | 49 +++++ ...e__add_field_chunk_content_en__add_fiel.py | 109 +++++++++++ apps/chunks/migrations/__init__.py | 0 apps/chunks/models.py | 9 +- apps/chunks/templatetags/chunks.py | 55 ++---- .../templates/picture/picture_list_thumb.html | 4 +- .../templates/superbase.html | 20 +- wolnelektury/translation.py | 6 +- 13 files changed, 287 insertions(+), 160 deletions(-) create mode 100644 apps/chunks/migrations/0001_initial.py create mode 100644 apps/chunks/migrations/0002_auto__add_field_chunk_content_de__add_field_chunk_content_en__add_fiel.py create mode 100644 apps/chunks/migrations/__init__.py diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo index d3585a52ad4ab0bc4850ae656f6f4bf7ac82fe9d..66ae6880c7f5d73e18c3e40e2f5e2744dcd8f264 100644 GIT binary patch delta 3721 zcmY+`3ry8j0LSrz7f?hH6%bJ5qC8YUK|zH~Q}GSvGq5BSQBV;S(DHf1M@Hs5O7KBx zxaD-K-Pu;Owj4|?S4|taN^NRpS+X{pR_pQo-Fs+uwjZDKf1T(5f3?5by74Tk;q%rnup7r$kdd12u?OD6P}BjFGGW*Y<51^Ep(c`Rua}^n zUyEVrLQSj=1L@y1Q&9uw?1gVoOX<_oJCkn6DHD$x=t$I3K5nmPqh?fqn&C>+7Og`~ zU@K~3dr{9HL_L2LU2LmqqS6oDs2eY#FMf@B;5vF%0JW6&P&4so)Ou(7qMpk{H9QWr zRZ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y9t=2f zCmalPI3YI@?~BHKgFBqIK)icsn=i(7C#W;W-4yYKgVZq8U!AkChX&hRHxzWjzD<$7 z`d(kh;D8ekbBp5(#Z*z1(>ru1@@mpg<#c3;FWeLJIW4h3n0^MGMqk)z4n*UDP<65> zuO}m`JJ?Rw1IaDC!lLrxT0x_`~kdq4prt*BdA#u6^khx(-n87>={2*a*UWQjX3ejgz4w\n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -98,7 +98,7 @@ msgstr "Błąd podczas importowania pliku: %r" msgid "Download custom PDF" msgstr "Stwórz własny PDF" -#: views.py:633 templates/catalogue/book_short.html:103 +#: views.py:633 templates/catalogue/book_short.html:97 #: templates/catalogue/book_wide.html:63 msgid "Download" msgstr "Pobierz" @@ -125,7 +125,7 @@ msgstr "slug" msgid "language code" msgstr "Kod języka" -#: models/book.py:36 models/book.py:161 models/collection.py:13 +#: models/book.py:36 models/book.py:164 models/collection.py:13 #: models/tag.py:37 models/tag.py:94 msgid "description" msgstr "opis" @@ -147,25 +147,29 @@ msgstr "dodatkowe informacje" msgid "cover" msgstr "okładka" -#: models/book.py:67 models/collection.py:18 models/tag.py:22 +#: models/book.py:48 +msgid "cover thumbnail" +msgstr "podgląd okładki" + +#: models/book.py:70 models/collection.py:18 models/tag.py:22 msgid "book" msgstr "książka" -#: models/book.py:68 +#: models/book.py:71 msgid "books" msgstr "książki" -#: models/book.py:259 +#: models/book.py:262 #, python-format msgid "Book \"%s\" does not exist." msgstr "Utwór \"%s\" nie istnieje." -#: models/book.py:273 +#: models/book.py:276 #, python-format msgid "Book %s already exists" msgstr "Książka %s już istnieje" -#: models/book.py:620 models/bookmedia.py:23 +#: models/book.py:625 models/bookmedia.py:23 #, python-format msgid "%s file" msgstr "plik %s" @@ -262,30 +266,25 @@ msgstr "" "Tagi typu książka nie mogą mieć ustawionych linków. Ustaw je bezpośrednio " "dla książki, zamiast dla jej tagu." -#: templates/catalogue/audiobook_list.html:7 -#: templates/catalogue/audiobook_list.html:16 +#: templates/catalogue/audiobook_list.html:8 +#: templates/catalogue/audiobook_list.html:17 msgid "Listing of all audiobooks" msgstr "Spis wszystkich audiobooków" -#: templates/catalogue/audiobook_list.html:12 +#: templates/catalogue/audiobook_list.html:13 msgid "Latest MP3 audiobooks" msgstr "Ostatnio dodane audiobooki w formacie MP3" -#: templates/catalogue/audiobook_list.html:13 +#: templates/catalogue/audiobook_list.html:14 msgid "Latest Ogg Vorbis audiobooks" msgstr "Ostatnio dodane audiobooki w formacie Ogg Vorbis" -#: templates/catalogue/audiobook_list.html:19 -msgid "" -"Audioteka lektur szkolnych fundacji Nowoczesna Polska.\n" -"Możecie z niej korzystać bezpłatnie i bez ograniczeń.\n" -"Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek." -msgstr "" -"Audioteka lektur szkolnych fundacji Nowoczesna Polska.\n" -"Możecie z niej korzystać bezpłatnie i bez ograniczeń.\n" -"Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek." - #: templates/catalogue/book_detail.html:21 +#: templates/catalogue/book_text.html:20 +msgid "Other versions" +msgstr "Inne wersje" + +#: templates/catalogue/book_detail.html:29 #: templates/catalogue/tagged_object_list.html:74 #: templates/catalogue/tagged_object_list.html:109 msgid "See also" @@ -340,126 +339,115 @@ msgstr "Publikację ufundowali i ufundowały:" msgid "Cover image by:" msgstr "Ilustracja na okładce:" -#: templates/catalogue/book_list.html:7 templates/catalogue/book_list.html:10 +#: templates/catalogue/book_list.html:8 templates/catalogue/book_list.html:11 +#: templates/catalogue/picture_list.html:8 +#: templates/catalogue/picture_list.html:10 msgid "Listing of all works" msgstr "Spis wszystkich utworów" -#: templates/catalogue/book_list.html:21 +#: templates/catalogue/book_list.html:24 msgid "Table of Content" msgstr "Spis treści" -#: templates/catalogue/book_list.html:31 +#: templates/catalogue/book_list.html:34 msgid "↑ top ↑" msgstr "↑ góra ↑" -#: templates/catalogue/book_short.html:61 +#: templates/catalogue/book_short.html:55 #: templates/catalogue/picture_detail.html:54 msgid "Epoch" msgstr "Epoka" -#: templates/catalogue/book_short.html:69 +#: templates/catalogue/book_short.html:63 #: templates/catalogue/picture_detail.html:60 msgid "Kind" msgstr "Rodzaj" -#: templates/catalogue/book_short.html:77 +#: templates/catalogue/book_short.html:71 msgid "Genre" msgstr "Gatunek" -#: templates/catalogue/book_short.html:86 +#: templates/catalogue/book_short.html:80 msgid "Language" msgstr "Język" -#: templates/catalogue/book_short.html:99 +#: templates/catalogue/book_short.html:93 msgid "Read online" msgstr "Czytaj online" -#: templates/catalogue/book_short.html:106 +#: templates/catalogue/book_short.html:100 msgid "to print" msgstr "do druku" -#: templates/catalogue/book_short.html:109 +#: templates/catalogue/book_short.html:103 msgid "for an e-book reader" msgstr "na czytnik e-booków" -#: templates/catalogue/book_short.html:112 +#: templates/catalogue/book_short.html:106 msgid "for Kindle" msgstr "na Kindle" -#: templates/catalogue/book_short.html:115 +#: templates/catalogue/book_short.html:109 msgid "FictionBook" msgstr "FictionBook" -#: templates/catalogue/book_short.html:118 +#: templates/catalogue/book_short.html:112 msgid "for advanced usage" msgstr "do zadań specjalnych" -#: templates/catalogue/book_short.html:124 +#: templates/catalogue/book_short.html:118 msgid "Listen" msgstr "Słuchaj" -#: templates/catalogue/book_text.html:10 templates/catalogue/player.html:11 -msgid "Wolne Lektury" -msgstr "Wolne Lektury" - -#: templates/catalogue/book_text.html:34 -msgid "Other versions" -msgstr "Inne wersje" - -#: templates/catalogue/book_text.html:40 +#: templates/catalogue/book_text.html:26 msgid "Table of contents" msgstr "Spis treści" -#: templates/catalogue/book_text.html:44 templatetags/catalogue_tags.py:424 +#: templates/catalogue/book_text.html:30 templatetags/catalogue_tags.py:421 msgid "Themes" msgstr "Motywy" -#: templates/catalogue/book_text.html:48 -#: templates/catalogue/book_text.html:100 +#: templates/catalogue/book_text.html:34 templates/catalogue/book_text.html:91 msgid "Settings" msgstr "Ustawienia" -#: templates/catalogue/book_text.html:52 +#: templates/catalogue/book_text.html:38 msgid "Edit. note" msgstr "Nota red." -#: templates/catalogue/book_text.html:56 +#: templates/catalogue/book_text.html:42 msgid "Infobox" msgstr "Informacje" -#: templates/catalogue/book_text.html:68 -#: templates/catalogue/book_text.html:114 +#: templates/catalogue/book_text.html:56 +#: templates/catalogue/viewer_base.html:53 msgid "Close" msgstr "Zamknij" -#: templates/catalogue/book_text.html:69 +#: templates/catalogue/book_text.html:57 msgid "Please wait..." msgstr "Proszę czekać…" -#: templates/catalogue/book_text.html:82 +#: templates/catalogue/book_text.html:73 msgid "Other versions of the book" msgstr "Inne wersje utworu" -#: templates/catalogue/book_text.html:83 +#: templates/catalogue/book_text.html:74 msgid "Close the other version" msgstr "Zamknij drugą wersję" -#: templates/catalogue/book_text.html:101 +#: templates/catalogue/book_text.html:92 msgid "Display line numbers" msgstr "Wyświetlaj numerację" -#: templates/catalogue/book_text.html:102 +#: templates/catalogue/book_text.html:93 msgid "Display themes" msgstr "Wyświetlaj motywy" -#: templates/catalogue/book_text.html:103 +#: templates/catalogue/book_text.html:94 msgid "Display footnotes" msgstr "Wyświetlaj przypisy" -#: templates/catalogue/book_text.html:116 -msgid "Loading" -msgstr "Ładowanie" - #: templates/catalogue/book_wide.html:22 #: templates/catalogue/tagged_object_list.html:60 msgid "Motifs and themes" @@ -517,28 +505,28 @@ msgstr "Pobierz katalog w formacie PDF." #: templates/catalogue/catalogue.html:19 #: templates/catalogue/search_multiple_hits.html:17 #: templates/catalogue/tagged_object_list.html:26 -#: templatetags/catalogue_tags.py:420 +#: templatetags/catalogue_tags.py:417 msgid "Authors" msgstr "Autorzy" #: templates/catalogue/catalogue.html:22 #: templates/catalogue/search_multiple_hits.html:25 #: templates/catalogue/tagged_object_list.html:34 -#: templatetags/catalogue_tags.py:422 +#: templatetags/catalogue_tags.py:419 msgid "Kinds" msgstr "Rodzaje" #: templates/catalogue/catalogue.html:25 #: templates/catalogue/search_multiple_hits.html:33 #: templates/catalogue/tagged_object_list.html:42 -#: templatetags/catalogue_tags.py:421 +#: templatetags/catalogue_tags.py:418 msgid "Genres" msgstr "Gatunki" #: templates/catalogue/catalogue.html:28 #: templates/catalogue/search_multiple_hits.html:41 #: templates/catalogue/tagged_object_list.html:50 -#: templatetags/catalogue_tags.py:423 +#: templatetags/catalogue_tags.py:420 msgid "Epochs" msgstr "Epoki" @@ -550,27 +538,15 @@ msgstr "Motywy i tematy" msgid "Collections" msgstr "Kolekcje" -#: templates/catalogue/daisy_list.html:6 -#: templates/catalogue/daisy_list.html:12 +#: templates/catalogue/daisy_list.html:7 +#: templates/catalogue/daisy_list.html:13 msgid "Listing of all DAISY files" msgstr "Spis wszystkich plików DAISY" -#: templates/catalogue/daisy_list.html:9 +#: templates/catalogue/daisy_list.html:10 msgid "Latest DAISY audiobooks" msgstr "Ostatnio dodane audiobooki w formacie DAISY" -#: templates/catalogue/daisy_list.html:15 -msgid "" -"System DAISY to uznany na całym świecie format udostępniania książek\n" -"dostosowany do potrzeb osób słabowidzących, niewidomych oraz innych osób\n" -"mających trudności z czytaniem. Możecie z nich korzystać bezpłatnie i bez " -"ograniczeń." -msgstr "" -"System DAISY to uznany na całym świecie format udostępniania książek\n" -"dostosowany do potrzeb osób słabowidzących, niewidomych oraz innych osób\n" -"mających trudności z czytaniem. Możecie z nich korzystać bezpłatnie i bez " -"ograniczeń." - #: templates/catalogue/differentiate_tags.html:12 msgid "The criteria are ambiguous. Please select one of the following options:" msgstr "" @@ -610,7 +586,7 @@ msgstr "Audiobooki" msgid "DAISY" msgstr "DAISY" -#: templates/catalogue/menu.html:40 templates/catalogue/tag_list_split.html:14 +#: templates/catalogue/menu.html:40 templates/catalogue/tag_list_split.html:8 msgid "Gallery" msgstr "Galeria" @@ -650,10 +626,9 @@ msgstr "Źródłowy plik XML" msgid "Work's themes " msgstr "Motywy w utworze" -#: templates/catalogue/picture_list.html:8 -#: templates/catalogue/picture_list.html:10 -msgid "Listing of all pictures" -msgstr "Spis wszystkich obrazów" +#: templates/catalogue/player.html:11 templates/catalogue/viewer_base.html:9 +msgid "Wolne Lektury" +msgstr "Wolne Lektury" #: templates/catalogue/player.html:34 msgid "Book's page" @@ -768,7 +743,7 @@ msgstr "" msgid "Sorry! Search query must have at least two characters." msgstr "Przepraszamy! Zapytanie musi zawierać co najmniej dwa znaki." -#: templates/catalogue/tag_list_split.html:5 +#: templates/catalogue/tag_list_split.html:3 msgid "Literature" msgstr "Literatura" @@ -787,6 +762,10 @@ msgstr "w serwisie Lektury.Gazeta.pl" msgid "in Wikipedia" msgstr "w Wikipedii" +#: templates/catalogue/viewer_base.html:55 +msgid "Loading" +msgstr "Ładowanie" + #: templates/catalogue/snippets/custom_pdf_link_li.html:5 msgid "Download a custom PDF" msgstr "Stwórz własny plik PDF" @@ -796,6 +775,29 @@ msgstr "Stwórz własny plik PDF" msgid "Free license" msgstr "Wolna licencja" +#~ msgid "" +#~ "Audioteka lektur szkolnych fundacji Nowoczesna Polska.\n" +#~ "Możecie z niej korzystać bezpłatnie i bez ograniczeń.\n" +#~ "Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek." +#~ msgstr "" +#~ "Audioteka lektur szkolnych fundacji Nowoczesna Polska.\n" +#~ "Możecie z niej korzystać bezpłatnie i bez ograniczeń.\n" +#~ "Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek." + +#~ msgid "" +#~ "System DAISY to uznany na całym świecie format udostępniania książek\n" +#~ "dostosowany do potrzeb osób słabowidzących, niewidomych oraz innych osób\n" +#~ "mających trudności z czytaniem. Możecie z nich korzystać bezpłatnie i bez " +#~ "ograniczeń." +#~ msgstr "" +#~ "System DAISY to uznany na całym świecie format udostępniania książek\n" +#~ "dostosowany do potrzeb osób słabowidzących, niewidomych oraz innych osób\n" +#~ "mających trudności z czytaniem. Możecie z nich korzystać bezpłatnie i bez " +#~ "ograniczeń." + +#~ msgid "Listing of all pictures" +#~ msgstr "Spis wszystkich obrazów" + #~ msgid "for a reader" #~ msgstr "na czytnik" diff --git a/apps/catalogue/templates/catalogue/audiobook_list.html b/apps/catalogue/templates/catalogue/audiobook_list.html index 47c804611..1358025a1 100644 --- a/apps/catalogue/templates/catalogue/audiobook_list.html +++ b/apps/catalogue/templates/catalogue/audiobook_list.html @@ -1,6 +1,7 @@ {% extends "catalogue/book_list.html" %} {% load i18n %} {% load catalogue_tags %} +{% load chunks %} {% block bodyid %}book-a-list{% endblock %} @@ -16,7 +17,5 @@ {% block book_list_header %}{% trans "Listing of all audiobooks" %}{% endblock %} {% block book_list_info %} -

{% blocktrans %}Audioteka lektur szkolnych fundacji Nowoczesna Polska. -Możecie z niej korzystać bezpłatnie i bez ograniczeń. -Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek.{% endblocktrans %}

+{% chunk 'audiobook-list' %} {% endblock %} diff --git a/apps/catalogue/templates/catalogue/book_list.html b/apps/catalogue/templates/catalogue/book_list.html index 00088a58e..260c71fdf 100644 --- a/apps/catalogue/templates/catalogue/book_list.html +++ b/apps/catalogue/templates/catalogue/book_list.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% load i18n %} {% load catalogue_tags %} +{% load chunks %} {% block bodyid %}book-a-list{% endblock %} @@ -9,8 +10,10 @@ {% block body %}

{% block book_list_header %}{% trans "Listing of all works" %}{% endblock %}

-
- {% block book_list_info %}{% endblock %} +
+ {% block book_list_info %} + {% chunk 'book-list' %} + {% endblock %}
diff --git a/apps/catalogue/templates/catalogue/daisy_list.html b/apps/catalogue/templates/catalogue/daisy_list.html index fcc25d519..4f570b2b6 100644 --- a/apps/catalogue/templates/catalogue/daisy_list.html +++ b/apps/catalogue/templates/catalogue/daisy_list.html @@ -1,5 +1,6 @@ {% extends "catalogue/book_list.html" %} {% load i18n %} +{% load chunks %} {% block bodyid %}book-a-list{% endblock %} @@ -12,7 +13,5 @@ {% block book_list_header %}{% trans "Listing of all DAISY files" %}{% endblock %} {% block book_list_info %} -

{% blocktrans %}System DAISY to uznany na całym świecie format udostępniania książek -dostosowany do potrzeb osób słabowidzących, niewidomych oraz innych osób -mających trudności z czytaniem. Możecie z nich korzystać bezpłatnie i bez ograniczeń.{% endblocktrans %}

+{% chunk 'daisy-list' %} {% endblock %} diff --git a/apps/chunks/migrations/0001_initial.py b/apps/chunks/migrations/0001_initial.py new file mode 100644 index 000000000..fa51499ae --- /dev/null +++ b/apps/chunks/migrations/0001_initial.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding model 'Chunk' + db.create_table(u'chunks_chunk', ( + ('key', self.gf('django.db.models.fields.CharField')(max_length=255, primary_key=True)), + ('description', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), + ('content', self.gf('django.db.models.fields.TextField')(blank=True)), + )) + db.send_create_signal(u'chunks', ['Chunk']) + + # Adding model 'Attachment' + db.create_table(u'chunks_attachment', ( + ('key', self.gf('django.db.models.fields.CharField')(max_length=255, primary_key=True)), + ('attachment', self.gf('django.db.models.fields.files.FileField')(max_length=100)), + )) + db.send_create_signal(u'chunks', ['Attachment']) + + + def backwards(self, orm): + # Deleting model 'Chunk' + db.delete_table(u'chunks_chunk') + + # Deleting model 'Attachment' + db.delete_table(u'chunks_attachment') + + + models = { + u'chunks.attachment': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Attachment'}, + 'attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + }, + u'chunks.chunk': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Chunk'}, + 'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + } + } + + complete_apps = ['chunks'] \ No newline at end of file diff --git a/apps/chunks/migrations/0002_auto__add_field_chunk_content_de__add_field_chunk_content_en__add_fiel.py b/apps/chunks/migrations/0002_auto__add_field_chunk_content_de__add_field_chunk_content_en__add_fiel.py new file mode 100644 index 000000000..57c893511 --- /dev/null +++ b/apps/chunks/migrations/0002_auto__add_field_chunk_content_de__add_field_chunk_content_en__add_fiel.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Chunk.content_de' + db.add_column(u'chunks_chunk', 'content_de', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_en' + db.add_column(u'chunks_chunk', 'content_en', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_es' + db.add_column(u'chunks_chunk', 'content_es', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_fr' + db.add_column(u'chunks_chunk', 'content_fr', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_it' + db.add_column(u'chunks_chunk', 'content_it', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_lt' + db.add_column(u'chunks_chunk', 'content_lt', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_pl' + db.add_column(u'chunks_chunk', 'content_pl', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_ru' + db.add_column(u'chunks_chunk', 'content_ru', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + # Adding field 'Chunk.content_uk' + db.add_column(u'chunks_chunk', 'content_uk', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Chunk.content_de' + db.delete_column(u'chunks_chunk', 'content_de') + + # Deleting field 'Chunk.content_en' + db.delete_column(u'chunks_chunk', 'content_en') + + # Deleting field 'Chunk.content_es' + db.delete_column(u'chunks_chunk', 'content_es') + + # Deleting field 'Chunk.content_fr' + db.delete_column(u'chunks_chunk', 'content_fr') + + # Deleting field 'Chunk.content_it' + db.delete_column(u'chunks_chunk', 'content_it') + + # Deleting field 'Chunk.content_lt' + db.delete_column(u'chunks_chunk', 'content_lt') + + # Deleting field 'Chunk.content_pl' + db.delete_column(u'chunks_chunk', 'content_pl') + + # Deleting field 'Chunk.content_ru' + db.delete_column(u'chunks_chunk', 'content_ru') + + # Deleting field 'Chunk.content_uk' + db.delete_column(u'chunks_chunk', 'content_uk') + + + models = { + u'chunks.attachment': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Attachment'}, + 'attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + }, + u'chunks.chunk': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Chunk'}, + 'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'content_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_it': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + } + } + + complete_apps = ['chunks'] \ No newline at end of file diff --git a/apps/chunks/migrations/__init__.py b/apps/chunks/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/apps/chunks/models.py b/apps/chunks/models.py index ef244eb0b..4ab846b3a 100644 --- a/apps/chunks/models.py +++ b/apps/chunks/models.py @@ -1,6 +1,6 @@ from django.core.cache import cache from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _, get_language class Chunk(models.Model): @@ -20,12 +20,13 @@ class Chunk(models.Model): def __unicode__(self): return self.key - def cache_key(self): - return 'chunk_' + self.key + @staticmethod + def cache_key(key): + return 'chunk/%s/%s' % (key, get_language()) def save(self, *args, **kwargs): ret = super(Chunk, self).save(*args, **kwargs) - cache.delete(self.cache_key()) + cache.delete(self.cache_key(self.key)) return ret diff --git a/apps/chunks/templatetags/chunks.py b/apps/chunks/templatetags/chunks.py index 083c48aa5..cc25df728 100644 --- a/apps/chunks/templatetags/chunks.py +++ b/apps/chunks/templatetags/chunks.py @@ -9,45 +9,23 @@ Chunk = models.get_model('chunks', 'chunk') Attachment = models.get_model('chunks', 'attachment') -def do_get_chunk(parser, token): - # split_contents() knows not to split quoted strings. - tokens = token.split_contents() - if len(tokens) < 2 or len(tokens) > 3: - raise template.TemplateSyntaxError, "%r tag should have either 2 or 3 arguments" % (tokens[0],) - if len(tokens) == 2: - tag_name, key = tokens - cache_time = 0 - if len(tokens) == 3: - tag_name, key, cache_time = tokens - # Check to see if the key is properly double/single quoted - if not (key[0] == key[-1] and key[0] in ('"', "'")): - raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name - # Send key without quotes and caching time - return ChunkNode(key[1:-1], cache_time) - - -class ChunkNode(template.Node): - def __init__(self, key, cache_time=0): - self.key = key - self.cache_time = cache_time - - def render(self, context): - try: - cache_key = 'chunk_' + self.key - c = cache.get(cache_key) - if c is None: - c = Chunk.objects.get(key=self.key) - cache.set(cache_key, c, int(self.cache_time)) - content = c.content - except Chunk.DoesNotExist: - n = Chunk(key=self.key) - n.save() - return '' - return content - -register.tag('chunk', do_get_chunk) +@register.simple_tag +def chunk(key, cache_time=0): + try: + cache_key = Chunk.cache_key(key) + c = cache.get(cache_key) + if c is None: + c = Chunk.objects.get(key=key) + cache.set(cache_key, c, int(cache_time)) + content = c.content + except Chunk.DoesNotExist: + n = Chunk(key=key) + n.save() + return '' + return content +@register.simple_tag def attachment(key, cache_time=0): try: cache_key = 'attachment_' + key @@ -58,6 +36,3 @@ def attachment(key, cache_time=0): return c.attachment.url except Attachment.DoesNotExist: return '' - -register.simple_tag(attachment) - diff --git a/apps/picture/templates/picture/picture_list_thumb.html b/apps/picture/templates/picture/picture_list_thumb.html index 031055681..9684f846c 100644 --- a/apps/picture/templates/picture/picture_list_thumb.html +++ b/apps/picture/templates/picture/picture_list_thumb.html @@ -15,8 +15,8 @@
{% block book_list_info %} -

Galeria zawiera obrazy, rysunki, rzeźby, fotografie pochodzące ze zbiorów Muzeum Narodowego w Warszawie. Każde z dzieł oznaczyliśmy motywami i tematami występującymi w sztuce i w literaturze. Galerię można więc przeglądać w poszukiwaniu ilustracji do tekstów literackich, a także pod kątem określonych przedmiotów i postaci występujących w sztukach wizualnych.

-{% endblock %} + {% chunk 'picture-list' %} + {% endblock %}
{% block book_list_logos %} diff --git a/apps/wolnelektury_core/templates/superbase.html b/apps/wolnelektury_core/templates/superbase.html index 9ee206f57..57dbb1ada 100644 --- a/apps/wolnelektury_core/templates/superbase.html +++ b/apps/wolnelektury_core/templates/superbase.html @@ -3,6 +3,7 @@ {% load cache compressed i18n %} {% load static from staticfiles %} {% load catalogue_tags funding_tags reporting_stats sponsor_tags %} + {% load chunks %} @@ -124,24 +125,9 @@ diff --git a/wolnelektury/translation.py b/wolnelektury/translation.py index c72f654af..95b9dd74f 100644 --- a/wolnelektury/translation.py +++ b/wolnelektury/translation.py @@ -6,6 +6,7 @@ from modeltranslation.translator import translator, TranslationOptions from catalogue.models import Collection, Tag from infopages.models import InfoPage +from chunks.models import Chunk class InfoPageTranslationOptions(TranslationOptions): fields = ('title', 'left_column', 'right_column') @@ -16,7 +17,10 @@ class TagTranslationOptions(TranslationOptions): class CollectionTranslationOptions(TranslationOptions): fields = ('title', 'description') +class ChunkTranslationOptions(TranslationOptions): + fields = ('content',) + translator.register(InfoPage, InfoPageTranslationOptions) translator.register(Tag, TagTranslationOptions) translator.register(Collection, CollectionTranslationOptions) - +translator.register(Chunk, ChunkTranslationOptions) -- 2.20.1