2
我开发了多语言网站。 网页有URI是这样的:如何传递给url_for默认参数?
/RU/about
/EN/about
/IT/about
/JP/about
/EN/contacts
和Jinja2的模板,我写:
<a href="{{ url_for('about', lang_code=g.current_lang) }}">About</a>
我必须写LANG_CODE = g.current_lang所有url_for
电话。
是否可以隐含地通过lang_code=g.current_lang
到url_for
?而只写{{ url_for('about') }}
我的路由器是这样的:
@app.route('/<lang_code>/about/')
def about():
...