Please add a filter for getting the language family from a given language code to the i18n tag library
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
For my current project, I need an i18n filter that returns just the language family, or whatever it is called, from say 'en-us'. The family then would be 'en'. While I could add this as part of my project, I think that the feature would also be helpful to other users, hence my request.
A sample filter implementation would be:
@register.filter def language_family(lang_code): return lang_code.split('-')
Please note that although I am aware of your process, the above code snippet is so small, that I will not include a patch for the template tags library i18n.py here.
Change History (5)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|