On 25/11/2019 11:11 pm, Jani Tiainen wrote:
> I've use-case where my django app is delivered to multiple customers
> in multiple languages.
>
> Due the nature of application end users do use for certain terms their
> own wording, which differ significantly from others.
>
> For example:
>
> "Delivery route". Some may call it "driving route". Some "route" and
> some just "delivery route".
I love this. It means the customers are involved and taking ownership. I
think it is worthwhile making it a feature of all/most apps. It could
even be built into Django one day.
It probably means building a special app to let customers enter their
own terms for certain fields. The app would need to store such terms in
the database or ini files. Not sure how you might do it but I'd probably
look at overriding verbose_name. Might bypass the usual translations
because the customer probably supplies the correct language as well.
def get_verbose_name(obj, field=None):
if field is None:
return obj.__class__()._meta.verbose_name
try:
return obj.__class__()._meta.get_field("{0}".format(field)).verbose_name
except FieldDoesNotExist:
return None
It needs to include drop-down lists too.
def choose(choices, choice):
# this demands that choices is exactly as Django specifies
for pair in choices:
if pair[0] == choice:
return pair[1]
for option in choices:
for pair in option[1]:
if pair[0] == choice:
return pair[1]
Please keep us posted with your solution. It is a brilliant use-case.
Cheers
Mike
>
> Any ideas how to handle this?
>
> --
> Jani Tiainen
> Software wizard
>
> https://blog.jani.tiainen.cc/
>
> Always open for short term jobs or contracts to work with Django.
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91odVXDb_Tu3pAmmKtZMNZZyLDzHak9WMmMxU6HZrY0v_Zg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHn91odVXDb_Tu3pAmmKtZMNZZyLDzHak9WMmMxU6HZrY0v_Zg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/85d9ba45-1a2c-0a6c-3b12-e67463ba8ba2%40dewhirst.com.au.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment