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

Add config lang #40087

Merged
merged 2 commits into from
May 20, 2022
Merged

Add config lang #40087

merged 2 commits into from
May 20, 2022

Conversation

AlexAndBear
Copy link

@AlexAndBear AlexAndBear commented May 19, 2022

Description

Requirement for:
owncloud/web#6243

Related Issue

  • Fixes <issue_link>

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs
Copy link

update-docs bot commented May 19, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jvillafanez
Copy link
Member

The idea looks ok to me.

Do we have any plans for adding more information in the "config" key? Otherwise, it seems better to use the "language" key directly.
In addition, should we include the default configured language if the user hasn't configured anything? or maybe include the default in a different key?

@phil-davis
Copy link
Contributor

In addition, should we include the default configured language if the user hasn't configured anything? or maybe include the default in a different key?

The code could return the "effective" language for the user. If the user has explicitly set a language, then return that. If the user has not set a language then return the system default language (which is the language that the user is going to be shown when they log in). There must already be a function somewhere for getEffectiveLanguage

@phil-davis
Copy link
Contributor

get default system lang if not user specified

works

@AlexAndBear AlexAndBear force-pushed the add-config-lang-to-cloud-user-api branch from d2aae78 to 02da19d Compare May 20, 2022 08:33
@ownclouders
Copy link
Contributor

ownclouders commented May 20, 2022

💥 Acceptance tests pipeline apiWebdavProperties2-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/35799/99

@AlexAndBear AlexAndBear marked this pull request as ready for review May 20, 2022 10:08
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

50.0% 50.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@kulmann
Copy link
Contributor

kulmann commented May 20, 2022

The code could return the "effective" language for the user. If the user has explicitly set a language, then return that. If the user has not set a language then return the system default language (which is the language that the user is going to be shown when they log in). There must already be a function somewhere for getEffectiveLanguage

Fully agree, clients don't/shouldn't know or care where the language key comes from. They only need a value. The chain of fallbacks as proposed and implemented is perfect. 👍 (user choice -> system default -> hardcoded "en")

@AlexAndBear AlexAndBear merged commit 6edecaf into master May 20, 2022
@delete-merged-branch delete-merged-branch bot deleted the add-config-lang-to-cloud-user-api branch May 20, 2022 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants