Commit Graph

122 Commits

Author SHA1 Message Date
Claude Paroz 543df07720 Fixed #24073 -- Returned None for get_language when translations are deactivated
This fixes a regression caused by f7c287fca9. Thanks Markus Holtermann
for identifying the regression.
2015-01-08 17:43:07 +01:00
Aymeric Augustin 7eefdbf7ab Cleaned up the django.template namespace.
Since this package is going to hold both the implementation of the Django
Template Language and the infrastructure for Multiple Template Engines,
it should be untied from the DTL as much as possible within our
backwards-compatibility policy.

Only public APIs (i.e. APIs mentioned in the documentation) were left.
2014-12-28 14:47:31 +01:00
Collin Anderson 5dddd79433 Fixed #20349 -- Moved setting_changed signal to django.core.signals.
This removes the need to load django.test when not testing.
2014-12-24 07:18:43 -05:00
Aymeric Augustin 9d3d1a0321 Simplified caching of supported languages. 2014-11-19 21:35:40 +01:00
Yuri Kriachko 11f307a5a8 Fixed #23196 -- Short-circuited empty string translation
Translating an empty string used to return the gettext catalog
metadata instead of the empty string.
Thanks Ned Batchelder for the suggestion, Tim Graham for the review
and Anton Berezin and Claude Paroz for contributions to the patch.
2014-09-21 17:08:17 +02:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00
Claude Paroz 5dcdbe95c7 Fixed #23005 -- Allowed specifying special fallback languages
This fixes the Chinese language issues described in #23005 but
also provides for other fallback exceptions by updating the
LANG_INFO structure.
Thanks caxekis at gmail.com for the report and Tim Graham for the
review.
2014-07-14 20:50:03 +02:00
Claude Paroz 9618d68b34 Fixed #8033 -- Explained app registry error during translation setup
Thanks Tim Graham and Aymeric Augustin for the review.
2014-06-23 09:31:45 +02:00
Andrew Godwin d359647715 Fixed #21498: Don't use a fallback language if you're en-us. 2014-06-16 20:40:13 -07:00
Claude Paroz daaeb84158 Fixed #22773 -- Forced templatize() to return unicode 2014-06-06 08:42:52 +02:00
Claude Paroz dbb48d2bb9 Applied unicode_literals to makemessages command
This also fixes #22686 as some sort of side-effect.
2014-05-24 11:51:57 +02:00
Claude Paroz 142c27218a Fixed #22565 -- Prevented pgettext_lazy crash with bytestring input
Thanks ygbo for the report.
2014-05-02 19:33:22 +02:00
Tim Graham 45c2d1f5d9 flake8 fixes. 2014-04-30 18:33:46 -04:00
Doug Beck a5f6cbce07 Refactored DjangoTranslation class
Also fixes #18192 and #21055.
2014-04-30 18:36:25 +02:00
Tomasz Wysocki cb9704fc4f Refactor. Stop using memory for list copies. 2014-04-02 17:32:51 +02:00
Aymeric Augustin f356b6ecc3 Increased memoization cache size for language codes.
There may be more than 100 (default maxsize) commonly seen xx-yy values
on some sites. The additional memory consumption isn't significant.

Also added a comment explaining why this cache must have a maxsize.
2014-03-29 19:47:15 +01:00
Tim Graham 6d1ae5e27c Removed reading of old 'django_language' session variable per deprecation timeline.
refs #5789.
2014-03-21 09:53:16 -04:00
Matthew Somerville 61296fb1ba Fixed #22283 -- Updated documentation referring to non-existent tuples. 2014-03-18 10:57:47 +01:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Bouke Haarsma 2bab9d6d9e Fixed #21389 -- Accept most valid language codes
By removing the 'supported' keyword from the detection methods and only relying
on a cached settings.LANGUAGES, the speed of said methods has been improved;
around 4x raw performance. This allows us to stop checking Python's incomplete
list of locales, and rely on a less restrictive regular expression for
accepting certain locales.

HTTP Accept-Language is defined as being case-insensitive, based on this fact
extra performance improvements have been made; it wouldn't make sense to
check for case differences.
2014-02-26 16:58:04 +01:00
Erik Romijn 8cd32f0965 Fixed #22120 -- Documented persistent activation of languages and cleaned up language session key use 2014-02-22 18:29:06 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 65cd74be8e Stopped iterating on INSTALLED_APPS.
Used the app cache's get_app_configs() method instead.
2013-12-22 11:39:18 +01:00
Bouke Haarsma 91c38ce4b2 Fixed 21406 -- Made blocktrans 'trimmed' option preserve line numbers.
Thanks Bouke Haarsma for report, fix and initial patch.
2013-12-04 08:36:20 -03:00
Baptiste Mispelon 8f5a688d00 Fixed #21458 -- Made check_for_language more resistant to malformed input.
Thanks to Sergey Sorokin for the report and to Bouke Haarsma for the review.
2013-11-20 17:51:53 +01:00
Bouke Haarsma 9b7455e918 Fixed #21351 -- Replaced memoize with Python's lru_cache.
Replaced the custom, untested memoize with a similar decorator from Python's
3.2 stdlib. Although some minor performance degradation (see ticket), it is
expected that in the long run lru_cache will outperform memoize once it is
implemented in C.

Thanks to EvilDMP for the report and Baptiste Mispelon for the idea of
replacing memoize with lru_cache.
2013-11-11 08:53:09 +01:00
Bouke Haarsma 7a7c789d5a Fixed #5849 -- Strip whitespace from blocktrans
Add the trimmed option to the blocktrans tag to trim any newlines and
whitespace from its content.

This allows the developer to indent the blocktrans tag without adding
new lines and whitespace to the msgid in the PO file.

Thanks to mpessas for the initial patch and Dmitri Fedortchenko for the
report.
2013-11-08 00:52:17 +02:00
Alex Gaynor e5b7045422 flake8 fixes 2013-11-06 20:00:48 -08:00
Baptiste Mispelon 8265323c91 Distinguish between browser-deprecated locales and internally
deprecated ones.

Thanks to bouke for pointing this out.
2013-11-06 12:27:35 +01:00
Baptiste Mispelon 79716dcca8 Fix python2 breakage caused by e5e044da87. 2013-11-05 19:51:54 +01:00
Bouke Haarsma e5e044da87 Fixed #18419 -- Full backwards compatibility for old language codes
Improved documentation about zh-* deprecation and upgrade path.

Thanks to Baptiste Mispelon for the code reviews.
2013-11-05 19:26:58 +01:00
Baptiste Mispelon bdca494464 Fixed python3 breakage introduced by c0a2388a1c. 2013-11-04 23:57:43 +01:00
Bouke Haarsma c0a2388a1c Fixed #18149 -- Changed language codes for Chinese
Language codes for Chinese are zh_Hans (Simplified) and zh_Hant (Traditional).
Added support for browsers that still send the deprecated language codes.

Thanks to Olli Wang for the report.
2013-11-04 23:03:28 +01:00
Aymeric Augustin cb2c3ce154 Merge pull request #1821 from Bouke/tickets/14170
#14170 -- Reset i18n cache when settings changed
2013-11-04 13:50:21 -08:00
Alex Gaynor c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08:00
Bouke Haarsma d0669843d0 Fixed #14170 -- Reset i18n cache when settings change 2013-11-03 09:36:09 +01:00
Ray Ashman Jr e2ae8b048e Correct flake8 E302 violations 2013-11-02 19:53:29 -04:00
Alex Gaynor b35ff0d920 Fixed all the E203 violations 2013-10-26 18:27:42 -07:00
Alex Gaynor f2d8027c9a Fixed up some more flake8 violations (this particular violation still has many occurrences in the tests/ dir so it can't be removed from setup.cfg yet) 2013-10-26 10:50:40 -07:00
Bouke Haarsma 0d0f4f020a Fixed #5789 -- Changed LocaleMiddleware session variable to '_language'.
The old 'django_language' variable will still be read from in order
to migrate users. The backwards-compatability shim will be removed in
Django 1.8.

Thanks to jdunck for the report and stugots for the initial patch.
2013-10-22 09:24:42 -04:00
Josh Mize a52cc1c088 Fixed #21078 -- Handled additional bad Accept-Language header 2013-09-09 15:19:09 -04:00
Tim Graham 5649c0af9d Fixed "indentation is not a multiple of four" pep8 issues. 2013-09-03 14:22:21 -04:00
Curtis Maloney 07876cf02b Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
2013-08-04 07:09:39 -04:00
Claude Paroz fdd7a355bf Deprecated django.utils.importlib
This was a shim for pre-Python 2.7 support.
2013-07-29 17:10:22 +02:00
Claude Paroz c0439b6210 Removed obsolete attribute of DjangoTranslation 2013-05-25 14:01:52 +02:00
Łukasz Langa 26e3e7ecb5 Fixed #11915: generic Accept-Language matches country-specific variants 2013-05-19 12:50:09 +02:00
Florian Apolloner acd0bb39df Fixed #14894 -- Ensure that activating a translation doesn't run into threading issues.
Thanks to maxbublis for the report and sergeykolosov for the patch.
2013-05-18 17:36:31 +02:00
Łukasz Langa 92ebb29c53 Fixes #19919: get_language_from_request() disregards "en-us" and "en" languages
when matching Accept-Language
2013-05-18 14:37:04 +02:00
Aymeric Augustin 9c487b5974 Replaced an antiquated pattern.
Thanks Lennart Regebro for pointing it out.
2013-05-17 18:08:58 +02:00