Translation of states #119
Comments
You should translate choices attr on a field, or directly translate field value in template. https://docs.djangoproject.com/es/1.9/ref/models/fields/#choices |
Hi However this does not reflect in the admin panel, the state is still displayed as "new" (the key) where I was expecting "New" (the value)
|
I just realized maybe I should move this issue to the fsm-admin project |
Yep, if you see non translated button in admin, this is django-fsm-admin issue. Probably, you can try to override - <input type="submit" value="{{ button_value }}" ...
+ <input type="submit" value="{% trans button_value %}" ... |
Hi I have a form (in the admin or in another custom template) but the value displayed for the FSMField is the key, not the value. It is not admin related I think. What am I missing? |
Any state machine consist of STATE and EVENTS. In django-fsm implementation, STATES are some constant values used for the field. EVENTS are model methods. You need to translate not the STATE but the EVENT names, and django-fsm-admin gives you ability to specify |
What if I want to display the current state label of the object in the user's preferred language? This is a variable, I cannot use |
Actually you can use Btw for the https://github.com/django/django/blob/master/django/contrib/admin/utils.py#L296 |
or use a translated string in the transition custom properties. |
I solved it by using the choices property FSMField inherits from the CharField ! :) |
Hi,
I'm having a hard time trying to make the different states available for translation.
Code:
I tried with something like
but that's not the desired effect, because a different value will be saved to database depending on the user language. I just want to modify the label as a lazy translation on display.
Could I use the custom dictionary for this?
The text was updated successfully, but these errors were encountered: