From 02bd43c35f300329be341e608da550f10c237754 Mon Sep 17 00:00:00 2001 From: Giuseppe Lo Presti Date: Mon, 3 Oct 2022 14:24:41 +0200 Subject: [PATCH] Backport from edge: added support for language locales in apps --- changelog/unreleased/lang-supp-in-app.md | 5 ++ .../grpc/services/appprovider/appprovider.go | 2 +- pkg/app/app.go | 2 +- pkg/app/provider/demo/demo.go | 4 +- pkg/app/provider/wopi/wopi.go | 15 +++- pkg/utils/utils.go | 74 +++++++++++++++++++ 6 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/lang-supp-in-app.md diff --git a/changelog/unreleased/lang-supp-in-app.md b/changelog/unreleased/lang-supp-in-app.md new file mode 100644 index 00000000000..042920589d4 --- /dev/null +++ b/changelog/unreleased/lang-supp-in-app.md @@ -0,0 +1,5 @@ +Enhancement: added support for language locales in apps + +This is a backport of code in the edge branch + +https://github.com/cs3org/reva/pull/3303 diff --git a/internal/grpc/services/appprovider/appprovider.go b/internal/grpc/services/appprovider/appprovider.go index eea33b20c17..8b6d6c472a8 100644 --- a/internal/grpc/services/appprovider/appprovider.go +++ b/internal/grpc/services/appprovider/appprovider.go @@ -170,7 +170,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, "en-GB") 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 a6edad2a022..50e6ce28d8b 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 896893fa658..9376251aa18 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("