Author: leidel
Date: Mon Dec  8 10:09:51 2008
New Revision: 271

Added:
    trunk/pages/locale/de/LC_MESSAGES/djangojs.mo   (contents, props changed)
    trunk/pages/locale/de/LC_MESSAGES/djangojs.po
Modified:
    trunk/example/urls.py
    trunk/pages/admin/__init__.py
    trunk/pages/admin/forms.py
    trunk/pages/locale/de/LC_MESSAGES/django.mo
    trunk/pages/locale/de/LC_MESSAGES/django.po
    trunk/pages/media/pages/javascript/change_form.js
    trunk/pages/templates/admin/pages/page/change_form.html

Log:
Fixed i18n for some labels and added JavaScript i18n to PageAdmin.

Modified: trunk/example/urls.py
==============================================================================
--- trunk/example/urls.py       (original)
+++ trunk/example/urls.py       Mon Dec  8 10:09:51 2008
@@ -5,7 +5,7 @@
  admin.autodiscover()

  urlpatterns = patterns('',
-    url(r'^pages/', include('pages.urls')),
+    (r'^pages/', include('pages.urls')),
      (r'^admin/(.*)', admin.site.root),
  )


Modified: trunk/pages/admin/__init__.py
==============================================================================
--- trunk/pages/admin/__init__.py       (original)
+++ trunk/pages/admin/__init__.py       Mon Dec  8 10:09:51 2008
@@ -5,10 +5,9 @@
  from django.contrib import admin
  from django.utils.translation import ugettext as _, ugettext_lazy
  from django.utils.encoding import force_unicode
-
+from django.conf import settings as global_settings
  from django.db import models
  from django.http import HttpResponseRedirect
-from django.contrib.admin.util import unquote

  from pages import settings
  from pages.models import Page, Content, tagging
@@ -73,6 +72,8 @@
          # Delegate to the appropriate method, based on the URL.
          if url is None:
              return self.list_pages(request)
+        elif url == 'jsi18n':
+            return self.i18n_javascript(request)
          elif 'traduction' in url:
              page_id, action, language_id = url.split('/')
              return traduction(request, unquote(page_id),  
unquote(language_id))
@@ -91,6 +92,19 @@
              return change_status(request, unquote(url[:-14]))
          return super(PageAdmin, self).__call__(request, url)

+    def i18n_javascript(self, request):
+        """
+        Displays the i18n JavaScript that the Django admin requires.
+
+        This takes into account the USE_I18N setting. If it's set to  
False, the
+        generated JavaScript will be leaner and faster.
+        """
+        if global_settings.USE_I18N:
+            from django.views.i18n import javascript_catalog
+        else:
+            from django.views.i18n import null_javascript_catalog as  
javascript_catalog
+        return javascript_catalog(request, packages='pages')
+
      def save_model(self, request, obj, form, change):
          """
          Move the page in the tree if neccesary and save every placeholder
@@ -181,7 +195,7 @@
              initial_title = obj.title(language=language, fallback=False)
              form.base_fields['slug'].initial = initial_slug
              form.base_fields['title'].initial = initial_title
-            form.base_fields['slug'].label = _('slug')
+            form.base_fields['slug'].label = _('Slug')

          template = get_template_from_request(request, obj)
          if settings.PAGE_TEMPLATES:

Modified: trunk/pages/admin/forms.py
==============================================================================
--- trunk/pages/admin/forms.py  (original)
+++ trunk/pages/admin/forms.py  Mon Dec  8 10:09:51 2008
@@ -7,23 +7,23 @@

  class PageForm(forms.ModelForm):
      title = forms.CharField(
-        label=_('title'),
+        label=_('Title'),
          widget=forms.TextInput(),
          help_text=_('The default title')
      )
      slug = forms.CharField(
-        label=_('slug'),
+        label=_('Slug'),
          widget=forms.TextInput(),
          help_text=_('The part of the title that is used in permalinks')
      )
      language = forms.ChoiceField(
-        label=_('language'),
+        label=_('Language'),
          choices=settings.PAGE_LANGUAGES,
          help_text=_('The current language of the content fields.'),
      )
      template = forms.ChoiceField(
          required=False,
-        label=_('template'),
+        label=_('Template'),
          choices=settings.PAGE_TEMPLATES,
          help_text=_('The template used to render the content.')
      )

Modified: trunk/pages/locale/de/LC_MESSAGES/django.mo
==============================================================================
Binary files. No diff available.

Modified: trunk/pages/locale/de/LC_MESSAGES/django.po
==============================================================================
--- trunk/pages/locale/de/LC_MESSAGES/django.po (original)
+++ trunk/pages/locale/de/LC_MESSAGES/django.po Mon Dec  8 10:09:51 2008
@@ -1,9 +1,9 @@
  #, fuzzy
  msgid ""
  msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: django-page-cms 0.2.pre\n"
  "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-12-08 11:41+0100\n"
+"POT-Creation-Date: 2008-12-08 17:34+0100\n"
  "PO-Revision-Date: 2008-12-07 16:24+0100\n"
  "Last-Translator: Jannis Leidel <[EMAIL PROTECTED]>\n"
  "Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
@@ -27,7 +27,7 @@
  msgid "parent"
  msgstr "Eltern"

-#: models.py:40 models.py:208
+#: models.py:40 models.py:209
  msgid "creation date"
  msgstr "Erstellungsdatum"

@@ -56,8 +56,7 @@
  msgid "status"
  msgstr "Status"

-#: models.py:45 admin/forms.py:26
-#: templates/admin/pages/page/change_list_table.html:9
+#: models.py:45 templates/admin/pages/page/change_list_table.html:9
  msgid "template"
  msgstr "Template"

@@ -69,7 +68,7 @@
  msgid "sites"
  msgstr "Webseiten"

-#: models.py:55 models.py:188 models.py:206 admin/__init__.py:268
+#: models.py:55 models.py:189 models.py:207 admin/__init__.py:268
  msgid "page"
  msgstr "Seite"

@@ -77,47 +76,47 @@
  msgid "pages"
  msgstr "Seiten"

-#: models.py:184
+#: models.py:185
  msgid "All"
  msgstr "Alle"

-#: models.py:185
+#: models.py:186
  msgid "This page only"
  msgstr "Nur diese Seite"

-#: models.py:186
+#: models.py:187
  msgid "This page and all childrens"
  msgstr "Diese Seite und all ihre Abkömmlinge"

-#: models.py:189
+#: models.py:190
  msgid "user"
  msgstr "Benutzer"

-#: models.py:190 models.py:205
+#: models.py:191 models.py:206
  msgid "type"
  msgstr "Typ"

-#: models.py:195
+#: models.py:196
  msgid "page permission"
  msgstr "Berechtigung"

-#: models.py:196
+#: models.py:197
  msgid "page permissions"
  msgstr "Berechtigungen"

-#: models.py:203 admin/forms.py:20
+#: models.py:204
  msgid "language"
  msgstr "Sprache"

-#: models.py:204
+#: models.py:205
  msgid "body"
  msgstr "Hauptteil"

-#: models.py:212 admin/__init__.py:146 admin/__init__.py:147
+#: models.py:213 admin/__init__.py:146 admin/__init__.py:147
  msgid "content"
  msgstr "Inhalt"

-#: models.py:213
+#: models.py:214
  msgid "contents"
  msgstr "Inhalte"

@@ -134,7 +133,7 @@
  msgstr "Achtung: Diese Seite wird neu geladen, sobald Sie die Auswahl  
ändern"

  #: admin/__init__.py:184 admin/forms.py:15
-msgid "slug"
+msgid "Slug"
  msgstr "Kürzel"

  #: admin/__init__.py:189
@@ -149,8 +148,8 @@
  msgid "Page could not been moved."
  msgstr "Seite konnte nicht verschoben werden."

-#: admin/forms.py:10 templates/admin/pages/page/change_list_table.html:5
-msgid "title"
+#: admin/forms.py:10
+msgid "Title"
  msgstr "Titel"

  #: admin/forms.py:12
@@ -161,10 +160,18 @@
  msgid "The part of the title that is used in permalinks"
  msgstr "Teil des Titels, der in Permalinks benutzt wird"

+#: admin/forms.py:20
+msgid "Language"
+msgstr "Sprache"
+
  #: admin/forms.py:22
  msgid "The current language of the content fields."
  msgstr "Gegenwärtige Sprache der Inhaltsfelder."

+#: admin/forms.py:26
+msgid "Template"
+msgstr "Template"
+
  #: admin/forms.py:28
  msgid "The template used to render the content."
  msgstr "Template das zum Rendern des Inhalts verwendet wird."
@@ -201,6 +208,10 @@
  #, python-format
  msgid "Add %(name)s"
  msgstr "%(name)s hinzufügen"
+
+#: templates/admin/pages/page/change_list_table.html:5
+msgid "title"
+msgstr "Titel"

  #: templates/admin/pages/page/change_list_table.html:6
  msgid "quick actions"

Added: trunk/pages/locale/de/LC_MESSAGES/djangojs.mo
==============================================================================
Binary file. No diff available.

Added: trunk/pages/locale/de/LC_MESSAGES/djangojs.po
==============================================================================
--- (empty file)
+++ trunk/pages/locale/de/LC_MESSAGES/djangojs.po       Mon Dec  8 10:09:51 2008
@@ -0,0 +1,18 @@
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: django-page-cms 0.2.pre\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-12-08 18:56+0100\n"
+"PO-Revision-Date: 2008-12-08 18:58+0100\n"
+"Last-Translator: Jannis Leidel <[EMAIL PROTECTED]>\n"
+"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: media/pages/javascript/change_form.js:10
+msgid ""
+"Are you sure you want to change the %(field_name)s without saving the  
page "
+"first?"
+msgstr "%(field_name)s ändern, ohne die Seite vorher zu speichern?"

Modified: trunk/pages/media/pages/javascript/change_form.js
==============================================================================
--- trunk/pages/media/pages/javascript/change_form.js   (original)
+++ trunk/pages/media/pages/javascript/change_form.js   Mon Dec  8 10:09:51  
2008
@@ -1,18 +1,20 @@
  $(document).ready(function() {
      // Confirm language and template change if page is not saved
-    var selects = ["language", "template"];
-    var original_values = Array()
-    $.each(selects, function(i, name){
-        original_values[i] = $('#id_'+name)[0].selectedIndex;
-        $('#id_'+name).change(function() {
-            if (this.selectedIndex != original_values[i]) {
+    $.each(["language", "template"], function(i, label){
+        var select = $('#id_'+label);
+        var index = select[0].selectedIndex;
+        select.change(function() {
+            if (this.selectedIndex != index) {
                  var array = window.location.href.split('?');
-                var query = $.query.set(name,  
this.options[this.selectedIndex].value).toString();
-                var answer = confirm(gettext("Are you sure you want to  
change the "+name+" without saving the page first?"));
+                var query = $.query.set(label,  
this.options[this.selectedIndex].value).toString();
+                var question = gettext("Are you sure you want to change  
the %(field_name)s without saving the page first?")
+                var answer = confirm(interpolate(question, {
+                    field_name: select.prev().text().slice(0,-1),
+                }, true));
                  if (answer) {
                      window.location.href = array[0]+query;
                  } else {
-                    this.selectedIndex = original_values[i];
+                    this.selectedIndex = index;
                  }
              }
          });

Modified: trunk/pages/templates/admin/pages/page/change_form.html
==============================================================================
--- trunk/pages/templates/admin/pages/page/change_form.html     (original)
+++ trunk/pages/templates/admin/pages/page/change_form.html     Mon Dec  8  
10:09:51 2008
@@ -4,6 +4,7 @@

  {% block extrahead %}{{ block.super }}
  <script type="text/javascript" src="{%  
admin_media_prefix %}js/urlify.js"></script>
+<script type="text/javascript" src="../jsi18n/"></script>
  {% endblock %}

  {% block content %}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to