Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naimurhasan/5dc4e05538736227447b1f13d271928f to your computer and use it in GitHub Desktop.
Save naimurhasan/5dc4e05538736227447b1f13d271928f to your computer and use it in GitHub Desktop.
@register.filter()
def to_bengali(value):
string_value = str(value)
bn_digits = {
0: '০',
1: '১',
2: '২',
3: '৩',
4: '৪',
5: '৫',
6: '৬',
7: '৭',
8: '৮',
9: '৯',
}
for x in bn_digits:
string_value = string_value.replace( str(x), bn_digits[x] )
return string_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment