Git Product home page Git Product logo

django-transifex's People

Contributors

ecugol avatar jakul avatar jarcoal avatar oppianmatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-transifex's Issues

Installation issue with PIP

When you install this library with pip:

pip install djangotransifex

It'll fail with the following error:

    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

      File "<string>", line 20, in <module>

      File "/private/var/folders/jc/c_vnhmp15sn_pbbssg69y95w0000gn/T/pip-build-oZlR_T/djangotransifex/setup.py", line 21, in <module>

        long_description=open('README.md').read(),

    IOError: [Errno 2] No such file or directory: 'README.md'

Looks like current source doesn't make this call anymore, can a new version be put on pypi?

Executing `pull_translations` without a locale path setting gives an exception

When I run

./manage.py tx pull_translations

without having specified TRANSIFEX_PROJECT_PATH in the settings I get the following exception:

Executing pull_translations on project test-392
Pulling translations for "test-392" project, in "en" source language
Traceback (most recent call last):
  File "./manage.py", line 7, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/harris/Workspaces/Unleash12/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/harris/Workspaces/Unleash12/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/harris/Workspaces/Unleash12/env/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/harris/Workspaces/Unleash12/env/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/Users/harris/Src/django-transifex/djangotransifex/management/commands/tx.py", line 75, in handle
    command_func(*args[1:], **options)
  File "/Users/harris/Src/django-transifex/djangotransifex/management/commands/tx.py", line 159, in transifex_pull_translations
    project_slug=self.project_slug, source_language=self.source_language
  File "/Users/harris/Src/django-transifex/djangotransifex/api.py", line 171, in pull_translations
    'LC_MESSAGES'
  File "/Users/harris/Workspaces/Unleash12/env/bin/../lib/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'function' object has no attribute 'endswith'

This is with Django 1.6.

It seems that if the path is not explicitly set, then django-transifex tries to figure out where the project is located using a lazy function. There are two problems in the code:

  • the lazy function is not properly initialized - it needs str as an additional parameter.
  • the lazy function is not a property but a callable, and is not evaluated on access.

There is also the problem that the actual helper function app_settings._get_project_path does not handle the case where the settings file is not top-level in the project. In my case, all my settings are stored in a submodule structure.

The tests do not catch this, because the tests explicitly define TRANSIFEX_PROJECT_PATH.

upload_translations ignores LANGUAGE_MAPPING

pull_translations does map from Transifex codes to Django codes and it works well, but it seems that upload_translations just uses the Django's language code, ignoring the mapping, which then creates the language as duplicate into the Transifex. As an example:

TRANSIFEX_LANGUAGE_MAPPING = {
    "ru_ee": "ru",
    "cs_CZ": "cs",
}

Now doing ./manage.py tx upload_translations ru causes "Russian" to be created in Transifex, even though we already have "Russian (Estonia)" there and it is mapped in settings.

Not sure if this is intended behaviour, but personally I think it would be logical to also map the language codes when uploading.

django 1.8 support

With django moving to argparse the management command now fails:

usage: manage.py tx [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
                    [--pythonpath PYTHONPATH] [--traceback] [--no-color]
manage.py tx: error: unrecognized arguments: pull_translations

basically this SO answer http://stackoverflow.com/questions/30230490/django-custom-command-error-unrecognized-arguments

A work around until the package is updated in pypi is to copy the tx.py file and put this in:

def add_arguments(self, parser):
        parser.add_argument('args', nargs="+")

Remove test packages from requirements

For some reason django-transifex requires some specific test package versions:

djangotransifex==0.1.10   requires django, mock==1.0.1, pytest-django==2.7, pytest==2.6.4, python-transifex>=0.1.7

This means we can't install our own versions of those packages.

There is no need for these test packages and can be moved to a requirements-dev.txt

installs old django version

We've been using django transfiex 1.6 with django 1.6 for ages now. Went to upgrade to 1.8 and it uninstall django and starts installing 1.5.12.

It's because this is in the requirements.txt:

django>=1.3,<1.6

Why the old version of django?

usage output not readable

Running this:

python manage.py tx push --help

Gives this output:

usage: manage.py tx [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
                    [--pythonpath PYTHONPATH] [--traceback] [--no-color]
                    args [args ...]

Available Commands: * create_project Usage: ./manage.py tx create_project
Create the project on Transifex. * ping Ping the server to verify connection
details and auth details * pull_translations Usage: ./manage.py tx
pull_translations [options] Pull all translations from the Transifex server to
the local machine. This will overwrite any translations made locally *
upload_source_translations Usage: ./manage.py tx upload_source_translation
[options] Upload the source translation to Transifex. * upload_translations
Usage: ./manage.py tx upload_translations language_code [options] Upload the
translations for the given language to Transifex. This will overwrite any
translations made on the Transifex server

positional arguments:
  args

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.

The list of available commands isn't that readable.

IOError - version.txt

(venv)(venv) matt@Cronus[/Users/matt/Source/Pitchup.com]$ ./manage.py shell
Using settings: pitchup.settings.local
Traceback (most recent call last):
  File "./manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
    translation.activate('en-us')
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
    return _trans.activate(language)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
    _active.value = translation(language)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
    app = import_module(appname)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/djangotransifex/__init__.py", line 6, in <module>
    VERSION = open(_version_path).read().rstrip() #rstrip() removes newlines
IOError: [Errno 2] No such file or directory: '/Users/matt/Source/Pitchup.com/venv/lib/python2.7/site-packages/djangotransifex/version.txt'

directory doesn't have version.txt (must be missing from the pypi package). Also version file in github at https://github.com/jakul/django-transifex/blob/master/djangotransifex/version.txt lists 1.7

Pypi lists version 1.8

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.