#26328: jsi18n - get_javascript_catalog obscure and hardcoded english
-------------------------------------+-------------------------------------
Reporter: cristianocca | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.9
Internationalization |
Severity: Normal | Resolution:
Keywords: jsi18n | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by cristianocca):
I can not seem to run the whole i18n tests completely, for some reason I'm
getting many errors related to the makemessages command and msgmerge (see
example below) with and without my changes. Oddly when using the real
1.9.4 installation I don't get these errors (it still fails with 2 fails
and 2 errors).
I'm running windows 8, python2 and a virtual enviorment with all
requirements.txt installed.
More in depth results of i18n tests:
i18n.tests --> ok
i18n.test_compilation --> 1 error
i18n.test_extraction --> 26 errors
i18n.test_percents --> ok
I can not find any javascript related test in those. I did however find a
very good ticket that explains why the special english treatment for
translations ( https://code.djangoproject.com/ticket/24413 ).
So the change would actually bring back that issue in order to fix the
other one.
The real issue is not english, but is actually what happens when you have
translations with no values where you expect to get the message id back
but the default language is different from the one with no values, which
will happen very often when mixing apps (like the admin app)
Example...
- default language = 'es'
- My project has 'es' and 'en' translation files, but I'm lazy and I don't
add any translation values for the 'es' ones because it matches the ids
and it is the same as my default language. So if I request an 'es'
translation, since requested == default, no fallback is added and I always
get the expected output.
- Add a new app, which is implemented in english so the developers decided
to have all english translation files with no values, and when they tested
it all worked fine because their default language was english as well. Now
when I use this new app in my project, since my default is 'es', all
requests in english will have 'es' as fallback so if any of those 'es'
translations have a value, I will end up with spanish rather than english,
which is not expected. This is where the team "fixed" the issue by
manually checking for english, and so everything worked fine for all
django apps, but the issue won't be fixed for other languages rather than
english and even worse bring up new issues due to english having a special
treatment.
What can we do? I think the only real way to prevent this is to make sure
all translations are always defined rather than relying on message ids and
remove the special english treatment (this ticket is to remove it from
javascript translations, but server side there's check for english).
Any other ideas? Should be there an app specific setting that will tell
the translation machinery which translations files are missing its values
by purpose because message ids are enough? That way we could actually load
values for those files either at compile time or load time. This would
allow us to remove any english special treatment while still having all
languages load fine for those that are lazy and do not define translation
values, but I have no idea how could this be done.
sample error from tests
{{{
ERROR: test_no_wrap_enabled (i18n.test_extraction.NoWrapExtractorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"C:\Users\Cristiano\Desktop\django_git\django\tests\i18n\test_extraction.py",
line 605, in test_no_wrap_enabled
management.call_command('makemessages', locale=[LOCALE], verbosity=0,
no_wrap=True)
File "C:\Users\Cristiano\Desktop\django_git\venv\lib\site-
packages\django\core\management\__init__.py", line 117, in call_command
return command.execute(*args, **defaults)
File "C:\Users\Cristiano\Desktop\django_git\venv\lib\site-
packages\django\core\management\base.py", line 348, in execute
output = self.handle(*args, **options)
File "C:\Users\Cristiano\Desktop\django_git\venv\lib\site-
packages\django\core\management\commands\makemessages.py", line 307, in
handle
self.write_po_file(potfile, locale)
File "C:\Users\Cristiano\Desktop\django_git\venv\lib\site-
packages\django\core\management\commands\makemessages.py", line 541, in
write_po_file
"errors happened while running msgmerge\n%s" % errors)
CommandError: errors happened while running msgmerge
C:\Users\Cristiano\Desktop\django_git\django\tests\i18n\commands\locale\de\LC_ME
SSAGES\django.po:2:47: syntax error
msgmerge: se encontr\xf3 el error fatal 1
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26328#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.640932281c261759df8d1130dd76232e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.