in my templates and python code I have string in my native language
(italian),
so my po files look likes this:
1) locale en
msgid "original string in italian"
msgstr "english translated string"
2) locale it
msgid "original string in italian"
msgstr ""
now in settings I have:
LANGUAGE_CODE = 'en'
my browser is in italian so request.LANGUAGE_CODE is "it"
in django <1.8 the fallback translation is taken from the it po file, in
django 1.8+ en translation is used since my default LANGUAGE_CODE is "en",
if I set LANGUAGE_CODE to "it" the fallback string from it po file is
used
--
Ticket URL: <https://code.djangoproject.com/ticket/24739>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* severity: Normal => Release blocker
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
Reproduced and bisected to a5f6cbce07b5f3ab48d931e3fd1883c757fb9b45.
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:1>
Comment (by claudep):
Apart from the unexpected change, isn't the new behavior the most correct?
Maybe you might check that master keeps this behavior, as
[3cf1c02695481900] touched this part of the code. But at first sight, it
shouldn't affect the use case you described.
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:2>
Comment (by drakkan):
New behaviour:
- if a string is not translated for a locale django use the translated
string (if any) from the default locale
Old behaviour:
- if a string is not translated for a locale django use the untranslated
string for the some locale
what is most correct is an opinion, I like the old behaviour since all
untraslated string should be the same,
your opinion could be that an untranslated string should show the value
for the default locale and not the untranslated one
however is easy enouth to use a tool like poedit to copy all the
translations from the original string, so if you like more the new
behaviour is just a matter to document it
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:3>
Comment (by timgraham):
Claude, could you propose a patch (docs or otherwise) at your convenience?
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:4>
Comment (by claudep):
#24503 was partially related.
What about:
{{{
#!diff
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index fb0438a..c5f3e72 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -1159,6 +1159,10 @@ Miscellaneous
* :func:`django.utils.translation.get_language()` now returns ``None``
instead
of :setting:`LANGUAGE_CODE` when translations are temporarily
deactivated.
+* When a translation doesn't exist for a specific literal, the fallback
is now
+ taken from the :setting:`LANGUAGE_CODE` language (instead of the
untranslated
+ ``msgid`` message).
+
* The ``name`` field of
:class:`django.contrib.contenttypes.models.ContentType`
has been removed by a migration and replaced by a property. That means
it's
not possible to query or filter a ``ContentType`` by this field any
longer.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:5>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
Comment:
I'd suggest "instead of from the" -- otherwise, good!
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:6>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"1046c8afecf719eee5a2aaa28b001e731f94100b" 1046c8af]:
{{{
#!CommitTicketReference repository=""
revision="1046c8afecf719eee5a2aaa28b001e731f94100b"
Fixed #24739 -- Documented translation fallback change
Refs #24503.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:7>
Comment (by Claude Paroz <claude@…>):
In [changeset:"7915cbb360afd363bf94b31aa42b32387c302dea" 7915cbb]:
{{{
#!CommitTicketReference repository=""
revision="7915cbb360afd363bf94b31aa42b32387c302dea"
[1.8.x] Fixed #24739 -- Documented translation fallback change
Refs #24503.
Backport of 1046c8afec from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24739#comment:8>