-
Notifications
You must be signed in to change notification settings - Fork 333
Set Default User Locale #2028
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
Set Default User Locale #2028
Changes from 3 commits
1e7bf3a
0baeb17
f10ea7b
ef10c43
02303d0
f9b7032
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The brig server config option `setDefaultLocale` has been replaced by `setDefaultUserLocale` and `setDefaultTemplateLocale`. Both settings are optional and `setDefaultTemplateLocale` defaults to `EN` and `setDefaultLocale` defaults to `setDefaultTemplateLocale`. If `setDefaultLocale` was not set or set to `EN` before this release, nothing needs to be done. If `setDefaultLocale` was set to any other language other than `EN` the name of the setting should be changed to `setDefaultTemplateLocale`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Specialize `setDefaultLocale` to distinguish between default user locale and default template locale if the user's locale is n/a. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,3 +319,27 @@ When a `null` value is encountered, it is assumed to be | |
| `defaultForNull`. | ||
|
|
||
| (Introduced in https://github.com/wireapp/wire-server/pull/1811.) | ||
|
|
||
| ### Locale | ||
|
|
||
| The brig server config option `setDefaultLocale` has been replaced by `setDefaultUserLocale` and `setDefaultTemplateLocale`. Both settings are optional and `setDefaultTemplateLocale` defaults to `EN` and `setDefaultLocale` defaults to `setDefaultTemplateLocale`. If `setDefaultLocale` was not set or set to `EN` before this release, nothing needs to be done. If `setDefaultLocale` was set to any other language other than `EN` the name of the setting should be changed to `setDefaultTemplateLocale`. | ||
|
battermann marked this conversation as resolved.
Outdated
|
||
|
|
||
| #### `setDefaultTemplateLocale` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which templates are actually complete in wire-server other than EN? i.e. this settings can't be set to anything other than EN at this point in time unless more templates are provided inside wire-server's brig/deb/templates folder, right? Perhaps the description here should make that clearer. |
||
|
|
||
| This option determines the default locale for email templates. The language of the email communication is determined by the user locale (see above). Only if templates of the the locale of the user do not exist or if user locale is not set the `setDefaultTemplateLocale` is used as a fallback. If not set the default is `EN`. This setting should not be changed unless a complete set of templates is available for the given language. | ||
|
|
||
| ``` | ||
| # [brig.yaml] | ||
| optSettings: | ||
| setDefaultTemplateLocale: en | ||
| ``` | ||
|
|
||
| #### `setDefaultUserLocale` | ||
|
|
||
| This option is the default user locale to be used if it is not set in the user profile. This can be the case if the users are provisioned by SCIM e.g. This option determines which language to use for email communication. If not set the default is the value that is configured for `setDefaultTemplateLocale`. | ||
|
|
||
| ``` | ||
| # [brig.yaml] | ||
| optSettings: | ||
| setDefaultUserLocale: en | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,13 +26,15 @@ import Brig.Types | |||||
| import Brig.User.Auth.Cookie.Limit | ||||||
| import Brig.Whitelist (Whitelist (..)) | ||||||
| import qualified Brig.ZAuth as ZAuth | ||||||
| import Control.Applicative | ||||||
| import qualified Control.Lens as Lens | ||||||
| import Data.Aeson (withText) | ||||||
| import Data.Aeson (defaultOptions, fieldLabelModifier, genericParseJSON, withText) | ||||||
| import qualified Data.Aeson as Aeson | ||||||
| import Data.Aeson.Types (typeMismatch) | ||||||
| import qualified Data.Char as Char | ||||||
| import Data.Domain (Domain (..)) | ||||||
| import Data.Id | ||||||
| import Data.LanguageCodes (ISO639_1 (EN)) | ||||||
| import Data.Misc (HttpsUrl) | ||||||
| import Data.Range | ||||||
| import Data.Scientific (toBoundedInteger) | ||||||
|
|
@@ -439,9 +441,12 @@ data Settings = Settings | |||||
| -- field names and values), should be in sync | ||||||
| -- with Spar | ||||||
| setRichInfoLimit :: !Int, | ||||||
| -- | Default locale to use | ||||||
| -- (e.g. when selecting templates) | ||||||
| setDefaultLocale :: !Locale, | ||||||
| -- | Default locale to use when selecting templates | ||||||
| -- use `setDefaultTemplateLocale` as the getter function which always provides a default value | ||||||
| setDefaultTemplateLocaleInternal :: !(Maybe Locale), | ||||||
| -- | Default locale to use for users | ||||||
| -- use `setDefaultUserLocale` as the getter function which always provides a default value | ||||||
| setDefaultUserLocaleInternal :: !(Maybe Locale), | ||||||
| -- | Max. # of members in a team. | ||||||
| -- NOTE: This must be in sync with galley | ||||||
| setMaxTeamSize :: !Word32, | ||||||
|
|
@@ -474,7 +479,7 @@ data Settings = Settings | |||||
| -- setFederationAllowedDomains: | ||||||
| -- - wire.com | ||||||
| -- - example.com | ||||||
| setFederationDomain :: !(Domain), | ||||||
| setFederationDomain :: !Domain, | ||||||
| -- | The amount of time in milliseconds to wait after reading from an SQS queue | ||||||
| -- returns no message, before asking for messages from SQS again. | ||||||
| -- defaults to 'defSqsThrottleMillis'. | ||||||
|
|
@@ -499,6 +504,18 @@ data Settings = Settings | |||||
| } | ||||||
| deriving (Show, Generic) | ||||||
|
|
||||||
| defaultTemplateLocale :: Locale | ||||||
| defaultTemplateLocale = Locale (Language EN) Nothing | ||||||
|
|
||||||
| defaultUserLocale :: Locale | ||||||
| defaultUserLocale = defaultUserLocale | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cycle.
Suggested change
(anyway it'd also be ok with me if you made both of them just |
||||||
|
|
||||||
| setDefaultUserLocale :: Settings -> Locale | ||||||
| setDefaultUserLocale = fromMaybe defaultUserLocale . setDefaultUserLocaleInternal | ||||||
|
|
||||||
| setDefaultTemplateLocale :: Settings -> Locale | ||||||
| setDefaultTemplateLocale = fromMaybe defaultTemplateLocale . setDefaultTemplateLocaleInternal | ||||||
|
|
||||||
| -- | The analog to `GT.FeatureFlags`. This type tracks only the things that we need to | ||||||
| -- express our current cloud business logic. | ||||||
| -- | ||||||
|
|
@@ -664,7 +681,16 @@ instance FromJSON Timeout where | |||||
| maybe defaultV fromIntegral bounded | ||||||
| parseJSON v = typeMismatch "activationTimeout" v | ||||||
|
|
||||||
| instance FromJSON Settings | ||||||
| instance FromJSON Settings where | ||||||
| parseJSON = genericParseJSON customOptions | ||||||
| where | ||||||
| customOptions = | ||||||
| defaultOptions | ||||||
| { fieldLabelModifier = \case | ||||||
| "setDefaultUserLocaleInternal" -> "setDefaultUserLocale" | ||||||
| "setDefaultTemplateLocaleInternal" -> "setDefaultTemplateLocale" | ||||||
| other -> other | ||||||
| } | ||||||
|
|
||||||
| instance FromJSON Opts | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.