okta / okta-signin-widget

HTML/CSS/JS widget that provides out-of-the-box authentication UX for your organization's apps
Other
376 stars 319 forks source link

Language Support with Custom CDN #2168

Open ewan-t opened 3 years ago

ewan-t commented 3 years ago

:information_source: If you have a question, please post it on the Okta Developer Forum instead. Issues in this repository are reserved for bug reports and feature requests.

I'm submitting a

Background info

Not able to load custom languages that are not listed as part of the 27 languages in the ReadMe here when leveraging the assets.baseURL config. eg. Arabic(Iso Code: ar)

assets.baseUrl: Override the base url the widget pulls its language files from. The widget is only packaged with english text by default, and loads other languages on demand from the Okta CDN. If you want to serve the language files from your own servers, update this setting.

Expected behavior

Load the Arabic language file from the custom CDN.

What went wrong?

SIW doesn't attempt to load the file when the language is not one of the 27 languages listed here.

Steps to reproduce

    assets: {
      baseUrl: 'https://public-assets-cxdemo-siw.s3.ap-southeast-2.amazonaws.com',
    }

S3 bucket is set to public & it works if I use ja as the language with a custom language file labels/json/login_ja.json

Your environment

oleksandrpravosudko-okta commented 3 years ago

Thanks for reporting this @ewan-t.

It looks like bundle loader does not account for user additions to supported languages: https://github.com/okta/okta-signin-widget/blob/8a5ffa668ca41a60a64014b2f2e3e50ea63d0486/src/util/Bundles.js#L163

We will have this prioritized and fixed.

deekoder commented 3 years ago

@ewan-t could you try tapping into the callback here - to see if it might help the problem you are solving?

ewan-t commented 3 years ago

@ewan-t could you try tapping into the callback here - to see if it might help the problem you are solving?

I run into the same issue where it will load a language listed as a Supported Language, but not one that is not on that list of 27 languages.

deekoder commented 3 years ago

@ewan-t would you be able to share the error you are seeing when you tried the above?

denysoblohin-okta commented 3 years ago

@ewan-t Did you consider putting all translation texts into i18n.ja in config instead of loading from files?

ewan-t commented 3 years ago

@ewan-t Did you consider putting all translation texts into i18n.ja in config instead of loading from files?

I have, but it's not ideal for performance reasons when you have to load 60+ different language translations on the one page. The CDN approach would be much cleaner and far more performant.