I'm working with this module right here: https://pypi.org/project/translate
I am translating all the months in a year to english, but I'm noticing that the 7th month is translated to it's short form "Jul" as opposed to "July".
Here is what I'm doing:
main.py
from translate import Translator
translator=Translator(from_lang="Norwegian", to_lang="English")
print(translator.translate("Juli"))
Terminal
> pip install translator
> python main.py
Jul
>
"Juli" in norwegian should be "July" in english, not sure why it comes out as "Jul". The other months are translated just fine.
I'm using Docker to run my application in the official Python 3.5 image.
I tried listing all the month names in a Python list, where all the other names were translated correctly.
main.py
# All the month names in norwegian.
months = [ "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" ]
for month in months:
print(translator.translate(month))
Terminal
> pip install translator
> python main.py
January
February
March
April
May
June
Jul
August
September
October
November
December
>
I really, really hope I can find a solution that isn't this:
if month == "Jul":
print("July")
As stated in the Documentation the translator used by this library can be changed by using a parameter. If the default translator yields undesirable results I would advise to check out one of the other available Translators. Here is an example how to change the provider to deepl. Microsoft Translation API, Translated MyMemory API and LibreTranslate are also available.
from translate import Translator
translator=Translator(from_lang="Norwegian", to_lang="English",provider='deepl')