I am writing an app that creates/provides various Python decorators. I'd like this app to be localized, including the names of the decorators. The decorators would ultimately be used by other developers who are using my app as a framework (think of my app as a test framework).
Ideally, I'd like to have the ability to create the decorators dynamically based on the localization settings.
For instance, if the language selected is English, I'd like my decorator to be named "apple", and if it's French, I'd like it to be named "pomme".
In the Python code, it would either look like:
@apple
def my_func():
pass
or
@pomme
def my_func():
pass
I ultimately want to have the flexibility to add many more languages without having to modify or duplicate a bunch of code. Ideally, I would only have one decorator function that would handle "apple" or "pomme" depending on the settings.
What's the best way to achieve this?
__init__.pyof your package would be an obvious place.__init__.pyof my package could be used to do this?