Rosetta is a Django application that eases the translation process of your Django projects

Overview

Rosetta

https://travis-ci.org/mbi/django-rosetta.svg?branch=develop https://img.shields.io/pypi/v/django-rosetta https://img.shields.io/pypi/l/django-rosetta

Rosetta is a Django application that facilitates the translation process of your Django projects.

Because it doesn't export any models, Rosetta doesn't create any tables in your project's database. Rosetta can be installed and uninstalled by simply adding and removing a single entry in your project's INSTALLED_APPS and a single line in your main urls.py file.

Note: as of version 0.9.0, django-rosetta requires Django 1.11 or later, as of version 0.9.6, django-rosetta requires Django 2.2 or later

Features

  • Reads and writes your project's gettext catalogs (po and mo files)
  • Installed and uninstalled in under a minute
  • Uses Django's admin interface CSS

https://user-images.githubusercontent.com/131808/104168653-ac277e00-53fe-11eb-975e-8d46551fac59.png

Documentation

Please refer to the online documentation to install Rosetta and get started.

Comments
  • Can't click language files from /rosetta/ in non chrome browser on osx.

    Can't click language files from /rosetta/ in non chrome browser on osx.

    On the main listing page for the language files I can' click on a file to go to the next page. It just reloads the current page over and over again, I can make it go by repeatedly and rapidly clicking the link.

    Chrome doesn't appear to have this issue but firefox and safari both do on OSX 10.8.

    THe link appears to go to http://<my_domain>.com/rosetta/select/fr/0/ however clicking it just reloads /rosetta/.

    Have I included URLs improperly somewhere?

    opened by ulchm 29
  • One test failure on OpenSUSE

    One test failure on OpenSUSE

    • Which version of Django are you using?: 1.11.28 and 2.2.12
    • Which version of django-rosetta are you using?: 0.9.3
    • Have you looked trough recent issues and checked this isn't a duplicate? Yes
    [   43s] ======================================================================
    [   43s] FAIL: test_47_azure_ajax_translation (rosetta.tests.tests.RosettaTestCase)
    [   43s] ----------------------------------------------------------------------
    [   43s] Traceback (most recent call last):
    [   43s]   File "/usr/lib/python2.7/site-packages/vcr/cassette.py", line 106, in __call__
    [   43s]     return type(self)(self.cls, args_getter)._execute_function(function, args, kwargs)
    [   43s]   File "/usr/lib/python2.7/site-packages/vcr/cassette.py", line 120, in _execute_function
    [   43s]     return self._handle_function(fn=handle_function)
    [   43s]   File "/usr/lib/python2.7/site-packages/vcr/cassette.py", line 144, in _handle_function
    [   43s]     return fn(cassette)
    [   43s]   File "/usr/lib/python2.7/site-packages/vcr/cassette.py", line 113, in handle_function
    [   43s]     return function(*args, **kwargs)
    [   43s]   File "/home/abuild/rpmbuild/BUILD/django-rosetta-0.9.3/rosetta/tests/tests.py", line 965, in test_47_azure_ajax_translation
    [   43s]     self.assertContains(r, '"Salut tout le monde"')
    [   43s]   File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 393, in assertContains
    [   43s]     self.assertTrue(real_count != 0, msg_prefix + "Couldn't find %s in response" % text_repr)
    [   43s] AssertionError: Couldn't find '"Salut tout le monde"' in response
    
    opened by jayvdb 18
  • Django 1.7 - exception when using AppConfig

    Django 1.7 - exception when using AppConfig

    Currently rosetta loops through applications in INSTALLED_APPS and try to get locale directory for each app. Django 1.7. applications refactor allows to add AppConfig class instead of module. This makes rosetta raise exception:

      File ".../rosetta/poutil.py", line 83, in find_pos
        apppath = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(app.__file__), 'locale')))
    AttributeError: type object 'MYAPPCONFIG' has no attribute '__file__'
    

    Workaround for this is to add this AppConfig to ROSETTA_EXCLUDED_APPLICATIONS.

    opened by bmihelac 17
  • Reference language selector

    Reference language selector

    A couple of months ago, we added a reference language selector in django-rosetta and it's been sitting in our private fork of it since then. We thought you might like it, so we've cleaned it up and pushed it here.

    The feature adds a Reference language selector to the translation interface. This way, instead of having only the option to show the msgid to translate, you can also have the translated version (if you already have other translations) of the msgid. That's useful if you have translators that don't speak your base language.

    opened by hsoft 13
  • Cannot import name 'get_version' from 'rosetta'

    Cannot import name 'get_version' from 'rosetta'

    • Which version of Django are you using?: 2.1.2
    • Which version of django-rosetta are you using?: 0.9.0

    When I run django I get this error message

      File "C:\Users\georg\AppData\Local\Programs\Python\Python37\lib\site-packages\rosetta\urls.py", line 8, in <module>
        from . import views
      File "C:\Users\georg\AppData\Local\Programs\Python\Python37\lib\site-packages\rosetta\views.py", line 32, in <module>
        from rosetta import get_version as get_rosetta_version
    ImportError: cannot import name 'get_version' from 'rosetta'
    
    opened by calenwu 12
  • Save redirect not working and occasionally failing to save

    Save redirect not working and occasionally failing to save

    The initial problem I have is that the "save and translate next block" doesn't navigate forward to the next block, it simply saves the translations on the current page and redisplays it.

    After hitting save, it is possible to move forward manually using the numbered page links which is what I've asked my translator to do.

    However the bigger problem is that after repeating the above for several pages, on the ~6th page of translations the save button redirects back to the Language selection page and the most recent set of translations are lost. Previously saved pages are retained.

    Seems likely to be an issue with session/caching but I have no idea where to start....

    Django 1.4 and Rosetta 0.6.8.

    I experience the issue under two server configurations:

    • nginx in front of Gunicorn
    • 'runserver' (daemonised under screen)

    Configuration:

    ROSETTA_STORAGE_CLASS = 'rosetta.storage.CacheRosettaStorage' SESSION_COOKIE_SECURE = False CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'dwight-dev', } }

    opened by dwightgunning 11
  • Layout bug in Firefox 10+

    Layout bug in Firefox 10+

    In Firefox version 10+ the translation table with all the message files is shifted to the right - as far as the end of the search form above. Please ad an overflow:hidden to #toolbar in rosetta.css to fix it:

    toolbar { height:20px;overflow: hidden}

    Or place a
    below the toolbar

    tag.

    Thanks for the great app!!

    opened by SimonSteinberger 10
  • Django 1.9 removed get_cache from django.core.cache

    Django 1.9 removed get_cache from django.core.cache

    Rosetta 0.7.8, Django 1.9. Using memcached backend. Error:

    rosetta/poutil.py
    from django.core.cache import get_cache
    ImportError: cannot import name 'get_cache'
    

    Django 1.9 release notes: django.core.cache.get_cache is removed

    opened by grumpa 9
  • Explicit URL structure

    Explicit URL structure

    I was wondering why the system works with session'ed attributes like current language and filter.

    I'm pretty sure there is some reason behind that, but I would personally prefer a more explicit URL structure where you edit /rosetta/fr/?filter=fuzzy. This would allow deep-linking, allow for editing (or simply browsing) multiple languages in separate tabs (and not separate browsers as is now required) and just make it more transparent (and thus more pythonic).

    Would there be an interest in (me working on) changing this?

    opened by barklund 9
  • Although locales are found, I can't open them.

    Although locales are found, I can't open them.

    Hi,

    I have installed rosetta, I am using django 1.4.5. At first I could not open the rosetta panel because /rosetta/ url redirected me to /accounts/login/ (although my admin user had already been logged in through the admin panel, and I am using /login/ instead of /accounts/login/ to authenticate).

    So, I had to add ROSETTA_REQUIRES_AUTH = False in my settings.py file. After this, rosetta panel opened. However I only see something like this.

    https://dl.dropboxusercontent.com/u/2423935/ros.JPG

    and whenever I click on 'conf' it doesn't do anything.

    What am I doing wrong?

    Any ideas what should I do?

    PS: I have added my admin user to the translators group, too (although it is not necessary) and admin user is always logged in.

    opened by xpanta 9
  • A PR to make compilation of mo file optional?

    A PR to make compilation of mo file optional?

    As far I can tell, when a page of translations is saved in Rosetta the mo file is automatically compiled.

    If it's automatically complied then, even if rosetta_settings.[U]WSGI_AUTO_RELOAD is False, a restart of the application outside of Rosetta will result in the translation going live, e.g. a restart as part of the application deployment process.

    I have a use case where it'd be preferable for the mo file to not be automatically compiled: Translations need to go live in bulk as part of a scheduled 'translation deployment', but not inadvertently made live piecemeal as a result of day-to-day code deployments (which restart the application).

    Is there interest in a PR that adds an Rosetta setting to make compilation optional? If so, I'll make it.

    The setting would be called something like rosetta_settings.AUTO_COMPILE and default to True for backwards compatibility.

    With this setting in place I think all that'd be needed is to use it in an if-block around this code which does the compilation and, optionally, auto reloading:

    https://github.com/mbi/django-rosetta/blob/develop/rosetta/views.py#L164-L186

    (do point out if there's anything I missed, I haven't looked in detail yet).

    opened by nealtodd 8
  • Missing Azure Location setting

    Missing Azure Location setting

    • Which version of Django are you using?: 3.2
    • Which version of django-rosetta are you using?: 0.9.8
    • Have you looked trough recent issues and checked this isn't a duplicate? yes

    Setting AZURE_CLIENT_SECRET is not enough. Gives the following error:

    Microsoft Translation API error: Error code 401000, The request is not authorized because credentials are missing or invalid.

    Adding the missing location to API request header solves this issue.

    image
    opened by JPolonia 0
  • Why split `DJANGO_SETTINGS_MODULE` in function find_pos()?

    Why split `DJANGO_SETTINGS_MODULE` in function find_pos()?

    • Which version of Django are you using?: 3.2
    • Which version of django-rosetta are you using?: latest
    • Have you looked trough recent issues and checked this isn't a duplicate? Y

    This is the original code in poutil.py, and when my structure of settings is settings/*, errors will be like TypeError: expected str, bytes or os.PathLike object, not NoneType, since "settings.*".split('.') happended and settings here is a directory, which no __file__ was included.

    # rosetta/poutil.py
    def find_pos(lang, project_apps=True, django_apps=False, third_party_apps=False):
        # project/locale
        if settings.SETTINGS_MODULE:
            parts = settings.SETTINGS_MODULE.split('.')
        else:
            # if settings.SETTINGS_MODULE is None, we are probably in "test" mode
            # and override_settings() was used
            # see: https://code.djangoproject.com/ticket/25911
            parts = os.environ.get(ENVIRONMENT_VARIABLE).split('.')
        project = __import__(parts[0], {}, {}, [])
        # TODO: update below
        project = __import__("settings.dev")
    

    So what should I do if my settings structure is settings/*?

    opened by Dongbox 1
  • Configurable version control service integration

    Configurable version control service integration

    • Which version of Django are you using?: 2.2
    • Which version of django-rosetta are you using?: 0.9.5
    • Have you looked trough recent issues and checked this isn't a duplicate? Yes

    Feature: Link to source file

    The "Occurrence(s)" column in the Web UI lists file names and the line numbers of where the text was extracted from. It should be easy to configure an external service URL and generate a link to display the text location in the file under version control.

    If the reference content (see definition) is directly a valid URL (e.g. when I edit the PO file and add a #. https://foo.bar.com line to an item) that URL should be turned into a clickable link either.

    Related

    See https://code.djangoproject.com/ticket/32356 for a related Django feature request.

    opened by bittner 5
  • Rosetta and TMs (translation memory)

    Rosetta and TMs (translation memory)

    Hi there!

    We're using Rosetta 0.9.4 on Django 2.2.17, and all is good. Apart from skepticism of professional translators, of course. The main theme is, "The tool doesn't provide a TM, hence we can't use it."

    I need some help to understand this topic better.

    Note that my wife is a professional translator and project manager in the translation industry, so I am informed largely about the concepts of "traditional translation" of documents (e.g. SDL Trados, Across, OmegaT) but also about the approach emerged from the software development industry (e.g. Transifex, Crowdin), which I have hands-on experience with.

    Where is Rosetta's TM?

    From my understanding, Rosetta is more or less a nice front-end to manipulate .po files, extracted by Python's gettext module integrated in Django. There are no models, yet still Rosetta does "automatic translation", which is visible by fuzzy matches (which I assume is also a feature coming from gettext again, really).

    So in essence, the .po files themselves are that TM already. There is no additional or separate component, but as the entire "document" is identical to all (successful) translations that have been done in the past, there is not even a need for a separate TM. It's all read into "Rosetta's memory" in its entirety. There is no disadvantage of having "no TM", given we only deal with our domain specific vocabulary.

    Is this view correct?

    External TMs?

    A related question, after having clarified whether Rosetta has a TM or no, is there a way to

    • download Rosetta's TM and/or
    • attach (or upload) an external TM

    to add, say, more flexibility to the translation process?

    opened by bittner 6
  • Documentation not clear on when the cache setting comes into play for parsed PO files.

    Documentation not clear on when the cache setting comes into play for parsed PO files.

    • Which version of Django are you using?: 2.2
    • Which version of django-rosetta are you using?: 0.9.3

    The document fails to mention an important fact that if the underlying po files are writable then even if a cache is configured and rosetta cache storage points to that (for e.g., using ROSETTA_STORAGE_CLASS = 'rosetta.storage.CacheRosettaStorage') - still this cache will not be used. Only when the file is not writable this setting comes into picture.

    Also this is clear from the views.py of Rosetta

    @cached_property
        def po_file(self):
            """Return the parsed .po file that is currently being translated/viewed.
    
     if self.po_file_is_writable:
                # If we can write changes to file, then we pull it up fresh with
                # each request.
    
    .........................................
    ..........................................
    
            else:
                storage = get_storage(self.request)
                po_file = storage.get(self.po_file_cache_key, None)
    
    opened by shailendra333 0
  • Locale path in AWS S3

    Locale path in AWS S3

    • Which version of Django are you using?: django 1.5
    • Which version of django-rosetta are you using?: 0.7.2
    • Have you looked trough recent issues and checked this isn't a duplicate?Not duplicate

    Currently rosetta scans the locale paths specify it in settings.py and loads into admin UI. Once the translation added and click to save button will store it in the same path of the corresponding locale. Is there any way we can change this to store it remote server or AWS S3 location.

    In docker container based environment, during auto-scaling the translator instance can be redeployed so the saved changes in .po files cane be lost. To overcome this, prefer to store the files in AWS S3 location.

    Is this approach is possible to achieve?

    PR welcome 🙏 
    opened by sajithygag 14
Releases(v0.7.11)
  • v0.7.11(Mar 30, 2016)

    • Make MO file compilation optional (PR #166, Issue #155, thanks @nealtodd)
    • Fix an invalid page get parameter by falling back to page 1 (PR #165, thanks @nealtodd)
    • Adds reference language selector (PR #60, thanks @hsoft)
    Source code(tar.gz)
    Source code(zip)
Owner
Marco Bonetti
Back-end person at @cruncher.
Marco Bonetti
Django + NextJS + Tailwind Boilerplate

django + NextJS + Tailwind Boilerplate About A Django project boilerplate/templa

Shayan Debroy 3 Mar 11, 2022
PicoStyle - Advance market place website written in django

Advance market place website written in django :) Online fashion store for whole

AminAli Mazarian 26 Sep 10, 2022
Awesome Django Blog App

Awesome-Django-Blog-App Made with love django as the backend and Bootstrap as the frontend ! i hope that can help !! Project Title Django provides mul

ANAS NABIL 2 Feb 08, 2022
The magical reactive component framework for Django ✨

Unicorn The magical full-stack framework for Django ✨ Unicorn is a reactive component framework that progressively enhances a normal Django view, make

Adam Hill 1.4k Jan 05, 2023
scaffold django rest apis like a champion 🚀

dr_scaffold Scaffold django rest apis like a champion ⚡ . said no one before Overview This library will help you to scaffold full Restful API Resource

Abdenasser Elidrissi 133 Jan 05, 2023
A django model and form field for normalised phone numbers using python-phonenumbers

django-phonenumber-field A Django library which interfaces with python-phonenumbers to validate, pretty print and convert phone numbers. python-phonen

Stefan Foulis 1.3k Dec 31, 2022
webfest Django project @innovaccer

inno-doctor webfest Django project @innovaccer setup guide create new directory for project clone the repo with url into the directory make sure pytho

Rohit sahu 6 Oct 28, 2022
Tools to easily create permissioned CRUD endpoints in graphene-django.

graphene-django-plus Tools to easily create permissioned CRUD endpoints in graphene-django. Install pip install graphene-django-plus To make use of ev

Zerosoft 74 Aug 09, 2022
Use watchfiles in Django’s autoreloader.

django-watchfiles Use watchfiles in Django’s autoreloader. Requirements Python 3.7 to 3.10 supported. Django 2.2 to 4.0 supported. Installation Instal

Adam Johnson 43 Dec 14, 2022
Simple alternative to Doodle polls and scheduling (Python 3, Django 3, JavaScript)

What is jawanndenn? jawanndenn is a simple web application to schedule meetings and run polls, a libre alternative to Doodle. It is using the followin

Sebastian Pipping 169 Jan 06, 2023
No effort, no worry, maximum performance.

Django Cachalot Caches your Django ORM queries and automatically invalidates them. Documentation: http://django-cachalot.readthedocs.io Table of Conte

NoriPyt 980 Jan 06, 2023
Vehicle registration using Python, Django and SQlite3

PythonCrud Cadastro de veículos utilizando Python, Django e SQlite3 Para acessar o deploy no Heroku:

Jorge Thiago 4 May 20, 2022
Phoenix LiveView but for Django

Reactor, a LiveView library for Django Reactor enables you to do something similar to Phoenix framework LiveView using Django Channels. What's in the

Eddy Ernesto del Valle Pino 526 Jan 02, 2023
Developer-friendly asynchrony for Django

Django Channels Channels augments Django to bring WebSocket, long-poll HTTP, task offloading and other async support to your code, using familiar Djan

Django 5.5k Jan 06, 2023
Django + AWS Elastic Transcoder

Django Elastic Transcoder django-elastic-transcoder is an Django app, let you integrate AWS Elastic Transcoder in Django easily. What is provided in t

StreetVoice 66 Dec 14, 2022
A small Django app to easily broadcast an announcement across a website.

django-site-broadcasts The site broadcast application allows users to define short messages and announcements that should be displayed across a site.

Ben Lopatin 12 Jan 21, 2020
A starter template for building a backend with Django and django-rest-framework using docker with PostgreSQL as the primary DB.

Django-Rest-Template! This is a basic starter template for a backend project with Django as the server and PostgreSQL as the database. About the templ

Akshat Sharma 11 Dec 06, 2022
A simple Django middleware for Duo V4 2-factor authentication.

django-duo-universal-auth A lightweight middleware application that adds a layer on top of any number of existing authentication backends, enabling 2F

Adam Angle 1 Jan 10, 2022
Django project starter on steroids: quickly create a Django app AND generate source code for data models + REST/GraphQL APIs (the generated code is auto-linted and has 100% test coverage).

Create Django App 💛 We're a Django project starter on steroids! One-line command to create a Django app with all the dependencies auto-installed AND

imagine.ai 68 Oct 19, 2022
RedisTimeSeries python client

redistimeseries-py Deprecation notice As of redis-py 4.0.0 this library is deprecated. It's features have been merged into redis-py. Please either ins

98 Dec 08, 2022