Giter VIP home page Giter VIP logo

Comments (8)

michaeljones avatar michaeljones commented on June 30, 2024

Hi, thanks for reporting this. Are you using usel10n? If so, then I would hope that the language in self.options is set properly on line 206 of the same file. I don't have a completely understanding of it though.

from django-datetime-widget.

MuR avatar MuR commented on June 30, 2024

Yes, I'm using usel10n parameter and yes, I'm getting right locale file (Russian).
But if I need to switch to another language (English), I'm still getting Russian locale file.
I think this is because self.options doesn't updates during language switch.

from django-datetime-widget.

michaeljones avatar michaeljones commented on June 30, 2024

Hi, sorry, I'm trying to understand as I don't have much experience with locales. I think you have usel10n set to True and you're getting the Russian because that is you're current locale, but you'd like to use the English language set anyway? Does it make sense to disable usel10n and set the language yourself?

from django-datetime-widget.

asaglimbeni avatar asaglimbeni commented on June 30, 2024

did you add 'django.middleware.locale.LocaleMiddleware', in your MIDDLEWARE_CLASSES list in settings.py?
Read here for more informations https://docs.djangoproject.com/en/dev/ref/middleware/#django.middleware.locale.LocaleMiddleware

from django-datetime-widget.

MuR avatar MuR commented on June 30, 2024

Yes, django.middleware.locale.LocaleMiddleware is in MIDDLEWARE_CLASSES list in settings.py.
When I switch language, function get_language() returns correct code but self.options['language'] still has the old initial value.

from django-datetime-widget.

lucacorti avatar lucacorti commented on June 30, 2024

I have this issue too. Locale middleware, l10n, i18n and tz support are enabled.

Switching the language causes the form to fail validation. Switching back to the previous language works though.

from django-datetime-widget.

sergiorb avatar sergiorb commented on June 30, 2024

In my case, localization works well when you change your LANGUAGE_CODE to desire language in settings.py. The first time widget is loaded, it triggers the __init__ method of PickerWidgetMixin class, wich contains self.options['language'] = get_supported_language(get_language()) and show it well. When you change language settings at request level (in my case, with a cookie that alerts django to swich language) it doesn't trigger again, so I think the trick is here, triggerig this method per each request or setting widget js to desire language.

Any ideas?

from django-datetime-widget.

unicod3 avatar unicod3 commented on June 30, 2024

I have also affected by this. I used @MuR solution but it would be better if there was a pull request and merge this feature with master.
@MuR thanks for the fix by the way.

from django-datetime-widget.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.