Comments (19)
@wagnerluis1982 not that I remember.
You are the best person to workn on this issue so... go ahead! :-)
If you need anything don't forget to ask here.
from speakerfight.
I think this issue is already solved, right @luanfonceca ?
from speakerfight.
Nope, we should have something in the User dropdown to change his language.
from speakerfight.
Currently, the language is globally defined on settings.py
, right?
How about to also make this automatically, by reading the Accept header of request? The user settings would still be the first place to see, but if wasn't set, the request info would be considered.
from speakerfight.
@wagnerluis1982 hmmm, it seems a bit complicated to solve the problem.
The feature does not payt the code and your efforts developing it. Also reading headers is not a good idea. Every browser does in its own way. What do you think?
from speakerfight.
@mauricioabreu what exactly is complicated? The user-defined idiom is what this issue is for. So in the main view (read by all pages) we would have something like:
idiom = user.get_idiom() or get_request_idiom(request)
from speakerfight.
@wagnerluis1982 parsing headers and trust them. I think that having the language avaible in the user settings is good enough. I am not against the idea but not sure if the efforts making this code will pay the feature.
from speakerfight.
@mauricioabreu, I'm not really an expert in i18n, but I remembered that Django has a standard way to discover the language by request. And I found that is LocaleMiddleware.
The following link explains how this middleware works. According to what I read, it's only a matter of adding to MIDDLEWARE_CLASSES
to work!
Of course this will not completely solve the problem, as the user can't override the browser idiom, but is a starting point.
from speakerfight.
@wagnerluis1982 now we are talking :P
The middleware can make it work. Cool!
from speakerfight.
@mauricioabreu great!
So, anyone working in this issue? If not, I'm assigning myself.
from speakerfight.
@wagnerluis1982 Are you working on this?
from speakerfight.
@phrfpeixoto yes, man!
I'm still planning things, but I'll have some code soon!
from speakerfight.
I think that make this a setting in the user model is a bit like an overkill. You simply use session and cookie approaches builtin in django. You can also use browser's local storage.
from speakerfight.
Hmmm, we have to see what the others think!
In general I think you are right, but this hurts the user experience since the user needs to change the idiom every time he uses another computer or browser. Users that don't store cookies will not like it too.
Maybe there is a way to make this happens without performance problems.
from speakerfight.
One suggestion.
- We try to use the language information from the Session/Cookies
- If not found we get the information from the database
To reduce the impact to performance, when the user changes the idiom, all his sessions, but the current one, will be closed. This makes that we don't have inconsistency of idioms among sessions.
Of course the user can set the idiom to be automatic, by the browser settings.
from speakerfight.
Hi, in the #188 I added the LocaleMiddleware
to get info from Accept-Language request header.
Although this middleware try to find the language info in the session, it doesn't write anything to the session so the next time this is done.
So I need to make a subclass of LocaleMiddleware to make that happens, where is the best place to put this class?
EDIT [04/11/2016]: Actually I need to adapt the LocaleMiddleware, so it searches in the user database if no language was found at the session or cookie.
from speakerfight.
Hi, to allow the user change his idiom I made the following design. Please, say what you think.
- The current idiom is showed next to user dropdown.
- We can change the language by clicking in the current idiom dropdown.
- And the idiom is changed 😄
from speakerfight.
I agree with this approach.
from speakerfight.
@wagnerluis1982 how is going that? Can you push some code to a PR?
from speakerfight.
Related Issues (20)
- [UI] Improve vote option messages HOT 1
- DEBUG enabled in production
- Request more information about the proponents
- Spammers created fake events HOT 1
- New logo for Speakerfight HOT 3
- Home page button "JOIN THE FIGHTERS" address issue HOT 1
- Unable to update profile photo when user cancelled this action previously
- certificado HTTPS invalido no site 18-07-2018. HOT 1
- I can see an user talk even if it is an anonymous voting HOT 2
- SSL Certified Expired HOT 2
- Remove excessive information of events list page
- Rating buttons disappear upon clicking in the text
- Date creation set to January 10th HOT 2
- Mixed Portuguese and English on new proposals. HOT 2
- Certificado expirado em 05/08/2019 HOT 2
- [Suggestion] Link event on new proposal e-mails
- Show feedback that users must be authenticated to vote HOT 1
- New Event shows português when Profile Set to Inglês HOT 1
- Unable to change Closing Date
- Social login does not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speakerfight.