Git Product home page Git Product logo

Comments (6)

mbi avatar mbi commented on May 18, 2024

Not sure I understand the issue here: the message variable is local to the context of Rosetta, and is displayed in an isolated manner inside a Rosetta template, how would if affect your message framework?

from django-rosetta.

scaryclam avatar scaryclam commented on May 18, 2024

We were customising the rosetta template to fit in with the look and feel of our website by putting it into the local project under templates/rosetta. Because rosetta uses "messages" as the variable name, the usual messages framework is unusable for any of the customised rosetta templates.

We're now using a patched version of rosetta (changing "messages" to "rosetta_msgs") which allows rosetta and the django messaging framework to co-exist properly.

The issue is simply the use of the variable name "messages" when integrating rosetta into websites that also make use of django messages to convey information back to users.

Hope that makes the issue clearer.

from django-rosetta.

mbi avatar mbi commented on May 18, 2024

Okay, I hope you'll agree this isn't an issue with Rosetta then, and probably best taken care of in a fork.

from django-rosetta.

scaryclam avatar scaryclam commented on May 18, 2024

It seems more of a naming issue to me. The messages variable name is part of django. Would it not just be possible to use a variable such as rosetta_messages rather than conflicting with django? It's only used in two places and anyone who uses django messages and rosetta will get this issue.

from django-rosetta.

mbi avatar mbi commented on May 18, 2024

Anyone who uses Rosetta embedded into the global admin, you mean? Or am I missing something again?
Anyway, I'll accept a pull request that addresses this issue, as long as it's fully tested.

from django-rosetta.

scaryclam avatar scaryclam commented on May 18, 2024

It can affect anyone just trying to use the messages framework in their site alongside rosetta that has been edited to fit in with their look and feel. Basically, the home() view in views.py puts locals() into the context. Djangos messages framework also uses the messages variable name. So when a project puts something like:

{% if messages %}
<ul class="messages">
    {% for message in messages %}
    <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
    {% endfor %}
</ul>
{% endif %}

into a template like base.html, django messages spits out all of the rosetta languages stored in the messages variable onto the page. So the project must either copy the above code into every template where they might want to see messages appear (tedious for even a medium project) or patch rosetta to use a less general variable name.

I've make a fork and applied some changes but am wondering if you have any specific tests for templates. If not I'll set up a test project and make sure it all works as expected before making a pull request.

Thanks,

Becky Lewis

from django-rosetta.

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.