Git Product home page Git Product logo

Comments (9)

nijel avatar nijel commented on May 21, 2024

Indeed, looks like a bug in translate-toolkit, but I will look deeper at it tomorrow.

from weblate.

progval avatar progval commented on May 21, 2024

If I give project_id=limnoria.pk instead of project=limnoria, I get the same traceback, with TypeError: 'dict' object is not callable

from weblate.

nijel avatar nijel commented on May 21, 2024

Actually it might be bug on Weblate side - can you try whether using SubProjects.objects.create(...) instead of SubProject(...) + .save would work?

from weblate.

progval avatar progval commented on May 21, 2024

It does not change anything.

from weblate.

nijel avatar nijel commented on May 21, 2024

Okay, I was able to reproduce and it looks still pretty weird:

  • interactive interpreter sets _ to last return value
  • translate-toolkit uses _ function without defining it

Combining this leads to this bug. It is not exposed when using web interface because it of course does not use interactive interpreter.

As workaround you can create dummy function:

>>> def _(x):
...     return x
... 

I'll try to find proper solution for this.

from weblate.

nijel avatar nijel commented on May 21, 2024

It looks like when _ is not defined, ttkit automatically creates one:

Python 2.7.3rc2 (default, Apr  5 2012, 14:36:30) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import storage.factory
>>> x = storage.factory.getobject('../locale/cs/LC_MESSAGES/django.po')
>>> _
<bound method NullTranslations.ugettext of <gettext.NullTranslations instance at 0xd6a1b8>>
>>> 
Python 2.7.3rc2 (default, Apr  5 2012, 14:36:30) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import storage.factory
>>> 'foo'
'foo'
>>> x = storage.factory.getobject('../locale/cs/LC_MESSAGES/django.po')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "storage/factory.py", line 180, in getobject
    storeclass = getclass(storefile, ignore, classes=classes, classes_str=classes_str, hiddenclasses=hiddenclasses)
  File "storage/factory.py", line 159, in getclass
    module = __import__("translate.storage.%s" % _module, globals(), {}, _module)
  File "/usr/lib/python2.7/dist-packages/translate/storage/po.py", line 43, in <module>
    from translate.storage.pypo import * # pylint: disable-msg=W0401
  File "/usr/lib/python2.7/dist-packages/translate/storage/pypo.py", line 33, in <module>
    from translate.storage import pocommon, base, poparser
  File "/usr/lib/python2.7/dist-packages/translate/storage/pocommon.py", line 191, in <module>
    class pofile(poheader.poheader, base.TranslationStore):
  File "/usr/lib/python2.7/dist-packages/translate/storage/pocommon.py", line 192, in pofile
    Name = _("Gettext PO file") # pylint: disable-msg=E0602
TypeError: 'str' object is not callable
>>> _
'foo'

from weblate.

nijel avatar nijel commented on May 21, 2024

Workarounded in git, thanks for reporting this.

from weblate.

progval avatar progval commented on May 21, 2024

_ is automatically created when gettext.install() is called.

I thought it was only in the current module, through

Sent from my Android phone with K-9 Mail. Please excuse my brevity.

from weblate.

nijel avatar nijel commented on May 21, 2024

It is created by translate.i18n when it does not exist. However interactive interpreter creates _ as return value of last command, what breaks the things. Anyway there should be workaround for that now.

from weblate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.