Commit 4a5e8087 authored by Jannis Leidel's avatar Jannis Leidel
Browse files

Fixed #19136 -- Properly escape gettext context prefixes in the i18n JavaScript view template.

parent 44046e8a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -99,16 +99,16 @@ function ngettext(singular, plural, count) {
function gettext_noop(msgid) { return msgid; }

function pgettext(context, msgid) {
  var value = gettext(context + '\x04' + msgid);
  if (value.indexOf('\x04') != -1) {
  var value = gettext(context + '\\x04' + msgid);
  if (value.indexOf('\\x04') != -1) {
    value = msgid;
  }
  return value;
}

function npgettext(context, singular, plural, count) {
  var value = ngettext(context + '\x04' + singular, context + '\x04' + plural, count);
  if (value.indexOf('\x04') != -1) {
  var value = ngettext(context + '\\x04' + singular, context + '\\x04' + plural, count);
  if (value.indexOf('\\x04') != -1) {
    value = ngettext(singular, plural, count);
  }
  return value;
+615 B

File added.

No diff preview for this file type.

+40 −0
Original line number Diff line number Diff line
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: django tests\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-02-14 17:33+0100\n"
"PO-Revision-Date: 2011-01-21 21:37-0300\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Language-Team: de <de@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

#: models.py:7
msgctxt "month name"
msgid "May"
msgstr "Mai"

#: models.py:9
msgctxt "verb"
msgid "May"
msgstr "Kann"

#: models.py:11
msgid "%s item"
msgid_plural "%s items"
msgstr[0] "%s Element"
msgstr[1] "%s Elemente"

#: models.py:11
msgctxt "search"
msgid "%s result"
msgid_plural "%s results"
msgstr[0] "%s Resultat"
msgstr[1] "%s Resultate"
+44 −0
Original line number Diff line number Diff line
<html>
<head>
  <script type="text/javascript" src="/jsi18n_admin/"></script>
</head>

<body>
  <p id="gettext">
    <script type="text/javascript">
    document.write(gettext("Remove"));
    </script>
  </p>

  <p id="ngettext_sing">
    <script type="text/javascript">
    document.write(interpolate(ngettext("%s item", "%s items", 1), [1]));
    </script>
  </p>

  <p id="ngettext_plur">
    <script type="text/javascript">
    document.write(interpolate(ngettext("%s item", "%s items", 455), [455]));
    </script>
  </p>

  <p id="pgettext">
    <script type="text/javascript">
    document.write(pgettext("verb", "May"));
    </script>
  </p>

  <p id="npgettext_sing">
    <script type="text/javascript">
    document.write(interpolate(npgettext("search", "%s result", "%s results", 1), [1]));
    </script>
  </p>

  <p id="npgettext_plur">
    <script type="text/javascript">
    document.write(interpolate(npgettext("search", "%s result", "%s results", 455), [455]));
    </script>
  </p>

</body>
</html>
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ from .debug import (DebugViewTests, ExceptionReporterTests,
    ExceptionReporterTests, PlainTextReportTests, ExceptionReporterFilterTests,
    AjaxResponseExceptionReporterFilter)
from .defaults import DefaultsTests
from .i18n import JsI18NTests, I18NTests, JsI18NTestsMultiPackage
from .i18n import JsI18NTests, I18NTests, JsI18NTestsMultiPackage, JavascriptI18nTests
from .shortcuts import ShortcutTests
from .specials import URLHandling
from .static import StaticHelperTest, StaticUtilsTests, StaticTests
Loading