Code Monkey home page Code Monkey logo

Comments (4)

andymckay avatar andymckay commented on August 28, 2024

Because the locale of the email is set to the person deleting. ADDON_TYPE is localised here: https://github.com/mozilla/olympia/blob/master/apps/constants/base.py#L161-L172

What you want to do is make everything in the email be in en-US. There is an activate_lang context manager on the user that does something very similar to this. What might work is to make that accept an argument and then do something like:

with request.user.activate_lang('en-US'):
   ... send email

Then after the email has been sent, everything will continue in the users locale.

from addons.

wagnerand avatar wagnerand commented on August 28, 2024

Thanks Andy, that was very helpful!

from addons.

wagnerand avatar wagnerand commented on August 28, 2024

Prerequisites:

--- a/apps/amo/utils.py
+++ b/apps/amo/utils.py
@@ -164,6 +164,9 @@ def send_mail(subject, message, from_email=None, recipient_list=None,
     from amo.tasks import send_email
     import users.notifications as notifications

+    import ipdb; ipdb.set_trace()
+
     if not recipient_list:
         return True

How to test the patch:

  1. Set the default locale in your user profile to a language that you know has the word "extension" localized, e.g. "German".
  2. Upload a new add-on
  3. Go to the developer hub -> Status and Versions
  4. Delete your add-on.

When ipdb pauses, inspect subject or message.

Current result:
Deleting ERWEITERUNG ...

Expected result:
Deleting EXTENSION...

from addons.

magopian avatar magopian commented on August 28, 2024

Here are STRs that don't require modifying the code:
1/ set your locale to be something different than english (eg german)
2/ go to the devhub and delete the add-on
3/ check the "fake mails" (using /en-us/admin/mail): the mail subject and content should contain something like Deleting EXTENSION <extension> (<extension id>): the EXTENSION word shouldn't be localized (and nothing else should be localized either)

from addons.

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.