Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Add user preferred language field #261

Closed
nemesifier opened this issue Jun 19, 2021 · 1 comment · Fixed by #297
Closed

[feature] Add user preferred language field #261

nemesifier opened this issue Jun 19, 2021 · 1 comment · Fixed by #297

Comments

@nemesifier
Copy link
Member

nemesifier commented Jun 19, 2021

We need to store an additional field to store the preferred language of the user (string, with choices defaulting to settings.LANGUAGES, defaulting to a callable which uses the default locale set in django settings).

This is needed because in different modules we send email to users and in some end-user applications we need to translate the content for the end users, and when sending email we don't have HTTP requests which tell us which languages are accepted by the user so we need to have this info stored in the DB.

Something like the following should do:

language = models.CharField(
    max_length=10,
    choices=settings.LANGUAGES,
    default=settings.LANGUAGE_CODE
)

Let's ensure the migration created points the choices directly to settings.LANGUAGES without duplicating the whole list/tuple, otherwise it will be painful to maintain.

@nemesifier
Copy link
Member Author

I think this can be closed for now as it's not really needed.

@nemesifier nemesifier reopened this Nov 8, 2021
codesankalp added a commit that referenced this issue Nov 15, 2021
codesankalp added a commit that referenced this issue Nov 15, 2021
codesankalp added a commit to codesankalp/openwisp-users that referenced this issue Nov 18, 2021
nemesifier added a commit that referenced this issue Nov 26, 2021
Closes #261

Co-authored-by: Federico Capoano <f.capoano@openwisp.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant