diff --git a/changelog/unreleased/lang-supp-in-app.md b/changelog/unreleased/lang-supp-in-app.md new file mode 100644 index 0000000000..b55e6372ea --- /dev/null +++ b/changelog/unreleased/lang-supp-in-app.md @@ -0,0 +1,10 @@ +Enhancement: added support for configuring language locales in apps + +This is a partial backport from edge: we introduce a language option +in the appprovider, which if set is passed as appropriate parameter +to the external apps in order to force a given localization. In particular, +for Microsoft Office 365 the DC_LLCC option is set as well. +The default behavior is unset, where apps try and resolve the +localization from the browser headers. + +https://github.com/cs3org/reva/pull/3303 diff --git a/examples/storage-references/gateway.toml b/examples/storage-references/gateway.toml index 0031856e2c..963d0fe21d 100644 --- a/examples/storage-references/gateway.toml +++ b/examples/storage-references/gateway.toml @@ -46,6 +46,7 @@ mime_types = [ [grpc.services.appprovider] mime_types = ["text/plain"] +language = "en-GB" [http.services.datagateway] [http.services.prometheus] diff --git a/internal/grpc/services/appprovider/appprovider.go b/internal/grpc/services/appprovider/appprovider.go index eea33b20c1..881dc4c4b7 100644 --- a/internal/grpc/services/appprovider/appprovider.go +++ b/internal/grpc/services/appprovider/appprovider.go @@ -58,6 +58,7 @@ type config struct { GatewaySvc string `mapstructure:"gatewaysvc"` MimeTypes []string `mapstructure:"mime_types"` Priority uint64 `mapstructure:"priority"` + Language string `mapstructure:"language"` } func (c *config) init() { @@ -170,7 +171,7 @@ func getProvider(c *config) (app.Provider, error) { } func (s *service) OpenInApp(ctx context.Context, req *providerpb.OpenInAppRequest) (*providerpb.OpenInAppResponse, error) { - appURL, err := s.provider.GetAppURL(ctx, req.ResourceInfo, req.ViewMode, req.AccessToken) + appURL, err := s.provider.GetAppURL(ctx, req.ResourceInfo, req.ViewMode, req.AccessToken, s.conf.Language) if err != nil { res := &providerpb.OpenInAppResponse{ Status: status.NewInternal(ctx, errors.New("appprovider: error calling GetAppURL"), err.Error()), diff --git a/pkg/app/app.go b/pkg/app/app.go index a6edad2a02..50e6ce28d8 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -40,6 +40,6 @@ type Registry interface { // Provider is the interface that application providers implement // for interacting with external apps that serve the requested resource. type Provider interface { - GetAppURL(ctx context.Context, resource *provider.ResourceInfo, viewMode appprovider.OpenInAppRequest_ViewMode, token string) (*appprovider.OpenInAppURL, error) + GetAppURL(ctx context.Context, resource *provider.ResourceInfo, viewMode appprovider.OpenInAppRequest_ViewMode, token, language string) (*appprovider.OpenInAppURL, error) GetAppProviderInfo(ctx context.Context) (*registry.ProviderInfo, error) } diff --git a/pkg/app/provider/demo/demo.go b/pkg/app/provider/demo/demo.go index 896893fa65..9376251aa1 100644 --- a/pkg/app/provider/demo/demo.go +++ b/pkg/app/provider/demo/demo.go @@ -38,8 +38,8 @@ type demoProvider struct { iframeUIProvider string } -func (p *demoProvider) GetAppURL(ctx context.Context, resource *provider.ResourceInfo, viewMode appprovider.OpenInAppRequest_ViewMode, token string) (*appprovider.OpenInAppURL, error) { - url := fmt.Sprintf("