Is there any possibility in Python to create below conditional string formatting.
At the beginning I create this dictionary of different language messages:
MB_MESSAGE = {
'en_EN': '{0} day/days ago.\n',
'pl_PL': '{0} dzień minął/dni minęło',
}
I would like to achieve selecting either day
or days
basing on number of days, same for polish language dzień minął
for 1 day and dni mnięło
for 2 or more days.
In later code I use this dict as shown below:
import locale
lang = locale.getdefaultlocale()
message = MB_MESSAGE[lang].format(days_between(d1, d2))
I use Python35.