Open lingxiaoyang opened 7 years ago
I have tried your solution, but I ended up with this error 'Reverse for 'account_step' not found. 'account_step' is not a valid view function or pattern name', because the view start using the translated name instead of english one...
I mean the name of the step is needed in processing.. so thats why translation is big issue here.
I have found solution to my problem!
its so simple, you can use the template ( html) to translate the steps like this :
<div class="account-area">
<div class="multiStep-wrapper multiStep-top-border multiStep-bottom-border">
<div class="multiStep-wrapper-flex">
<div class="multiStep-wrapper-left">
<ul class="step-list-wrapper list-style-none">
{% for t in wizard.steps.all %}
<li class="single-step-list-step
{% if wizard.steps.current == t %}current-items
{% elif forloop.counter0 < wizard.steps.index %}completed {% endif %}">
<span class="single-multiStep-request-list-item-number"> {{ forloop.counter }} </span>
<div class="single-step-list-contents">
<!-- hereeeee is the updated thing: so simple --->
<h5 class="title">{% trans t %}</h5>
</div>
</li>
{% endfor %}
</ul>
</div>
<div class="multiStep-wrapper-contents {% if wizard.steps.current %}active {% endif %}">
{% include 'form_errors.html' %}
<form method="post" enctype="multipart/form-data"
class="multiStep-form style-one simplePresentCart-two"
style="height: calc(100%);" id="main_register_form">
<div class="row">
{% csrf_token %}
{{ wizard.management_form|crispy }}
{% if wizard.form.forms %}
{{ wizard.form.management_form|crispy }}
{% for form in wizard.form.forms %}
{% crispy form %}
{% endfor %}
{% else %}
{% crispy wizard.form %}
{% endif %}
<div class="multiStep-footer">
<div class="multiStep-footer-flex">
<div class="multiStep-footer-left">
{% if wizard.steps.prev %}
<button formnovalidate
name="wizard_goto_step"
type="submit"
class="primry-btn-2 lg-btn"
value="{{ wizard.steps.prev }}">{% trans "Prev Step" %}</button>
{% endif %}
</div>
{% if wizard.steps.current == wizard.steps.last %}
<div class="multiStep-footer-right">
<input type="submit" class="primry-btn-2 lg-btn"
value="{% trans "Register" %}"/>
</div>
{% else %}
<div class="multiStep-footer-right">
<input type="submit" class="primry-btn-2 lg-btn"
value="{% trans "Next" %}"/>
</div>
{% endif %}
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
Hello there,
I was developing a bilingual app and was trying to find a way of using translated step names in URL. I didn't find a solution either by browsing the code/doc or by asking #django IRC. I ended up in inheriting the view class as below:
while in
urls.py
, I explicitly assigned i18n url names:Is it a good solution? If so, could you please consider adding this feature?