WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.63k stars 1.02k forks source link

Using self create language in component leads to server error #3157

Closed rhofer closed 5 years ago

rhofer commented 5 years ago

Describe the bug Is there a problem with creating a new language in weblate 3.9.1?

Console output

uwsgi stderr \| ERROR Internal Server Error: /translate/products-template-based/bo-test-template-based/de/
--
  | Traceback (most recent call last):
  | File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 34, in inner
  | response = get_response(request)
  | File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 115, in _get_response
  | response = self.process_exception_by_middleware(e, request)
  | File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 113, in _get_response
  | response = wrapped_callback(request, *callback_args, **callback_kwargs)
  | File "/usr/local/lib/python3.7/dist-packages/weblate/trans/views/edit.py", line 518, in translate
  | 'addword_form': InlineWordForm(),
  | File "/usr/local/lib/python3.7/dist-packages/weblate/trans/util.py", line 268, in render
  | return django_render(request, template, context, status=status)
  | File "/usr/local/lib/python3.7/dist-packages/django/shortcuts.py", line 36, in render
  | content = loader.render_to_string(template_name, context, request, using=using)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/loader.py", line 62, in render_to_string
  | return template.render(context, request)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/backends/django.py", line 61, in render
  | return self.template.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 171, in render
  | return self._render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 163, in _render
  | return self.nodelist.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 937, in render
  | bit = node.render_annotated(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 904, in render_annotated
  | return self.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/loader_tags.py", line 150, in render
  | return compiled_parent._render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 163, in _render
  | return self.nodelist.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 937, in render
  | bit = node.render_annotated(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 904, in render_annotated
  | return self.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/loader_tags.py", line 62, in render
  | result = block.nodelist.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 937, in render
  | bit = node.render_annotated(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 904, in render_annotated
  | return self.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/defaulttags.py", line 513, in render
  | return self.nodelist.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 937, in render
  | bit = node.render_annotated(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 904, in render_annotated
  | return self.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/defaulttags.py", line 309, in render
  | return nodelist.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 937, in render
  | bit = node.render_annotated(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 904, in render_annotated
  | return self.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/defaulttags.py", line 309, in render
  | return nodelist.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 937, in render
  | bit = node.render_annotated(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/base.py", line 904, in render_annotated
  | return self.render(context)
  | File "/usr/local/lib/python3.7/dist-packages/django/template/library.py", line 214, in render
  | _dict = self.func(*resolved_args, **resolved_kwargs)
  | File "/usr/local/lib/python3.7/dist-packages/weblate/trans/templatetags/translations.py", line 187, in format_translation
  | plural = language.plural
  | File "/usr/local/lib/python3.7/dist-packages/django/utils/functional.py", line 80, in __get__
  | res = instance.__dict__[self.name] = self.func(instance)
  | File "/usr/local/lib/python3.7/dist-packages/weblate/lang/models.py", line 430, in plural
  | return self.plural_set.filter(source=Plural.SOURCE_DEFAULT)[0]
  | File "/usr/local/lib/python3.7/dist-packages/django/db/models/query.py", line 309, in __getitem__
  | return qs._result_cache[0]
  | IndexError: list index out of range
nijel commented 5 years ago

This might be fixed by c45c9c84d1f8b0aed4ca242f4952e4abc2de817f, see #3110

Workaround is to go to /admin/ and changing plural type to default for newly created language.

rhofer commented 5 years ago

the weired thing is that in /admin/ there is no menu item WEBLATE LANGUAGES anymore where one could navigate to Language and change something ...

nijel commented 5 years ago

Ah, it's there only in debug mode.

nijel commented 5 years ago

Thank you for your report, the issue you have reported has just been fixed.